繁体   English   中英

恢复Postgres数据库转储

[英]Restore Postgres database dump

无法还原Postgres数据库转储

我使用了以下命令

 sudo psql my_database_name < feb9.sql
    SET
    SET
    SET
    SET
    SET
    CREATE EXTENSION
    COMMENT
    SET
    SET
    SET
    ERROR:  relation "admin_tools_dashboard_preferences" already exists
    ALTER TABLE
    ERROR:  relation "admin_tools_dashboard_preferences_id_seq" already exists
    ALTER TABLE
    ALTER SEQUENCE
    ERROR:  relation "admin_tools_menu_bookmark" already exists
    ALTER TABLE
    ERROR:  relation "admin_tools_menu_bookmark_id_seq" already exists
    ALTER TABLE
    ALTER SEQUENCE
    ERROR:  relation "auth_group" already exists
    ALTER TABLE
    ERROR:  relation "auth_group_id_seq" already exists



ERROR:  duplicate key value violates unique constraint "product_rateclass_code_uniq"
DETAIL:  Key (code)=(0) already exists.
CONTEXT:  COPY product_rateclass, line 1: "40787    0   Tariff Rates"
 setval 
--------
  40791
(1 row)
ERROR:  relation "admin_tools_menu_bookmark_user_id" already exists
ERROR:  relation "auth_group_name_like" already exists
ERROR:  relation "auth_group_permissions_group_id" already exists
ERROR:  relation "auth_group_permissions_permission_id" already exists
ERROR:  relation "auth_permission_content_type_id" already exists
ERROR:  relation "auth_user_groups_group_id" already exists
ERROR:  relation "auth_user_groups_user_id" already exists
ERROR:  relation "auth_user_user_permissions_permission_id" already exists
ERROR:  relation "auth_user_user_permissions_user_id" already exists
ERROR:  relation "auth_user_username_like" already exists
REVOKE
REVOKE
GRANT
GRANT

我收到了以上错误日志(我的此类日志运行了数百行,我使用了几行作为参考)。

执行该命令后,数据库仍包含旧记录,而不是新记录。

我删除了现有数据库并创建了新数据库。

$dropdb development_db_name
$ createdb developmnent_db_name

然后我使用还原了数据库

 sudo psql my_database_name < feb9.sql

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM