Occasionally, I get the following error while doing a simple pg_dump (
pg_dump -U postgres -Fc -f mybackup.dmp mydb
):
pg_dump: [archiver (db)] query failed: ERROR: could not open relation with OID 11072443
pg_dump: [archiver (db)] query was: SELECT pg_catalog.pg_get_viewdef('11072443'::pg_catalog.oid) AS viewdef
The dump is then aborted.
I'm using PostgreSQL and pg_dump 9.2.2 for Windows.
Solutions welcome.
-
The latest 9.2 is 9.2.9. Could you reproduce it with it?Milen A. Radev– Milen A. Radev2014年10月20日 21:26:39 +00:00Commented Oct 20, 2014 at 21:26
-
The fact that it is occasional is interesting. Any antivirus software on the computer? That's a common culprit.Craig Ringer– Craig Ringer2014年10月20日 21:31:29 +00:00Commented Oct 20, 2014 at 21:31
-
Is it the same OID each time you get the error? If so, I'm betting on database corruption. Can you convert that OID to a table name (SELECT 11072443::regclass), and COPY that table manually to a file?Josh Kupershmidt– Josh Kupershmidt2014年10月21日 12:47:00 +00:00Commented Oct 21, 2014 at 12:47
1 Answer 1
Thanks guys for the suggestions, I think I found the problem.
Each night, several bash scripts drop and recreate some tables, which each time get a new OID. This would explain why a different OID was appearing in each successive error message, as suggested by Josh.
I believe that on some occasions, pg_dump started while some of these tables were still being dropped/recreated, hence the error message.