Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Full Backup

Creating database backups is essential in any server setup in case of a server crash or if a modification goes wrong and data is accidentally deleted. The file must be dumped as a sql file.

pg_dumpall > backupfile.sql

pg_dumpall backs up all databases, users and permissions. This is good for small databases .

Incremental Backup

To make incremental backups you need to create a base backup 

pg_dump db > backupfile.sql

pg_dump only backs up one database at a time and does not save the users or permissions. Restoring from pg_dump requires that you have a base backup set in before you can restore otherwise you will get errors when you restore. 

-Fc

To create custom backups in file format tar or dump.

Restoring Database

There are several ways to restore a database.

psql < backupfile.sql

...

Database Commands

 \l

List of all databases, owners and access privileges.

\du

List of roles, attributes and Group affiliation.

\d

List of all tables.

TBC by Roderick

  • No labels