PgAdminIII中pg_restore的问题

时间:2013-07-23 14:59:36

标签: pgadmin pg-dump pg-restore

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

theese是执行的命令和错误。结果是数据库被恢复,但只有一部分。

请帮助我!

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

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;

1 个答案:

答案 0 :(得分:1)

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

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