pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedA problem
6+ messages / 5 participants
[nested] [flat]
* A problem
@ 2003-06-27 14:43 Sam Barnett-Cormack <s.barnett-cormack@lancaster.ac.uk>
0 siblings, 1 reply; 6+ messages in thread
From: Sam Barnett-Cormack @ 2003-06-27 14:43 UTC (permalink / raw)
To: pgsql-admin
I have a problem partly caused by stupidity, which I desperately need to
fix if at all possible. Me and a colleague have tried fixing it and
may've made it worse...
I have a reasonably big db (21GB on disk, fully vaccuumed). I upgraded
from 7.3.2 to 7.3.3, forgetting to shut it down cleanly first. It then
got killed, for reasons best forgotten, with signal 15 to th main
postmaster.
On attempting to restart it, an error with the initscript, which came in
teh source RPM, led to it partially stomping some bits of the DB,
including pg_control in global. I have the old xlogs, clogs, everything.
I removed the 'new' data subdirectory. The init script was pointed at
/db/data when it should've been just /db, I still have the old
/data/base dir, all that has been altered in there (recent mtime) is
base/1175459/pg_internal.init
Attemtping to use the pg_resetxlog command (having backed up pg_control
and all the xlogs), we managed to start the server again - however, on
connecting to it with psql, it still had the right DB in teh cluster
('stats') but it claimed this db was completely empty.
I have kept everything I've tried reversible as far as my and my
colleagues knowledge allowed.
I hope someone can suggest something - I'm desperate! It'll take weeks
to re-input that data automatically.
Thanks
--
Sam Barnett-Cormack
Software Developer | Student of Physics & Maths
UK Mirror Service (http://www.mirror.ac.uk) | Lancaster University
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: A problem
@ 2003-06-27 15:37 Tom Lane <tgl@sss.pgh.pa.us>
parent: Sam Barnett-Cormack <s.barnett-cormack@lancaster.ac.uk>
0 siblings, 1 reply; 6+ messages in thread
From: Tom Lane @ 2003-06-27 15:37 UTC (permalink / raw)
To: Sam Barnett-Cormack <s.barnett-cormack@lancaster.ac.uk>; +Cc: pgsql-admin
Sam Barnett-Cormack <s.barnett-cormack@lancaster.ac.uk> writes:
> [ accidentally clobbered pg_control ]
It sounds like the main problem is too small a value in the XID
(transaction ID) counter, so that all your data tuples appear to be in
the future. pg_resetxlog has an option to force an initial XID but
you need to use it. You can guess a suitable XID by looking at the
names of the old clog files --- you want something that will be past
the end of the newest clog file, keeping in mind that there are 1M
(1024^2) XIDs per clog file and that the clog file names are in hex.
(I am not sure, but you might also need to provide a zero-filled clog
file spanning the point you start XID at.)
You will also need to be sure that the WAL file position
is greater than the end of the old WAL --- again, look at the existing
WAL files to see the largest number, and pick something bigger.
BTW, make real sure that pg_control is set up with the same locale
values as you were using before, or you'll be in a world of hurt
with corrupt indexes. Use pg_controldata to look at what you have put
into pg_control. (If you're not sure what was there before, get an
old copy of pg_control off your last backup tape ... you do have a
filesystem backup someplace, I trust ...)
> I still have the old
> /data/base dir, all that has been altered in there (recent mtime) is
> base/1175459/pg_internal.init
You can and probably should blow away pg_internal.init --- it's just a
cache file and can be rebuilt. I'd not trust it at this point.
regards, tom lane
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: A problem
@ 2003-06-27 15:49 Sam Barnett-Cormack <s.barnett-cormack@lancaster.ac.uk>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 6+ messages in thread
From: Sam Barnett-Cormack @ 2003-06-27 15:49 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Sam Barnett-Cormack <s.barnett-cormack@lancaster.ac.uk>; pgsql-admin
Late as it is, I'll try this monday. I hope it works, other suggestions
still welcome of course, thanks very much.
On Fri, 27 Jun 2003, Tom Lane wrote:
> Sam Barnett-Cormack <s.barnett-cormack@lancaster.ac.uk> writes:
> > [ accidentally clobbered pg_control ]
>
> It sounds like the main problem is too small a value in the XID
> (transaction ID) counter, so that all your data tuples appear to be in
> the future. pg_resetxlog has an option to force an initial XID but
> you need to use it. You can guess a suitable XID by looking at the
> names of the old clog files --- you want something that will be past
> the end of the newest clog file, keeping in mind that there are 1M
> (1024^2) XIDs per clog file and that the clog file names are in hex.
> (I am not sure, but you might also need to provide a zero-filled clog
> file spanning the point you start XID at.)
>
> You will also need to be sure that the WAL file position
> is greater than the end of the old WAL --- again, look at the existing
> WAL files to see the largest number, and pick something bigger.
>
> BTW, make real sure that pg_control is set up with the same locale
> values as you were using before, or you'll be in a world of hurt
> with corrupt indexes. Use pg_controldata to look at what you have put
> into pg_control. (If you're not sure what was there before, get an
> old copy of pg_control off your last backup tape ... you do have a
> filesystem backup someplace, I trust ...)
>
> > I still have the old
> > /data/base dir, all that has been altered in there (recent mtime) is
> > base/1175459/pg_internal.init
>
> You can and probably should blow away pg_internal.init --- it's just a
> cache file and can be rebuilt. I'd not trust it at this point.
>
> regards, tom lane
>
--
Sam Barnett-Cormack
Software Developer | Student of Physics & Maths
UK Mirror Service (http://www.mirror.ac.uk) | Lancaster University
^ permalink raw reply [nested|flat] 6+ messages in thread
* a problem
@ 2003-08-22 09:01 sharvari N <sharvari_n@yahoo.com>
0 siblings, 2 replies; 6+ messages in thread
From: sharvari N @ 2003-08-22 09:01 UTC (permalink / raw)
To: pgsql-admin; pgsql-general@postgresql.org
hello
How do i change the definition of a column? one of the columns width is not sufficient to store the data. I want to change the width. how to do that in postgres? I tried doing alter table + change/modify. both of them doesn't work in postgres.
and what is the maximum size to which a postgres database can grow? I have huge data to store.
regards
sharvari
---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: a problem
@ 2003-08-25 13:10 Robert Treat <xzilla@users.sourceforge.net>
parent: sharvari N <sharvari_n@yahoo.com>
1 sibling, 0 replies; 6+ messages in thread
From: Robert Treat @ 2003-08-25 13:10 UTC (permalink / raw)
To: sharvari N <sharvari_n@yahoo.com>; +Cc: pgsql-admin@postgresql.org, "pgsql-general@postgresql.org" <pgsql-general@postgresql.org>
On Fri, 2003-08-22 at 05:01, sharvari N wrote:
> hello
> How do i change the definition of a column? one of the columns width is
> not sufficient to store the data. I want to change the width. how to do
> that in postgres? I tried doing alter table + change/modify. both of
> them doesn't work in postgres.
you have to hack the system tables for this, though i can't seem to
recall the exact field name this morning. the query is certainly in the
archives as i've answered this one before, if you were too lazy to look
it up i guess i will be too ;-)
> and what is the maximum size to which a postgres database can grow? I
> have huge data to store.
real big, most likely limited by your OS. i think the largest reported
is like 4TB
Robert Treat
--
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [GENERAL] a problem
@ 2003-08-27 14:29 Franco Bruno Borghesi <franco@akyasociados.com.ar>
parent: sharvari N <sharvari_n@yahoo.com>
1 sibling, 0 replies; 6+ messages in thread
From: Franco Bruno Borghesi @ 2003-08-27 14:29 UTC (permalink / raw)
To: sharvari N <sharvari_n@yahoo.com>; +Cc: pgsql-admin; pgsql-general@postgresql.org
if your table is named foo and the field you want to chage is bar, then:
BEGIN;
ALTER TABLE foo RENAME bar TO bar_old;
ALTER TABLE foo ADD bar VARCHAR(<new_size>);
UPDATE foo SET bar=bar_old;
*if everything went ok then*
ALTER TABLE foo DROP bar_old;
COMMIT;
same goes for CHAR data type.
about limitations:
http://www.postgresql.org/users-lounge/limitations.html
On Fri, 2003-08-22 at 06:01, sharvari N wrote:
> hello
> How do i change the definition of a column? one of the columns width
> is not sufficient to store the data. I want to change the width. how
> to do that in postgres? I tried doing alter table + change/modify.
> both of them doesn't work in postgres.
> and what is the maximum size to which a postgres database can grow?
> I have huge data to store.
> regards
> sharvari
>
>
> ______________________________________________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
Attachments:
signature.asc (application/pgp-signature, 186B) download
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2003-08-27 14:29 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-06-27 14:43 A problem Sam Barnett-Cormack <s.barnett-cormack@lancaster.ac.uk>
2003-06-27 15:37 ` Tom Lane <tgl@sss.pgh.pa.us>
2003-06-27 15:49 ` Sam Barnett-Cormack <s.barnett-cormack@lancaster.ac.uk>
2003-08-22 09:01 a problem sharvari N <sharvari_n@yahoo.com>
2003-08-25 13:10 ` Re: a problem Robert Treat <xzilla@users.sourceforge.net>
2003-08-27 14:29 ` Re: [GENERAL] a problem Franco Bruno Borghesi <franco@akyasociados.com.ar>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox