How do I restore my data?

Submitted by ehu on Mon, 05/13/2013 - 13:04

Assuming you have followed the How Do I Backup My Data instructions, you can restore your database as follows...

1) Restore the roles

$ psql -h [database host] -U [database admin user] < [roles backup file]

For example:

$ psql -h localhost -U lsmb_dbadmin < lsmb-roles.sqlc

2) Create a new database to restore into

$ psql -h [database host] -U [database admin user] -c 'CREATE DATABASE [new company name]'

For example:

$ psql -h localhost -U lsmb_dbadmin -c 'CREATE DATABASE newcompany'

3) Restore the company backup into the new database:

$ psql -h [database host] -U [database admin user] [new company name] < [company backup file]

For example:

$ psql -h localhost -U lsmb_dbadmin newcompany < lsmb-db.sqlc
FAQ Category
Topic