次のように OpenERP DB をダンプしました。
pg_dump -Fc -xO -f o7db.dump o7db
ソース マシンには次のものがあります。
$ pg_dump --version
pg_dump (PostgreSQL) 9.3.5
ターゲット マシン (OpenVZ コンテナー)へscp
のダンプ。ここで、pg_restore は次のとおりです。
$ pg_restore --version
pg_restore (PostgreSQL) 9.3.5
次のように pg_restore を実行します。
pg_restore -d o7db -xO -j3 o7db.dump
私が見ることができる唯一の違いは、両方のマシンで postgres ユーザーが同じではないことです (ただし、それは によって処理されるはずです-O
)。pg_restore は次のことについて不平を言います:
pg_restore: [archiver (db)] Error from TOC entry 8561; 0 1161831 TABLE DATA account_move_line manu
pg_restore: [archiver (db)] COPY failed for table "account_move_line": ERROR: value too long for type character varying(64)
CONTEXT: COPY account_move_line, line 172, column name: "<MASKED DATA HERE....>"
このエラーは、いくつかのテーブルに対して数回発行されます。その後、タプルの欠落に関する非常に多くのエラーが続きます。
pg_restore: [archiver (db)] Error from TOC entry 6784; 2606 1182924 FK CONSTRAINT account_account_currency_id_fkey manu
pg_restore: [archiver (db)] could not execute query: ERROR: insert or update on table "account_account" violates foreign key constraint "account_account_currency_id_fkey"
DETAIL: Key (currency_id)=(1) is not present in table "res_currency".
Command was: ALTER TABLE ONLY account_account
ADD CONSTRAINT account_account_currency_id_fkey FOREIGN KEY (currency_id) REFERENCES re..
ソースDBは問題ないように見えるので、これがどのように可能かわかりません。
復元された DB には多くの空のテーブルがあります (それぞれが失敗すると、値が長すぎます)。
$ psql -d o7db -Ac "select * from account_move_line" | tail -1
(0 rows)
さらに、同じソース マシンで pg_restore を実行します。
pg_restore -d o7db_restore -xO -j3 o7db.dump
すべてが期待どおりに機能します。単一の警告ではありません。
私は何をすべきか?私は何を間違っていますか?