[HACKERS] ERROR: "Database 'products', OID nnn, has disappeared from pg_database"
Currently, we have been having a problem with some kind of corruption of
the pg_database file. We are using the database on a limited number of
writes storage medium. (Compact Flash Card) So that we don't always
write to the flash, and because we don't care about some of the data, part
of the database is kept in RAM on a ram file system. We have two
databases on disk. One database called config, the other the standard
template1. These are kept in /var/lib/pgsql_base_slave. We have a
properly init'ed database in /var/lib/pgsql/. When postgresql starts up
via the init scripts, we create a RAM file system on /var/lib/pgsql/base/,
and then we create symlinks to the config and template1 databases.The next set of steps is where we sometimes run into trouble. At
this point in the init script, we start up the postmaster. Next we do a
createdb products, where products is the actual name of the database.
This works fine. Next, we attempt to access the database using psql to
create a set of tables. This is where sometimes we run into a problem.
Normally, this works fine, but sometimes we get the error"Database 'products', OID nnn, has disappeared from pg_database"
where nnn is some number, and forever afterwards we can't access a
database with that name. Removing and recreating the database doesn't
help. Neither does vacuuming it. If we delete the whole pgsql directory,
and recreate it, then use initdb on it, everything is fresh and working
again, but obviously this isn't a good solution, since we have to recreate
all the databases, tables, and data.On the shutdown side, we do a deletedb to remove the products
database before we shutdown the postmaster. Once that is complete, we do
a shutdown.If you need a short list of the startup procedure that is above, here it
is in a psuedocode fashion.mount ram drive.
make symlinks to config and template1 databases
startup postmaster
createdb products
create some tables in products... normal operation ...
... shutdown process
dropdb products
shutdown postmaster.I am assuming that some kind of corruption has occured within
pg_database file, but I don't have the expertise to find where the problem
is occuring. Any help you can provide would be greatly appreciated.I am including the init script used.
<<postgresql.txt>>Sandy Barnes
Honeywell
Business & General Aviation Engineering
One Technology Center
23500 West 105th Street
Olathe, KS. 66061
tel 913.712.2027
fax 913.712.1347
email sandy.barnes@honeywell.com
begin 600 postgresql
M(R$@+V)I;B]S:`HC('!O<W1G<F5S<6P)5&AI<R!I<R!T:&4@:6YI="!S8W)I
M<'0@9F]R('-T87)T:6YG('5P('1H92!0;W-T9W)E4U%,"B,)"7-E<G9E<@H*
M(R!697)S:6]N(#8N-2XS+3(@3&%M87(@3W=E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W-T87)T?'-T;W!\<W1A='5S?')E<W1A<G1](@H)97AI="`Q"F5S
+86,*"F5X:70@,`H=
`
end
"Barnes, Sandy (Sandra)" <Sandy.Barnes@Honeywell.com> writes:
Normally, this works fine, but sometimes we get the error
"Database 'products', OID nnn, has disappeared from pg_database"
where nnn is some number, and forever afterwards we can't access a
database with that name. Removing and recreating the database doesn't
help. Neither does vacuuming it.
Try vacuuming pg_database (after connecting to template1 or the other
always-there db). 7.1 will be a little smarter about this, but the
setup you describe is still pretty risky IMHO. You have a nonvolatile
reference in pg_database to a volatile database in the RAM filesystem,
so a system crash will leave you with a dangling reference...
regards, tom lane