トラブルシューティング¶
pem.alertテーブルが復元に失敗する¶
バックアップから pem バッキングデータベースを復元すると、 pem.alert テーブルの復元中にエラーが発生する場合があります。これは、テーブルのテーブルの前提条件が欠落しているために発生します。 pg_restore ユーティリティは、 pem.alert を復元しようとした後、 pem.alert の前提条件を復元できます。
これが発生した場合、 pg_restore からの出力には、 alert テーブルを参照するエラーメッセージが含まれます:
pg_restore: [archiver (db)] could not execute query: ERROR: insert or
update on table "alert_history" violates foreign key constraint
"alert_history_alert_id_fkey"
DETAIL: Key (alert_id)=(3) is not present in table "alert".
Command was: ALTER TABLE ONLY alert_history
ADD CONSTRAINT alert_history_alert_id_fkey FOREIGN KEY (alert_id)
REFERENCES alert(id) ON...
pg_restore: creating FK CONSTRAINT alert_status_alert_id_fkey
pg_restore: [archiver (db)] Error from TOC entry 3265; 2606 18355 FK
CONSTRAINT alert_status_alert_id_fkey postgres
pg_restore: [archiver (db)] could not execute query: ERROR: insert or
update on table "alert_status" violates foreign key constraint
"alert_status_alert_id_fkey"
DETAIL: Key (alert_id)=(1) is not present in table "alert".
Command was: ALTER TABLE ONLY alert_status
ADD CONSTRAINT alert_status_alert_id_fkey FOREIGN KEY (alert_id)
REFERENCES alert(id) ON U...
この問題が発生した場合は、 pem.alert テーブルを復元する前に pem データベースを復元してください。 pem データベースを復元すると、 pem.alert の前提条件がインストールされ、テーブルの復元が期待どおりに完了するはずです。