FW: More than 1 pg_database Entry for Database - Thread #2

--_000_68B59BEDCD36854AADBDF17E91B2937AB89DE7F7EXCHMAILstaff in_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi,

Does anyone have any ideas how I can keep from getting into this duplicate =
database scenario? Any advice would be greatly appreciated.

Thanks,

Sam

________________________________
From: pgsql-admin-owner [at] postgresql.org [mailto:pgsql-admin-owner [at] postgresql=
..org] On Behalf Of Samuel Stearns
Sent: Wednesday, 14 April 2010 10:11 AM
To: pgsql-admin [at] postgresql.org
Subject: [ADMIN] More than 1 pg_database Entry for Database - Thread #2

Howdy,

I am running version 8.3.3 and encountered a problem with my pg_dump failin=
g a couple weeks back with the following error:

pg_dump: query returned more than one (2) pg_database entry for database "s=
qlsnbs"
pg_dumpall: pg_dump failed on database "sqlsnbs", exiting

I followed your thread here:

http://www.mail-archive.com/pgsql-admin [at] postgresql.org/msg25 978.html

in an attempt to resolve the problem and in the end, just like was stated i=
n the above thread, I ended up dumping the old Postgres environment into a =
new initialized one to resolve the problem.

I did not capture the queries I was running at the time of diagnosing but I=
can summarize. I ran the following query:

select xmin, cmin, xmax, cmax, oid, ctid, datname from pg_database;

which returned the same oid and different xmax for each row of the duplicat=
e database. One xmax was 0 and the other was 3.7 billion. In your thread =
above it was stated by Tom Lane that the large xmax number may indicate a p=
roblem with xid wraparound and that the problem row was never vacuumed away=
due to broken vacuuming procedures. We were running with auto-vacuum turn=
ed on and I verified that it was working by querying pg_stat_all_tables.

I was wondering if you could please answer the following for me to help mit=
igate this in the future:

1. Should I be running a scheduled vacuum analyze in addition to the auto-=
vacuum?
2. Should I be running a scheduled vacuum full?
3. Does 8.4 address this problem?

Thank you,

Sam

--_000_68B59BEDCD36854AADBDF17E91B2937AB89DE7F7EXCHMAILstaff in_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:st1=3D"urn:schemas-microsoft-com:office:smarttags" xmlns=3D"http://ww=
w.w3.org/TR/REC-html40">

