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

Version 1 Next »

This section briefly describes how to backup and restore PostgreSQL database.

Backup

PostgreSQL provides the utility program pg_dump for taking the backup of database. Following is the syntax of this command:

pg_dump -h [hostname] -p [port_number] -U [username] -W [password] [databasename] > [backupfile.sql]

[hostname] - this is your database server host
[port_number] - this is your database server port number
[username] - this is your database username
[password] - this is the password for your database
[databasename] - the name of your RMsis database
[backupfile.sql] - the file to which the backup should be written.

Restore

The idea behind pg_dump is to generate a text file with SQL commands that, when fed back to the server, will recreate the database in the same state as it was at the time of the dump.The text files created by pg_dump are intended to be read in by the psql program. Following is the general command syntax to restore a dump :

psql -h [hostname] -p [port_number] -U [username] -W [password] [database_to_restore] < [backupfile.sql]

 

A detailed explanation for backup and restore of PostgreSQL database is available here :

http://www.postgresql.org/docs/9.2/interactive/backup-dump.html

  • No labels