Re: conditional backup

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: <suhailck(at)gmail(dot)com>,<pgsql-admin(at)postgresql(dot)org>
Subject: Re: conditional backup
Date: 2010-07-16 15:48:12
Message-ID: 4C4038EC0200002500033719@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

suhailck <suhailck(at)gmail(dot)com> wrote:

> I need to take backup of my postgresql DB, but not all records
> from a few tables.

You can exclude particular tables from a database backup using the
-T option (which can be included multiple times). You can dump just
the schema for particular tables with the -s and -t switches. You
can use the \copy command in psql to copy out selected rows using
syntax like:

\copy (select * from C_order where period=2009 and org <> 'A') to
C_order.data

You should be able to wire something together from those pieces.

-Kevin

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Craig James 2010-07-16 16:56:41 secret key for encryption
Previous Message Bill MacArthur 2010-07-16 15:34:59 Re: Weird sorting order