Обсуждение: restore multiple tables postgres

Поиск
Список
Период
Сортировка

restore multiple tables postgres

От
akp geek
Дата:
Dear all -

        Can you please help me with this? Is there a way to restore multiples ( more than one table ) using a single command from a whole database dump that was created using pg_dump


regards

Re: restore multiple tables postgres

От
Scott Mead
Дата:

On Wed, Apr 14, 2010 at 10:56 AM, akp geek <akpgeek@gmail.com> wrote:
Dear all -

        Can you please help me with this? Is there a way to restore multiples ( more than one table ) using a single command from a whole database dump that was created using pg_dump


Depends on exactly how you took the pg_dump.

  Did you use -F c or -F t?

--Scott
 

regards

Re: restore multiple tables postgres

От
raghavendra t
Дата:
Hi
 
Hope this will help you out. Its has bothe pg_dump and pg_restore, with -t option
 
Regards
Raghavendra

 
On Wed, Apr 14, 2010 at 8:33 PM, Scott Mead <scott.lists@enterprisedb.com> wrote:

On Wed, Apr 14, 2010 at 10:56 AM, akp geek <akpgeek@gmail.com> wrote:
Dear all -

        Can you please help me with this? Is there a way to restore multiples ( more than one table ) using a single command from a whole database dump that was created using pg_dump


Depends on exactly how you took the pg_dump.

  Did you use -F c or -F t?

--Scott
 

regards


Re: restore multiple tables postgres

От
Scott Mead
Дата:

On Wed, Apr 14, 2010 at 11:03 AM, Scott Mead <scott.lists@enterprisedb.com> wrote:

On Wed, Apr 14, 2010 at 10:56 AM, akp geek <akpgeek@gmail.com> wrote:
Dear all -

        Can you please help me with this? Is there a way to restore multiples ( more than one table ) using a single command from a whole database dump that was created using pg_dump


I just realized what you were asking, sorry... you were asking about multiple tables during restore.  I thought that you could do:

  pg_restore -t <table> -t <table1> 
 or
  pg_restore -t <table>,<table1> 

  But it looks like you can't (just tried it with 8.4.2 pg_restore).

  Sorry for the mis-read.

--Scott
 

Depends on exactly how you took the pg_dump.

  Did you use -F c or -F t?

--Scott
 

regards


Re: restore multiple tables postgres

От
akp geek
Дата:
Thanks a lot.

On Wed, Apr 14, 2010 at 11:15 AM, Scott Mead <scott.lists@enterprisedb.com> wrote:

On Wed, Apr 14, 2010 at 11:03 AM, Scott Mead <scott.lists@enterprisedb.com> wrote:

On Wed, Apr 14, 2010 at 10:56 AM, akp geek <akpgeek@gmail.com> wrote:
Dear all -

        Can you please help me with this? Is there a way to restore multiples ( more than one table ) using a single command from a whole database dump that was created using pg_dump


I just realized what you were asking, sorry... you were asking about multiple tables during restore.  I thought that you could do:

  pg_restore -t <table> -t <table1> 
 or
  pg_restore -t <table>,<table1> 

  But it looks like you can't (just tried it with 8.4.2 pg_restore).

  Sorry for the mis-read.

--Scott
 

Depends on exactly how you took the pg_dump.

  Did you use -F c or -F t?

--Scott
 

regards



Re: restore multiple tables postgres

От
"Rob Richardson"
Дата:
I often have to create test copies of a production database.   The database has several large tables that contain historical data that is not needed for our system to run, and just wastes time doing backups and restores.  I created two batch files, one for backing up and the other for restoring.  The backup file begins with a command to backup the scheme of the database, and then there is a series of commands to backup the tables I need, once command per table.  The restore file works the same way.  I think a similar idea would help you.  You could trim the batch files (or at least the restore batch file) to give you only the tables you need.
 
If you want, I'd be happy to E-mail you the batch files.
 
RobR

Re: restore multiple tables postgres

От
akp geek
Дата:
Thanks for guidance. If you could share the file, I appreciate it

Regards

On Wed, Apr 14, 2010 at 11:27 AM, Rob Richardson <Rob.Richardson@rad-con.com> wrote:
I often have to create test copies of a production database.   The database has several large tables that contain historical data that is not needed for our system to run, and just wastes time doing backups and restores.  I created two batch files, one for backing up and the other for restoring.  The backup file begins with a command to backup the scheme of the database, and then there is a series of commands to backup the tables I need, once command per table.  The restore file works the same way.  I think a similar idea would help you.  You could trim the batch files (or at least the restore batch file) to give you only the tables you need.
 
If you want, I'd be happy to E-mail you the batch files.
 
RobR


Re: restore multiple tables postgres

От
Ivan Sergio Borgonovo
Дата:
On Wed, 14 Apr 2010 10:56:36 -0400
akp geek <akpgeek@gmail.com> wrote:

> Dear all -
>
>         Can you please help me with this? Is there a way to restore
> multiples ( more than one table ) using a single command from a
> whole database dump that was created using pg_dump

Something along the line of:

http://www.webthatworks.it/d1/node/page/excluding_some_tables_data_backup_including_their_schema


--
Ivan Sergio Borgonovo
http://www.webthatworks.it