PostgreSQL dump and restore

Backup

To manually backup the database use the PostgreSQL pg_dump command:

pg_dump --create --format=c --file=backup.dmp --username=postgres jiglu

You will be prompted for the password of the postgres user.

Restore

To restore the database on the same operating system and with the same database name you will first need to create the user and owner user:

psql postgres postgres
create user jiglu password 'secret';
create user jigluowner password 'secret';

You will first be prompted for the password of the postgres user. You will need to change the passwords in the two SQL lines as appropriate. Returning to the OS shell you then need to run:

pg_restore -C -d postgres -U postgres backup.dmp

You will be prompted for the password of the postgres user.

Note that if you restore the database in this way it will then be necessary to rebuild the search indexes.

Written by Stephen Hebditch. Published on .
3.0.0
How to backup and restore the Jiglu database to and from a file.