From: Richard Huxton <dev@archonet.com>
To: Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl>
Cc: pgsql-general@postgresql.org
Cc: pgsql-admin@postgresql.org
Subject: Re: [GENERAL] Can I backup/restore a database in a sql script?
Date: Fri, 22 Jun 2007 10:09:39 +0100
Message-ID: <467B91D3.60300@archonet.com> (raw)
In-Reply-To: <A3D1526C98B7C1409A687E0943EAC41060600F@obelix.askesis.nl>
References: <A3D1526C98B7C1409A687E0943EAC41060600F@obelix.askesis.nl>
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
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: dev@archonet.com, J.Kraaijeveld@Askesis.nl, pgsql-general@postgresql.org
Subject: Re: [GENERAL] Can I backup/restore a database in a sql script?
In-Reply-To: <467B91D3.60300@archonet.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