Re: Restiring pg_dump text file

From: raghu ram <raghuchennuru(at)gmail(dot)com>
To: Mike angelo <angelocmp(at)yahoo(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Restiring pg_dump text file
Date: 2009-07-01 02:15:33
Message-ID: d331f2ee0906301915y4c888793h853164f6e808eb5d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Wed, Jul 1, 2009 at 12:59 AM, Mike angelo <angelocmp(at)yahoo(dot)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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message donghe 2009-07-01 03:26:48 Re: Restiring pg_dump text file
Previous Message raghu ram 2009-07-01 01:40:37 Re: terminate PG connections