Dumping and Restoring Postgresql Database Dumping is a process of making a file containing sql queries that can be used to contruct the whole database. Dumping is commonly used to download your database for backup or other purposes. Restoring is the reverse process of dumping. Dumping Postgresql Database To dump your Postgresql database you need to be logged on to your shell account. Please see the section called “Logging in to UNIX Shell Account” for more information about logging on shell account. Assuming your database name is u777_database,you need to use the following command to dump your Postgresql database. pg_dump -U u777_database u777_database / > u777_database.sql That command should create a file named u777_database.sql in the current directory. You can use FTP or other means to download the file. To make a gzip compressed dump file,you can use a few modification to the above command. pg_dump -U u777_database u777_database / | gzip > u777_database.sql.gz Restoring Postgresql Database To restore prevIoUsly dumped database you need to use psql. psql -U u777_database u777_database -f - / < u777_database.sql Similarly,you can use the following command to restore Postgresql database when the dumped file is gzip compressed. gunzip < u777_database.sql | / psql -U u777_database u777_database -f -
http://manual.intl.indoglobal.com/ch06s07.html