From: val <valiouk@yahoo.co.uk>
To: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
To: Marc Fromm <Marc.Fromm@wwu.edu>
Subject: Re: restore a table in a database
Date: Thu, 4 Dec 2008 13:56:40 +0000 (GMT)
Message-ID: <897635.17316.qm@web25804.mail.ukl.yahoo.com> (raw)
In-Reply-To: <B0D7C0A3F35FE144A70312D086CBCA9B0213A9273E@ExchMailbox2.univ.dir.wwu.edu>
--- On Wed, 3/12/08, Marc Fromm <Marc.Fromm@wwu.edu> wrote:
> From: Marc Fromm <Marc.Fromm@wwu.edu>
> Subject: [ADMIN] restore a table in a database
> To: "pgsql-admin@postgresql.org" <pgsql-admin@postgresql.org>
> Date: Wednesday, 3 December, 2008, 7:21 PM
> How do I restore just a table to a database? I was able to
> create a backup of the required table from a backup of the
> database as follows.
> I don't know how to properly restore the backed up
> table "departments" to the original
> "sms" database.
>
> create a new db
> createdb -U postgres smstest
>
> restore a backup of the db to the new db
> psql -U postgres smstest <
> /tmp/postgresql-sms-11-24-2008_04-05-database
>
> backup up the specific table from the restored db
> pg_dump -U postgres -a -t departments smstest >
> /tmp/smsdepartments
>
> The table backup is smsdepartments. How do I restore
> smsdepartments to the table called departments in the sms
> database?
>
> Thanks
>
> Marc
Open up the backup file and change the tablename in the CREATE and COPY commands from smsdepartments to departments. Then restore with:
psql -U postgres smstest < /tmp/smsdepartments
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: valiouk@yahoo.co.uk, Marc.Fromm@wwu.edu
Subject: Re: restore a table in a database
In-Reply-To: <897635.17316.qm@web25804.mail.ukl.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox