2016-05-06 32 views
0

heroku DBでバックアップDBを復元できませんが、ローカルenvでリストアしてもエラーは発生しません。 エラー:コマンド:SELECT pg_catalog.setval

私はこの次のエラーを取得するデータベースに接続するHerokuの上で復元しようと

は:

C:\Program Files\PostgreSQL\9.4\bin\pg_restore.exe --host XXXXXX.compute-1.amazonaws.com --port 5432 --username "XXXXokwpyzewicl" --dbname "d9uto7paqXXX" --no-password --verbose

"C:\Users\XXXX\Desktop\loans.backup"

pg_restore: connecting to database for restore pg_restore: implied data-only restore

pg_restore: processing data for table "application_denial_reason_types"

pg_restore: [archiver (db)] Error while PROCESSING TOC:

pg_restore: [archiver (db)] Error from TOC entry 5202; 0 16622 TABLE DATA application_denial_reason_types postgres

pg_restore: [archiver (db)] could not execute query: ERROR: relation "application_denial_reason_types" does not exist Command was: COPY application_denial_reason_types (denial_reason_type_id, denial_reason_type_name, description, active, created_by, creat... pg_restore: executing SEQUENCE SET application_denial_reason_types_denial_reason_type_id_seq

pg_restore: [archiver (db)] Error from TOC entry 5672; 0 0 SEQUENCE SET application_denial_reason_types_denial_reason_type_id_seq postgres

pg_restore: [archiver (db)] could not execute query: ERROR: relation "application_denial_reason_types_denial_reason_type_id_seq" does not exist LINE 1: SELECT pg_catalog.setval('application_denial_reason_types_de... ^ Command was: SELECT pg_catalog.setval('application_denial_reason_types_denial_reason_type_id_seq', 1, false);

は、どのように私はこのエラーを修正しますか?それは、あなたが見つけるman pg_restoreチェックすると

pg_restore: connecting to database for restore pg_restore: implied data-only restore

pg_restore: [archiver (db)] could not execute query: ERROR: relation "application_denial_reason_types_denial_reason_type_id_seq" does not exist

は理由がでalookを取る理解するために:

答えて

0

は、それが存在しないシーケンスの値を設定しようと

-a 
    --data-only 
     Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if 

present in the archive.

あなたはおそらくあなたのローカルenvでデータ構造を持っているでしょう。これがv既存の配列に対しても同様です。そして、英雄の構造がないので、あなたはエラーになります。

データを復元する前にpg_restoreコマンドから-aを削除してDDLを実行してください。