Re: Restiring pg_dump text file - Mailing list pgsql-admin

From raghu ram
Subject Re: Restiring pg_dump text file
Date
Msg-id d331f2ee0906301915y4c888793h853164f6e808eb5d@mail.gmail.com
Whole thread Raw
In response to Restiring pg_dump text file  (Mike angelo <angelocmp@yahoo.com>)
List pgsql-admin


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

pgsql-admin by date:

Previous
From: raghu ram
Date:
Subject: Re: terminate PG connections
Next
From: donghe@caltech.edu
Date:
Subject: Re: Restiring pg_dump text file