I'm trying to restore a dump (-Fd –data-only) from PostgreSQL v9.4.9, but I've come across the following error:
pg_restore: [archiver] could not find entry for ID 12
Exactly the same happens if pg_dump is invoked using -Fc instead of -Fd.
As per this link, this seems to be a known issue, but I'm not sure of the workaround I should apply to move over it.
Could this actually be overcome in this PostgreSQL version? If so, what should I alter to achieve it?
Best Answer
You need to identify in which table its throwing this error.
Anyhow Try this workaround.
Take schema dump alone.
pg_dump -O -s dbname > schema.sql
Restore it on the target.
psql -h host -U user -d < schema.sql
On target disable trigger on all the tables.
ALTER TABLE table_name Disable TRIGGER ALL;
Use this query to generate this statement for all the tables.
pg_dump -U user dbname -Fc --data-only > dbname.dump
pg_restore -h host -U user dbname < dbname.dump
To make the restore fast, use -j
pg_restore -h host -U user -j 10 dbname < dbname.dump