On 12/23/2015 04:17 PM, Paul Jones wrote:
I have been having disk errors that have corrupted something in
my postgres database. Other databases work ok:
Running on Ubuntu 10.04.
paul@kitanglad:~$ psql -U postgres
psql (9.4.5)
Type "help" for help.
postgres=# SELECT pg_catalog.pg_is_in_recovery();
ERROR: could not read block 3 in file "base/12511/12270": read only 4096 of 8192 bytes
postgres=# \c pjtest
You are now connected to database "pjtest" as user "postgres".
pjtest=# SELECT pg_catalog.pg_is_in_recovery();
pg_is_in_recovery
-------------------
f
(1 row)
Since this is the "postgres" database, dropping and re-creating it
doesn't seem possible. pg_dump also gets the same error when I run
it on "postgres" so pg_basebackup will probably get the same error.
The only thing I can think of is to create a completely new data directory
with initdb and pg_dump/restore all the databases in the cluter to the
new data directory.
Is this my only option?
No, the 'postgres' database is one of the system databases created from
a template
First make sure you have backups of the databases that are not corrupted.
Second have you done any modifications to the 'postgres' database?
If not, then from here:
http://www.postgresql.org/docs/9.4/static/manage-ag-templatedbs.html
"
Note: template1 and template0 do not have any special status beyond
the fact that the name template1 is the default source database name for
CREATE DATABASE. For example, one could drop template1 and recreate it
from template0 without any ill effects. This course of action might be
advisable if one has carelessly added a bunch of junk in template1. (To
delete template1, it must have pg_database.datistemplate = false.)
The postgres database is also created when a database cluster is
initialized. This database is meant as a default database for users and
applications to connect to. It is simply a copy of template1 and can be
dropped and recreated if necessary.
"
Have you corrected the disk error situation?
If not, then make plans to create a new cluster somewhere else..
PJ
--
Adrian Klaver
adrian.klaver@xxxxxxxxxxx
--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general