|
Backup and Restore
Postgres provides two utilities to backup your system: pg_dump to backup individual databases and pg_dumpall to backup your installation in one step. An individual database can be backed up using the following command: % pg_dump dbname > dbname.pgdumpand can be restored using cat dbname.pgdump | psql dbname This technique can be used to move databases to new locations, and to rename existing databases. Large Databases
Since Postgres allows tables larger than the maximum file size on your system, it can be problematic to dump the table to a file, since the resulting file will likely be larger than the maximum size allowed by your system. As pg_dump writes to stdout, you can just use standard *nix tools to work around this possible problem:
Of course, the name of the file (filename) and the content of the pg_dump output need not match the name of the database. Also, the restored database can have an arbitrary new name, so this mechanism is also suitable for renaming databases. |
|||||||||||||||||||
With any suggestions or questions please feel free to contact us |