From the course: PostgreSQL: Client Applications

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Data-only and schema-only backups

Data-only and schema-only backups - PostgreSQL Tutorial

From the course: PostgreSQL: Client Applications

Data-only and schema-only backups

- [Instructor] A full database backup includes everything that you need to restore the database completely on a new server. This means it contains the fully designed table schemas and all of the data. But you can decide to backup only one component or the other with a couple of useful options. We'll start with the same pg_dump command that we've used previously. I'll connect to my local host with the user Postgres. Now you can choose to just back up the design or the schema of the database. Which can be used to restore empty tables that don't contain any data. But do include all of the column definitions, constraints and relationships. To do that you'll add the -S or --schema-only option. I'll finish the command by creating the backup of my two trees database. Then I'll save it onto my desktop in a file called two trees schema.SQL. I'll press enter. And that creates the schema only backup on my desktop. Now the opposite backup type is to just include the data. We'll start the command…

Contents