我尝试从Heroku的备份还原数据库,但失败了。
我是用他们的指示:
heroku pg:备份:还原b101数据库URL --应用程序示例-应用程序
但得到如下错误:
Restoring... !
An error occurred and the backup did not finish.
pg_restore: creating FK CONSTRAINT "public.user_disciplines_usertoken_tokens usertoken_id_refs_id_a11f5e9d"
pg_restore: warning: errors ignored on restore: 16
pg_restore finished with errors
waiting for download to complete
download finished successfully
Run heroku pg:backups:info r2192 for more details.
当我运行建议的命令时,我得到以下内容:
2022-08-31 15:09:55 +0000 pg_restore: connecting to database for restore
2022-08-31 15:09:55 +0000 pg_restore: creating EXTENSION "hstore"
2022-08-31 15:09:55 +0000 pg_restore: while PROCESSING TOC:
2022-08-31 15:09:55 +0000 pg_restore: from TOC entry 2; 3079 95267 EXTENSION hstore (no owner)
2022-08-31 15:09:55 +0000 pg_restore: error: could not execute query: ERROR: Extensions can only be created on heroku_ext schema
2022-08-31 15:09:55 +0000 CONTEXT: PL/pgSQL function inline_code_block line 7 at RAISE
2022-08-31 15:09:55 +0000 Command was: CREATE EXTENSION IF NOT EXISTS "hstore" WITH SCHEMA "public";
2022-08-31 15:09:55 +0000
2022-08-31 15:09:55 +0000
2022-08-31 15:09:55 +0000 pg_restore: creating COMMENT "EXTENSION "hstore""
2022-08-31 15:09:55 +0000 pg_restore: from TOC entry 5891; 0 0 COMMENT EXTENSION "hstore"
2022-08-31 15:09:55 +0000 pg_restore: error: could not execute query: ERROR: extension "hstore" does not exist
2022-08-31 15:09:55 +0000 Command was: COMMENT ON EXTENSION "hstore" IS 'data type for storing sets of (key, value) pairs';
2022-08-31 15:09:55 +0000
2022-08-31 15:09:55 +0000
2022-08-31 15:09:55 +0000 pg_restore: creating EXTENSION "pg_stat_statements"
2022-08-31 15:09:55 +0000 pg_restore: from TOC entry 3; 3079 95394 EXTENSION pg_stat_statements (no owner)
2022-08-31 15:09:55 +0000 pg_restore: error: could not execute query: ERROR: Extensions can only be created on heroku_ext schema
2022-08-31 15:09:55 +0000 CONTEXT: PL/pgSQL function inline_code_block line 6 at RAISE
2022-08-31 15:09:55 +0000 Command was: CREATE EXTENSION IF NOT EXISTS "pg_stat_statements" WITH SCHEMA "public";
2022-08-31 15:09:55 +0000
2022-08-31 15:09:55 +0000
2022-08-31 15:09:55 +0000 pg_restore: creating COMMENT "EXTENSION "pg_stat_statements""
2022-08-31 15:09:55 +0000 pg_restore: from TOC entry 5892; 0 0 COMMENT EXTENSION "pg_stat_statements"
2022-08-31 15:09:55 +0000 pg_restore: error: could not execute query: ERROR: extension "pg_stat_statements" does not exist
2022-08-31 15:09:55 +0000 Command was: COMMENT ON EXTENSION "pg_stat_statements" IS 'track planning and execution statistics of all SQL statements executed';
因此,看起来问题是与hstore扩展和最近Heroku做了一些更改:https://devcenter.heroku.com/changelog-items/2446
我联系了Heroku支持,但还没有得到回复。也许有人有办法处理这个问题?
1条答案
按热度按时间lrl1mhuk1#
以下解决方案有效:
恢复包括安装在公共位置的扩展的备份
例如:
更多详细信息,请访问:https://help.heroku.com/ZOFBHJCJ/heroku-postgres-extension-changes-faq