X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id B927AD1B47D for ; Wed, 17 Dec 2003 17:27:56 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 63404-01 for ; Wed, 17 Dec 2003 13:27:26 -0400 (AST) Received: from ndl1mr1-a-fixed.sancharnet.in (ndl1mr1-a-fixed.sancharnet.in [61.0.0.45]) by svr1.postgresql.org (Postfix) with ESMTP id 50691D1B437 for ; Wed, 17 Dec 2003 13:27:25 -0400 (AST) Received: from conversion-daemon.ndl1mr1-a-fixed.sancharnet.in by ndl1mr1-a-fixed.sancharnet.in (iPlanet Messaging Server 5.2 HotFix 1.17 (built Jun 23 2003)) id <0HQ100K01UMS7V@ndl1mr1-a-fixed.sancharnet.in> for pgsql-admin@postgresql.org; Wed, 17 Dec 2003 22:50:06 +0530 (IST) Received: from sancharnet.in ([61.0.95.116]) by ndl1mr1-a-fixed.sancharnet.in (iPlanet Messaging Server 5.2 HotFix 1.17 (built Jun 23 2003)) with ESMTPA id <0HQ100KZYUT3EV@ndl1mr1-a-fixed.sancharnet.in>; Wed, 17 Dec 2003 22:50:06 +0530 (IST) Date: Wed, 17 Dec 2003 22:54:37 +0530 From: Sai Hertz And Control Systems Subject: Re: Question about backing up PostgreSQL databases In-reply-to: <3FE08C5F.4000209@sancharnet.in> To: aspire420@hotpop.com Cc: "Van L. Loggins" , pgsql-admin@postgresql.org Reply-To: aspire420@hotpop.com Message-id: <3FE09155.1020607@sancharnet.in> Organization: Sai Hertz And Control Systems MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 References: <20031217104858.1cddaa0b.vloggins@turbocorp.com> <3FE08C5F.4000209@sancharnet.in> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/245 X-Sequence-Number: 11751 I forgot to add one thing : For file system backup and restore PostgreSQL must be stoped Regards V Kashyap > Dear Van L. Loggins , > >> What methods are available to easily backup the contents of a >> PostgreSQL database? >> >> > PostgreSQL both file system backup option and SQL data in form of > insert statement : > Note: I have done this thing with > PostgreSQL 7.3 > This is what I do > 1. Take a file system backup of PostgreSQL "data" folder > preferably with DUMP > 2. Take a back up of data with > pg_dump --disable-triggers -U -a -d -b -D -Fc -Z > 9 -f filename.tar.gz > a. This will take care of blobs (Though 7.2 does not have it) > b. Make sure that your data be less than 8 GB as tar could not > handle more than that > 3. Yes Schema is also required to be backed up with above command and > having switch as > > pg_dump --disable-triggers -U -s Fp -f > schema.sql > 4. Now why Schema is dumped separately to that of data > Because : > a. pg_dump will dump the schema as per its own wish and not as per > the database requirement so > if a required user defined function is not in the secema dump > as early as it is required your pg_restore will > abort with Xmas bells > b. In this case you can rearrange the creation of Schema as > Create functions > then table > then sequences > then views > 5. Now after all stuff you have done install your new OS > initdb a new database in the same directory location as it was in > the old one (i.e in the older OS) > 6. Now try restore the Schema if succeeds then go to 7 else > rearrange your sql statements to satisfy the monster > 7. Restore Data with > pg_restore --disable-triggers -U -d NAME> ./filename.tar.gz > 8. Now if 6 and 7 fails you have a chance reinstall the older version > of postgresql and also its DUMP file to regain the data and schema > again and start again from point 2 to 8 > > This is what I do to restore / migrate and have got 100 % results > till date > > Any one having a better and more reliable method please pass it on to > Anjan Dave and me > > We would be grateful to you > > Regrads, > V Kashyap > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > >