【问题标题】:problems with pg_restore in PgAdminIIIPgAdmin III 中的 pg_restore 问题
【发布时间】:2013-07-23 14:59:36
【问题描述】:

我需要一些有关 Postgres 备份的帮助。我正在尝试从 Windows 7 x32 的 pgAdmin III 1.16.1 恢复数据库备份。原始数据库位于一台服务器(也是 w7)中,另一台位于 Ububtu 服务器上。 我已经尝试了所有可用选项的组合,我什至尝试从服务器的命令行和 Windows 进行备份和恢复,而不是使用图形界面。

这些是执行的命令和错误。结果是数据库恢复了,但只恢复了一部分。

请帮帮我!

我只复制了日志的一部分,因为它太长了....但是没有错误接缝是“那个”

C:\Program Files\pgAdmin III\1.10\pg_dump.exe --host 00.00.0.000
--port 0000 --username "username" --role "role" --no-password  
--format tar --blobs --encoding UTF8 --verbose --file 
 "C:\Users\xxxxx\Documents\BackUpPostgres\backU.backup" "DATABASE"

C:\Program Files\pgAdmin III\1.10\pg_restore.exe --host 111.111.11.111 
 --port 0000 --username "username" --dbname "database"
 --role "role" --no-password  --verbose  
 "C:\Users\xxxxx\Documents\BackUpPostgres\backU.backup"

pg_restore: connecting to database for restore
pg_restore: creating COMMENT database
pg_restore: creating SCHEMA public
pg_restore: creating COMMENT SCHEMA public
pg_restore: creating PROCEDURAL LANGUAGE plpgsql
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 1774; 2612 16386 PROCEDURAL LANGUAGE plpgsql postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  language "plpgsql" already exists
    Command was: CREATE PROCEDURAL LANGUAGE plpgsql;
pg_restore: creating SHELL TYPE box2d
pg_restore: [archiver (db)] Error from TOC entry 1673; 0 0 SHELL TYPE box2d postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  type "box2d" already exists
    Command was: CREATE TYPE box2d;
pg_restore: creating FUNCTION st_box2d_in(cstring)
pg_restore: [archiver (db)] Error from TOC entry 936; 1255 18058 FUNCTION st_box2d_in(cstring) postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  could not access file "$libdir/postgis-1.4": No such file or directory
    Command was: CREATE FUNCTION st_box2d_in(cstring) RETURNS box2d
    LANGUAGE c IMMUTABLE STRICT
    AS '$libdir/postgis-1.4', 'BOX2DFLOAT...
pg_restore: [archiver (db)] could not execute query: ERROR:  function public.st_box2d_in(cstring) does not exist
    Command was: ALTER FUNCTION public.st_box2d_in(cstring) OWNER TO postgres;

【问题讨论】:

    标签: pgadmin pg-dump pg-restore


    【解决方案1】:

    您应该在没有public 架构的情况下转储数据,可以使用--exclude-schema 开关(或快捷方式为-N)来完成。

    pg_dump -U my_user -d my_database -N public -F c backup.dump
    

    【讨论】:

    • 很好的答案,除了它只适用于小写 -n。
    • -n 具有相反的效果,包括指定的架构但应省略导出扩展。所以,您是对的,这是解决该问题的另一种可能性(也取决于您用于存储数据的架构)。
    猜你喜欢
    • 2014-04-17
    • 2015-05-26
    • 1970-01-01
    • 1970-01-01
    • 2011-12-05
    • 1970-01-01
    • 1970-01-01
    • 2020-05-08
    • 1970-01-01
    相关资源
    最近更新 更多