Received: from moutvdomng1.kundenserver.de (moutvdomng1.kundenserver.de [212.227.126.181]) by postgresql.org (Postfix) with ESMTP id 685D84776F2 for ; Sun, 17 Mar 2002 17:54:16 -0500 (EST) Received: from [212.227.126.155] (helo=mrvdomng2.kundenserver.de) by moutvdomng1.kundenserver.de with esmtp (Exim 3.22 #2) id 16mjXd-0002PN-00 for pgsql-php@postgresql.org; Sun, 17 Mar 2002 23:54:17 +0100 Received: from pd9e5f147.dip0.t-ipconnect.de ([217.229.241.71] helo=finner.de) by mrvdomng2.kundenserver.de with smtp (Exim 3.22 #2) id 16mjXc-0001yu-00 for pgsql-php@postgresql.org; Sun, 17 Mar 2002 23:54:17 +0100 Received: (qmail 6797 invoked from network); 17 Mar 2002 22:54:15 -0000 Received: from localhost (HELO lorien) (frank@127.0.0.1) by localhost with SMTP; 17 Mar 2002 22:54:15 -0000 Message-ID: X-Mailer: XFMail 1.4.0 on Linux X-Priority: 3 (Normal) Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 In-Reply-To: <20020313220401.82428FCA2@bugs.unl.edu.ar> Date: Sun, 17 Mar 2002 23:54:15 +0100 (CET) From: Frank Finner To: =?iso-8859-1?q?Mart=EDn=20Marqu=E9s?= Subject: Re: backup postgres database Cc: PGSQL , arun kv X-Archive-Number: 200203/36 X-Sequence-Number: 1005 Hi Martin! Ah, stupid me, you are right. Even if one has ALL create statements within the dump, including the "create database", one must connect to a database to be able to run the commands within the dump.=20 If in doubt, which database to use, one should always be able to connect to database "template1" without great possibilities to damage something (except one connects as user postgres) and run the dumped commands, because "template1" is always there in a postgres installation. But please be sure not to insert your tables into template1, because everything what is in this database is used as template for every new database! Just use it as a "connection database" and run some commands similiar to Create Database "my_db"; \connect my_db my_username as the first commands of the dump (this is what "pg_dump -C " gives you)!=20 Another reason to carefully study the manpages... ;-) Greetings, Frank. On 13-Mar-02 Mart=EDn Marqu=E9s sat down, thought for a long time and then wrote: > On Mi=E9 13 Mar 2002 15:51, you wrote: >> Hi, >> >> pg_dump and psql are your friends. >> >> Dump the database with pg_dump, take the file and insert it into >> psql >> on the other machine. Details are covered in the manpages of these >> programs. >> >> Crude (without options): pg_dump your_db > your_db.dump >> psql < your_db.dump >=20 > This will almost always give an error (even though lots of docs have > this=20 > sintaxis). That's because you didn't tell psql which database to > connect to,=20 > so he'll try to connect to a database with the name of the user (in > my case,=20 > that would be martin, or postgres in the case of administration > duties). >=20 > My 2 cents >=20 > --=20 > Porqu=E9 usar una base de datos relacional cualquiera, > si pod=E9s usar PostgreSQL? > ----------------------------------------------------------------- > Mart=EDn Marqu=E9s | mmarques@unl.edu.ar > Programador, Administrador, DBA | Centro de Telematica > Universidad Nacional > del Litoral > ----------------------------------------------------------------- >=20 > ---------------------------(end of > broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to > majordomo@postgresql.org -- Frank Finner And now there is no turning back at all. (M. Moorcock, "Elric Of Melnibone")"