Specify tables to be backed up

From: "Rob Richardson" <Rob(dot)Richardson(at)rad-con(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Specify tables to be backed up
Date: 2008-09-15 13:56:01
Message-ID: 04A6DB42D2BA534FAC77B90562A6A03DA95414@server.rad-con.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Greetings!

The PostGRES database our application relies on takes about an hour to
back up and another hour to restore. It doesn't have very many tables
(about 80), and most don't have very many records. The time is consumed
by a couple of tables that are likely to have hundreds of thousands of
records, and at least one of those is indexed. Those records contain
historical data that is not needed for testing. I would like to be able
to perform a backup that includes the schema for those tables but does
not include their records. As a test, I tried running pg_dump using -t
twice, hoping to get a file that contained backup information for two
table. I only got one table. I'm thinking the only way of doing what I
want to do is to have a batch file that contains a string of pg_dump
calls, something along the lines of:

pg_dump -t table1 MyDatabase > mydump.backup
pg_dump -t table2 MyDatabase >> mydump.backup
pg_dump -t -s big_table_I_only_want_the_schema_of MyDatabase >>
mydump.backup

Will that work? Is there a better way?

Robert D. Richardson
Product Engineer Software

<file:///t:/Sales/Images/Marketing%20Pictures/Logos/LOGOs%20from%2010th%
20Floor/RAD-CON%20Logo%20for%20Signature.jpg>
RAD-CON, Inc.
TECHNOLOGY: Innovative & Proven
Phone : +1.216.706.8905
Fax: +1.216.221.1135
Website: www.RAD-CON.com <http://www.rad-con.com/>
E-mail: rob(dot)richardson(at)RAD-CON(dot)com


Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2008-09-15 14:14:01 Re: Specify tables to be backed up
Previous Message Steve T 2008-09-15 08:40:34 Re: Invalid Byte Sequence for Encoding Error