Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 825251337C1C for ; Fri, 1 Apr 2011 12:46:21 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 73067-01-6 for ; Fri, 1 Apr 2011 15:46:12 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from rs73.luxsci.com (rs73.luxsci.com [64.49.254.135]) by mail.postgresql.org (Postfix) with ESMTP id 8319B1337B8B for ; Fri, 1 Apr 2011 12:45:57 -0300 (ADT) Received: from SenthilKumarG (NSG-Static-233.156.72.182.airtel.in [182.72.156.233] (may be forged)) (authenticated bits=0) by rs73.luxsci.com (8.13.8/8.13.8) with ESMTP id p31Fjqax000615; Fri, 1 Apr 2011 10:45:53 -0500 Message-Id: <201104011545.p31Fjqax000615@rs73.luxsci.com> From: "Senthil Kumar G" To: "'raghu ram'" Cc: In-Reply-To: Subject: Re: DB Import Error... Date: Fri, 1 Apr 2011 21:15:59 +0530 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_41D4_01CBF0B2.0173C3C0" X-Mailer: Microsoft Office Outlook, Build 11.0.5510 Thread-Index: AcvwgUY8bGKe+5+7QBiFmDdBIEU9UAAAl2Cw X-MimeOLE: Produced By Microsoft MimeOLE V6.1.7600.16543 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.609 tagged_above=-10 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001, MAY_BE_FORGED=0.29 X-Spam-Level: X-Archive-Number: 201104/27 X-Sequence-Number: 37208 This is a multi-part message in MIME format. ------=_NextPart_000_41D4_01CBF0B2.0173C3C0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Thanks raghu ram for your immediate response, i will try this path too along with my team and i will come back if any issues. Thanks Senthil _____ From: raghu ram [mailto:raghuchennuru@gmail.com] Sent: Friday, April 01, 2011 8:57 PM To: Senthil Kumar G Cc: pgsql-admin@postgresql.org Subject: Re: [ADMIN] DB Import Error... On Fri, Apr 1, 2011 at 8:34 PM, Senthil Kumar G wrote: Hi I am upgrading my staging environment from postgresql 8.2.3 to 9.0.3. I was able to do successfully. But, when i try to import the database which is created in 8.2.0 version to 9.0.3 version environment, i am getting following error. ERROR: constraint "xxxx" for relation "xxxx" already exist Based on above error message it looks like the constraint for relation already exists. Could you please follow below steps to upgrade from older version to new version:: Step 1: Perform the global dump on old cluster [ i.e PostgreSQL 8.2.3] using "pg_dumpall" binary of new PostgreSQL 9.0. /opt/PostgreSQL/9.0/bin/pg_dumpall -d postgres -U postgres -p 5432 -g > /tmp/globaldump_oldpg823.sql NOTE: It Dumps only global objects i.e roles,users and tablespaces,no databases. Assuming old cluster running on the 5432 port number. Step 2: Take the dump of the database in compressed format using new version of pg_dump binary. Syntax: /opt/PostgreSQL/9.0/bin/pg_dump -Fc -v -p 5432 -f nohup /opt/PostgreSQL/9.0/bin/pg_dump -Fc -v -p 5432 -f /tmp/demo.dmp demo>> /tmp/dump.log 2>> /tmp/dump.log & -P => port number of old cluster -Fc => compressed format -v => verbose output -f => location of dump file to store and dump file name NOTE: Assuming old cluster running on the 5432 port number Step 3: Restore the global dump on new cluster of PostgreSQL 9.0.2 /opt/PostgreSQL/9.0/bin/psql -d postgres -U postgres -p 5433 -f /tmp/globaldump_oldpg832.sql NOTE: Assuming new cluster running on the 5433 port number Step 4: Restore the compressed dump file using new version of pg_restore binary with parallel restore operation. nohup /opt/PostgreSQL/9.0/bin/pg_restore -Fc -v -p 5433 -d demo -j 8 /tmp/demo.dmp >>/tmp/restore1.log 2>>/tmp/restore1.log & NOTE: Assuming new cluster running on the 5433 port number --Raghu Ram when i query it was not found. What could be the reason? What should i do to resolve this? Appreciate your quick answer. Thanks & Regards Senthil ------=_NextPart_000_41D4_01CBF0B2.0173C3C0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Thanks raghu ram for your immediate response,

i will try this path too along with = my team and i will come back if any issues.

 

Thanks

Senthil

=

 


From: raghu = ram [mailto:raghuchennuru@gmail.com]
Sent: Friday, April 01, = 2011 8:57 PM
To: Senthil Kumar G
Cc: = pgsql-admin@postgresql.org
Subject: Re: [ADMIN] DB = Import Error...

 

 

On Fri, Apr 1, 2011 at 8:34 PM, Senthil Kumar G <senthil@zoniac.com> = wrote:

Hi<= /p>

 

I am upgrading my staging environment from postgresql 8.2.3 to = 9.0.3.

 

I was able to do successfully.

 

But, when i try to import the database which is created in 8.2.0 version to 9.0.3 = version environment, i am getting following error.

 

ERROR:  constraint "xxxx” for relation "xxxx” already = exist

 

Based on above error message it looks like the constraint for relation already = exists.

Could you please follow below steps to upgrade = from older version to new version::

Step 1: = Perform the global dump on old cluster [ i.e PostgreSQL 8.2.3] using "pg_dumpall" binary of new PostgreSQL = 9.0.

/opt/PostgreSQL/9.0/bin/pg_dumpall -d postgres -U postgres -p 5432 -g > /tmp/globaldump_oldpg823.sql

NOTE: = It Dumps only global objects i.e roles,users and tablespaces,no databases.

Assuming old cluster running on the 5432 port = number.

Step 2: = Take the dump of the database in compressed format using new = version of pg_dump binary.

Syntax: /opt/PostgreSQL/9.0/bin/pg_dump -Fc -v = -p 5432 -f <dump file = location> <database name>

nohup /opt/PostgreSQL/9.0/bin/pg_dump -Fc -v -p = 5432 -f /tmp/demo.dmp demo>> /tmp/dump.log 2>> /tmp/dump.log = &

-P =3D> port number of old = cluster

-Fc =3D> compressed format

-v =3D> verbose output

-f =3D> location of dump file to store and dump file = name

NOTE: = Assuming old cluster running on the 5432 port = number

Step 3: = Restore the global dump on new cluster of = PostgreSQL 9.0.2

/opt/PostgreSQL/9.0/bin/psql -d postgres -U = postgres -p 5433 -f /tmp/globaldump_oldpg832.sql

NOTE: = Assuming new cluster running on the 5433 port = number

Step 4: = Restore the compressed dump file using new = version of pg_restore binary with parallel = restore operation.

nohup /opt/PostgreSQL/9.0/bin/pg_restore -Fc -v = -p 5433 -d demo -j 8 /tmp/demo.dmp >>/tmp/restore1.log = 2>>/tmp/restore1.log &

NOTE: = Assuming new cluster running on the 5433 port = number

--Raghu Ram

 

 

 

 

when i query it was not found.

 

What could be the reason? What should i do to resolve this? =

 

Appreciate your quick answer.

 

Thanks & Regards

Senthil

 

 

------=_NextPart_000_41D4_01CBF0B2.0173C3C0--