On Wed, Jul 1, 2009 at 12:59 AM, Mike angelo
<angelocmp@yahoo.com> wrote:
I've backed up my DB via 'pg_dump dbname' using no options. In order to restore it via psql, do I first need to drop the db instance and recreate it?
Thanks in advance for your help.
-Mike
Hi Mike,
This is not the proper way to restore the dump in database and also no need to drop the db instance. See the below steps you can get detail information of dumping/restoring with proper log information.
(1) Create database in you database instance.
create database <database name>;
(2) Below commands will give you detail information of dumping/restoring with proper log information.
Dump command:
============
pg_dump -f <out_put_filename> -Fc –v -h <host_name> -P <database_port_number> -U <database_username> DATABASENAME
Restore command:
===============
(2) pg_restore - d <connect_database_name> -Fc -v -h <host_name_ip> -p <database_port_number> -U <Database_user_name> [DUMP_FILE_NAME]
Method2:-
We can able to take dump and restore of database in this way also.
Dump command:-
==============
pg_dump.exe -U postgres (user name) -p 5464 (port) postgres (database) > post.sql
Restore command:-
==============
psql -d raghu (new database) -p 5464 (port) -U postgres (username) -f post.sql (dump file)
Thanks & Regards,
Raghu Ram