Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: Can I backup/restore a database in a sql script?


  • From: Richard Huxton <dev(at)archonet(dot)com>
  • To: Joost Kraaijeveld <J(dot)Kraaijeveld(at)Askesis(dot)nl>
  • Cc: pgsql-general(at)postgresql(dot)org, pgsql-admin(at)postgresql(dot)org
  • Subject: Re: Can I backup/restore a database in a sql script?
  • Date: Fri, 22 Jun 2007 10:09:39 +0100
  • Message-id: <467B91D3(dot)60300(at)archonet(dot)com>

Joost Kraaijeveld wrote:
Hi,

I want to write a sql script in which I backup a database and restore
a new (altered) version of that database. Is that possible? If so ,
can anyone give me an example of how to do that?

I can run it from any command prompt (psql -U postgres template1 <
my_db.backup)    but I would like it to run from psql (which should
give me 1 script for all platforms I must do this: Windows, FreeBSD
and Debian)

You can restore using just psql (because pg_dump can produce an sql file to be processed). I don't know of any way to backup a database that doesn't use pg_dump.

--
  Richard Huxton
  Archonet Ltd



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group