Re: [GENERAL] Dump and Restore

From: "Thilina Gunasekara" <tgunasekara(at)openworld(dot)org>
To: "Eduardo S (dot) Fontanetti" <dufuzzy(at)yahoo(dot)com(dot)br>
Cc: <pgsql-admin(at)postgresql(dot)org>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: [GENERAL] Dump and Restore
Date: 2004-08-24 15:38:19
Message-ID: GFEELPGDCGLLEBPEEOKGIEGJCAAA.tgunasekara@openworld.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general

Assuming you're using Unix Box
1. Dump your database DB_X
pg_dump -v -U postgresUsername DB_X | gzip -f - > DB_X.gz

2.Create database DB_Y
psql -U postgresUsername template1
CREATE DATABASE DB_Y
\q

3. zcat DB_X.gz | psql -U postgresUsername -f - DB_Y

Thilina

-----Original Message-----
From: pgsql-admin-owner(at)postgresql(dot)org
[mailto:pgsql-admin-owner(at)postgresql(dot)org]On Behalf Of Paul Thomas
Sent: 24 August 2004 16:30
To: Eduardo S . Fontanetti
Cc: pgsql-admin(at)postgresql(dot)org; pgsql-general(at)postgresql(dot)org
Subject: Re: [ADMIN] [GENERAL] Dump and Restore

On 24/08/2004 14:40 Eduardo S. Fontanetti wrote:
> How can I do a test if my dumping is really working, I
> can't apply the dump in my database, because it will
> overwrite a lot of data. I was thinking about restore
> in another database name, but I can't, it always
> restore on the original database.
>
> Somebody have a cooking recipe about to test if my
> backup is working fine, and will help if I need
> sometime?

Are you using pg_dump or pg_dumpall? I just use pg_dump on individual
databases (pg_dumpall works on the whole cluster) and can restore that to
any database.

HTH

--
Paul Thomas
+------------------------------+--------------------------------------------
-+
| Thomas Micro Systems Limited | Software Solutions for
Business |
| Computer Consultants |
http://www.thomas-micro-systems-ltd.co.uk |
+------------------------------+--------------------------------------------
-+

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Ron St-Pierre 2004-08-24 16:28:15 Re: Dump and Restore
Previous Message Paul Thomas 2004-08-24 15:29:56 Re: [GENERAL] Dump and Restore

Browse pgsql-general by date

  From Date Subject
Next Message mike 2004-08-24 15:40:25 Re: Invalid input for integer on VIEW
Previous Message Tom Lane 2004-08-24 15:35:38 Re: select ... where <column>='' does a seqscan [auf Viren geprueft]