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

Re: [GENERAL] 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: [GENERAL] Can I backup/restore a database in a sql script?
Date: 2007-06-22 09:09:39
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-adminpgsql-general
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

In response to


pgsql-admin by date

Next:From: davood khoshfetratDate: 2007-06-22 11:16:38
Subject: big tables in postgres and sub records.
Previous:From: Vishal AroraDate: 2007-06-22 08:43:15
Subject: Re: back up maintenance schedule

pgsql-general by date

Next:From: Teodor SigaevDate: 2007-06-22 09:18:53
Subject: Re: Regression - Query requires full scan, GIN doesn't support it
Previous:From: David GoodenoughDate: 2007-06-22 08:42:18
Subject: Regular express question

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group