2013-07-23 8 views
0

Postgres 백업에 대한 도움이 필요합니다. Windows 7 x32에서 pgAdmin III 1.16.1의 데이터베이스 백업을 복원하려고합니다. 원래 데이터베이스는 하나의 서버 (w7)에 있고 다른 하나는 Ububtu 서버에 있습니다. 사용할 수있는 모든 조합을 시도해 보았습니다. 그래픽 인터페 이스를 사용하는 대신 서버 및 Windows의 명령 줄에서 백업 및 복원을 시도했습니다.PgAdminIII의 pg_restore 관련 문제

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

당신은 public 스키마없이 데이터를 덤프해야 할 것이 없습니다 --exclude-schema 스위치 (또는 바로 가기는 -N)로 수행 할 수 있습니다.

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

좋은 답변은 소문자 -n 만 사용한다는 점입니다. – thatdankent

+0

'-n'은 반대의 효과를 가지며, 지정된 스키마를 포함하지만 익스포트 확장을 생략해야합니다. 그래서, 맞습니다. 그 문제를 해결할 수있는 또 다른 방법입니다 (또한 데이터를 저장하기 위해 어떤 스키마를 사용하는지에 따라 다름). – Tombart