restore multiple tables postgres

Started by akp geekalmost 16 years ago8 messagesgeneral
Jump to latest
#1akp geek
akpgeek@gmail.com

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

#2Scott Mead
scott.lists@enterprisedb.com
In reply to: akp geek (#1)
Re: restore multiple tables postgres

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

Show quoted text

regards

#3raghavendra t
raagavendra.rao@gmail.com
In reply to: Scott Mead (#2)
Re: restore multiple tables postgres

Hi

Hope this will help you out. Its has bothe pg_dump and pg_restore, with -t
option

http://www.postgresql.org/docs/8.4/static/app-pgrestore.html
Regards
Raghavendra

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

Show quoted text

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

#4Scott Mead
scott.lists@enterprisedb.com
In reply to: Scott Mead (#2)
Re: restore multiple tables postgres

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

Show quoted text

Depends on exactly how you took the pg_dump.

Did you use -F c or -F t?

--Scott

regards

#5akp geek
akpgeek@gmail.com
In reply to: Scott Mead (#4)
Re: restore multiple tables postgres

Thanks a lot.

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

Show quoted text

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

#6Rob Richardson
Rob.Richardson@rad-con.com
In reply to: akp geek (#5)
Re: restore multiple tables postgres

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

#7akp geek
akpgeek@gmail.com
In reply to: Rob Richardson (#6)
Re: restore multiple tables postgres

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

Show quoted text

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

#8Ivan Sergio Borgonovo
mail@webthatworks.it
In reply to: akp geek (#1)
Re: restore multiple tables postgres

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