Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 4025E64FE97 for ; Thu, 4 Dec 2008 09:56:46 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 42437-03 for ; Thu, 4 Dec 2008 09:56:43 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from web25804.mail.ukl.yahoo.com (web25804.mail.ukl.yahoo.com [217.12.10.189]) by mail.postgresql.org (Postfix) with SMTP id 46BEA64FDDF for ; Thu, 4 Dec 2008 09:56:43 -0400 (AST) Received: (qmail 18061 invoked by uid 60001); 4 Dec 2008 13:56:40 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.uk; h=X-YMail-OSG:Received:X-Mailer:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=RlPueqsIdQmitlVtvI05/OOpoI3PJa8wLdHcLKfupZoSBfhytkooux7ZUgshF9/PUfQcQ3HocnoqwKSJFcBMEyiYpwbToKMxD++PTQX8lykq+mSzCNf8TCOZ9BLevSpcc44Cfi0q/SD4fgIrG7568jYyPXaRrwnGUerQWQb+euw=; X-YMail-OSG: mds915QVM1kDmAVMurOLLd1AeAFhohm3HafoDnDF_BPH2h.anXrmhuMzQgZZN_u1nrJWqTuVjNSyS8t86nFGcv.OcX1SmeNW1JoehSU6qnMsGKmC5PhWo7J1kTO1LfU3YLYRYvKgpDU9rh.I7KLrVsWndjanO_RnYWAegEHV0FhFspc- Received: from [62.254.183.130] by web25804.mail.ukl.yahoo.com via HTTP; Thu, 04 Dec 2008 13:56:40 GMT X-Mailer: YahooMailWebService/0.7.260.1 Date: Thu, 4 Dec 2008 13:56:40 +0000 (GMT) From: val Reply-To: valiouk@yahoo.co.uk Subject: Re: restore a table in a database To: "pgsql-admin@postgresql.org" , Marc Fromm In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Message-ID: <897635.17316.qm@web25804.mail.ukl.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200812/24 X-Sequence-Number: 30857 --- On Wed, 3/12/08, Marc Fromm wrote: > From: Marc Fromm > Subject: [ADMIN] restore a table in a database > To: "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. >=20 > create a new db > createdb -U postgres smstest >=20 > restore a backup of the db to the new db > psql -U postgres smstest < > /tmp/postgresql-sms-11-24-2008_04-05-database >=20 > backup up the specific table from the restored db > pg_dump -U postgres -a -t departments smstest > > /tmp/smsdepartments >=20 > The table backup is smsdepartments. How do I restore > smsdepartments to the table called departments in the sms > database? >=20 > Thanks >=20 > Marc Open up the backup file and change the tablename in the CREATE and COPY com= mands from smsdepartments to departments. Then restore with: psql -U postgres smstest < /tmp/smsdepartments =0A=0A=0A