我需要一些关于Postgres备份的帮助。我正在尝试从Windows 7 x32的pgAdmin III 1.16.1恢复数据库备份。原始数据库在一个服务器(也是w7)中,另一个在Ububtu服务器上。我已经尝试了所有可用的选项组合,我甚至尝试从服务器的命令行和窗口进行备份和恢复,而不是使用图形界面。
这些是执行的命令和错误。结果是数据库被恢复了,但只恢复了一部分。
请帮帮我!
我只复制了日志的一部分,因为太长了。。。。但没有错误接缝成为"唯一"
C:Program FilespgAdmin III1.10pg_dump.exe --host 00.00.0.000
--port 0000 --username "username" --role "role" --no-password
--format tar --blobs --encoding UTF8 --verbose --file
"C:UsersxxxxxDocumentsBackUpPostgresbackU.backup" "DATABASE"
C:Program FilespgAdmin III1.10pg_restore.exe --host 111.111.11.111
--port 0000 --username "username" --dbname "database"
--role "role" --no-password --verbose
"C:UsersxxxxxDocumentsBackUpPostgresbackU.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;
您应该在没有public
模式的情况下转储数据,这可以通过--exclude-schema
开关(或快捷方式为-N
)来完成。
pg_dump -U my_user -d my_database -N public -F c backup.dump