<head>
<meta http-equiv=3DContent-Type content=3D"text/html; charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
..shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags" name=3D"Street=
"/>
<o:SmartTagType namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags"
name=3D"address"/>
<o:SmartTagType namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags"
name=3D"PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
[at] font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal;
font-family:Arial;
color:windowtext;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:Arial;
color:navy;}
[at] page Section1
{size:595.3pt 841.9pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>

<body lang=3DEN-AU link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span style=
=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Hi,<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span style=
=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span style=
=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Does anyone have any ideas how I can k=
eep
from getting into this duplicate database scenario?  Any advice would =
be
greatly appreciated.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span style=
=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span style=
=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Thanks,<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span style=
=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span style=
=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Sam<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span style=
=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>

<div>

<div class=3DMsoNormal align=3Dcenter style=3D'text-align:center'><font siz=
e=3D3
face=3D"Times New Roman"><span lang=3DEN-US style=3D'font-size:12.0pt'>

<hr size=3D2 width=3D"100%" align=3Dcenter tabindex=3D-1>

</span></font></div>

<p class=3DMsoNormal><b><font size=3D2 face=3DTahoma><span lang=3DEN-US
style=3D'font-size:10.0pt;font-family:Tahoma;font-weight:bol d'>From:</span>=
</font></b><font
size=3D2 face=3DTahoma><span lang=3DEN-US style=3D'font-size:10.0pt;font-fa=
mily:Tahoma'>
pgsql-admin-owner [at] postgresql.org [mailto:pgsql-admin-owner [at] postgresql.org] =
<b><span
style=3D'font-weight:bold'>On Behalf Of </span></b>Samuel Stearns<br>
<b><span style=3D'font-weight:bold'>Sent:</span></b> Wednesday, 14 April 20=
10
10:11 AM<br>
<b><span style=3D'font-weight:bold'>To:</span></b> <st1:PersonName w:st=3D"=
on">pgsql-admin [at] postgresql.org</st1:PersonName><br>
<b><span style=3D'font-weight:bold'>Subject:</span></b> [ADMIN] More than 1
pg_database Entry for Database - Thread #2</span></font><span lang=3DEN-US>=
<o:p></o:p></span></p>

</div>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span style=3D=
'font-size:
12.0pt'><o:p> </o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1=
0.0pt;
font-family:Arial'>Howdy,<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1=
0.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1=
0.0pt;
font-family:Arial'>I am running version 8.3.3 and encountered a problem wit=
h my
pg_dump failing a couple weeks back with the following error:<o:p></o:p></s=
pan></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1=
0.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>

<p class=3DMsoNormal style=3D'text-autospace:none'><font size=3D2 face=3D"C=
ourier New"><span
style=3D'font-size:10.0pt;font-family:"Courier New"'>pg_dump: query returne=
d more
than one (2) pg_database entry for database "sqlsnbs"<o:p></o:p><=
/span></font></p>

<p class=3DMsoNormal style=3D'text-autospace:none'><font size=3D2 face=3D"C=
ourier New"><span
style=3D'font-size:10.0pt;font-family:"Courier New"'>pg_dumpall: pg_dump fa=
iled
on database "sqlsnbs", exiting<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1=
0.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1=
0.0pt;
font-family:Arial'>I followed your thread here:<o:p></o:p></span></font></p=
>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1=
0.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1=
0.0pt;
font-family:Arial'><a
href=3D"http://www.mail-archive.com/pgsql-admin [at] postgresql.o rg/msg25978.htm=
l">http://www.mail-archive.com/pgsql-admin [at] postgresql.org/ms g25978.html</a>=
<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1=
0.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1=
0.0pt;
font-family:Arial'>in an attempt to resolve the problem and in the end, jus=
t
like was stated in the above thread, I ended up dumping the old Postgres
environment into a new initialized one to resolve the problem.<o:p></o:p></=
span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1=
0.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1=
0.0pt;
font-family:Arial'>I did not capture the queries I was running at the time =
of
diagnosing but I can summarize.  I ran the following query:<o:p></o:p>=
</span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1=
0.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1=
0.0pt;
font-family:Arial'>select xmin, cmin, xmax, cmax, oid, ctid, datname from
pg_database;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1=
0.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1=
0.0pt;
font-family:Arial'>which returned the same oid and different xmax for each =
row
of the duplicate database.  One xmax was 0 and the other was 3.7
billion.  In your thread above it was stated by <st1:Street w:st=3D"on=
"><st1:address
w:st=3D"on">Tom Lane</st1:address></st1:Street> that the large xmax number=
may
indicate a problem with xid wraparound and that the problem row was never
vacuumed away due to broken vacuuming procedures.  We were running wit=
h
auto-vacuum turned on and I verified that it was working by querying
pg_stat_all_tables.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1=
0.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1=
0.0pt;
font-family:Arial'>I was wondering if you could please answer the following=
for
me to help mitigate this in the future:<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1=
0.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1=
0.0pt;
font-family:Arial'>1.  Should I be running a scheduled vacuum analyze =
in
addition to the auto-vacuum?<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1=
0.0pt;
font-family:Arial'>2.  Should I be running a scheduled vacuum full?<o:=
p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1=
0.0pt;
font-family:Arial'>3.  Does 8.4 address this problem?<o:p></o:p></span=
></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1=
0.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1=
0.0pt;
font-family:Arial'>Thank you,<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1=
0.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1=
0.0pt;
font-family:Arial'>Sam<o:p></o:p></span></font></p>

</div>

</body>

</html>

--_000_68B59BEDCD36854AADBDF17E91B2937AB89DE7F7EXCHMAILstaff in_--
Samuel Stearns [ Fr, 16 April 2010 03:33 ] [ ID #2039126 ]

Re: FW: More than 1 pg_database Entry for Database -

Samuel Stearns <SStearns [at] internode.com.au> wrote:

> I am running version 8.3.3 and encountered a problem

> Does anyone have any ideas how I can keep from getting into this
> duplicate database scenario? Any advice would be greatly
> appreciated.

> it was stated by Tom Lane that the large xmax number may indicate
> a problem with xid wraparound and that the problem row was never
> vacuumed away due to broken vacuuming procedures.

Applying the last 22 months of bug fixes would be a good start.

http://www.postgresql.org/support/versioning

http://www.postgresql.org/docs/8.3/static/release.html

http://www.postgresql.org/download/

Autovacuum is supposed to protect you from wraparound, so it appears
to have fallen down somehow. There were fixes for autovacuum bugs
in 8.3.4 and 8.3.6, so it's entirely possible that just moving to
8.3.somethingrecent will prevent a recurrence.

-Kevin

--
Sent via pgsql-admin mailing list (pgsql-admin [at] postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
Kevin Grittner [ Fr, 16 April 2010 18:05 ] [ ID #2039138 ]

Re: FW: More than 1 pg_database Entry for Database -

Thanks very much for the advice, Kevin. I'll be raising a request with our=
sysadmins to upgrade to 8.3.10.

Sam

-----Original Message-----
From: Kevin Grittner [mailto:Kevin.Grittner [at] wicourts.gov]
Sent: Saturday, 17 April 2010 1:36 AM
To: Samuel Stearns
Cc: pgsql-admin [at] postgresql.org
Subject: Re: [ADMIN] FW: More than 1 pg_database Entry for Database - Threa=
d #2

Samuel Stearns <SStearns [at] internode.com.au> wrote:

> I am running version 8.3.3 and encountered a problem

> Does anyone have any ideas how I can keep from getting into this
> duplicate database scenario? Any advice would be greatly
> appreciated.

> it was stated by Tom Lane that the large xmax number may indicate
> a problem with xid wraparound and that the problem row was never
> vacuumed away due to broken vacuuming procedures.

Applying the last 22 months of bug fixes would be a good start.

http://www.postgresql.org/support/versioning

http://www.postgresql.org/docs/8.3/static/release.html

http://www.postgresql.org/download/

Autovacuum is supposed to protect you from wraparound, so it appears
to have fallen down somehow. There were fixes for autovacuum bugs
in 8.3.4 and 8.3.6, so it's entirely possible that just moving to
8.3.somethingrecent will prevent a recurrence.

-Kevin

--
Sent via pgsql-admin mailing list (pgsql-admin [at] postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
Samuel Stearns [ So, 18 April 2010 05:21 ] [ ID #2039280 ]
Datenbanken » gmane.comp.db.postgresql.admin » FW: More than 1 pg_database Entry for Database - Thread #2

Vorheriges Thema: Setting Auto Vacuum from PGAdmin
Nächstes Thema: pg_restore error