0

我需要一些有关 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;
4

1 回答 1

1

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

pg_dump -U my_user -d my_database -N public -F c backup.dump
于 2013-08-31T08:19:17.623 回答