Recovery models for PostgreSQL
Recovery models for PostgreSQL
|
Release 9.3 |
|
To restore a database from an archive file created using the pg_dump command, use the pg_restore command.
-Database names must be unique on the PostgreSQL instance, so you should drop the old database.
dropdb mypgdb –U sde
-Re-create the database.
createdb mypgdb –E UTF8 –D <tablespace> –U sde
Then restore the database using the pg_restore command.
pg_restore –d mypgdb mypgdb1031.dump –U sde
You can specify ––exit on error with pg_restore to cause psql to exit when it encounters a SQL error during the restore.
Tip
- You should run ANALYZE after restoring the database to rebuild database statistics.
- If you have PostGIS installed and are using Geometry storage, be sure to read PostGIS's documentation about creating backups and restoring databases. This procedure could vary depending on the version of PostGIS.