database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
ㆍPostgreSQL
Firebird
Oracle
Informix
Sybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
PostgreSQL Q&A 5904 게시물 읽기
No. 5904
데이터베이스 복원 에러가나는데요..
작성자
초짜(kmsds)
작성일
2005-02-18 14:06ⓒ
2005-02-18 14:07ⓜ
조회수
6,151

PGAdmin에서 restore를 할때 나는 에러입니다.

밑에 return 1이라고 에러가 리턴되기는 하는데,

그냥 테이블이나, 트리거등을 보면 정상적인것 같습니다.

그냥 사용해도 무관할것 같기도 한데..

그래도 return 에러가 떠서 찝찝해서 질문올려봅니다.

데이터베이스는 새로 생성한 즉시 그 데이터베이스로 복원했구요..

왜 저런 에러가 나는지 아시는분 좀 답변 주시면 감사하겠습니다.

다음은 PGAdmin에서 Restore시 에러메시지입니다.

밑에서

|

|

표시는 길어서 중간생략한겁니다^^

====================================================================================

 

C:\Program Files\PostgreSQL\8.0\pgAdmin III\pg_restore.exe -i -h localhost -p 5432 -U postgres -d hicom -v "D:\Backup\cust\cust.backup"
pg_restore: connecting to database for restore
pg_restore: creating DUMP TIMESTAMP DUMP TIMESTAMP
pg_restore: creating SCHEMA public
pg_restore: creating COMMENT SCHEMA public
pg_restore: creating FUNCTION plpgsql_call_handler()
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 17; 1255 17712 FUNCTION plpgsql_call_handler() postgres
pg_restore: [archiver (db)] could not execute query: ERROR: function "plpgsql_call_handler" already exists with same argument types
Command was: CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler
AS '$libdir/plpgsql', 'plpgsql_call_handler'
LANGUAG...
pg_restore: creating FUNCTION plpgsql_validator(oid)
pg_restore: [archiver (db)] Error from TOC entry 18; 1255 17713 FUNCTION plpgsql_validator(oid) postgres
pg_restore: [archiver (db)] could not execute query: ERROR: function "plpgsql_validator" already exists with same argument types
Command was: CREATE FUNCTION plpgsql_validator(oid) RETURNS void
AS '$libdir/plpgsql', 'plpgsql_validator'
LANGUAGE c;
pg_restore: creating PROCEDURAL LANGUAGE plpgsql
pg_restore: [archiver (db)] Error from TOC entry 344; 16402 17714 PROCEDURAL LANGUAGE plpgsql
pg_restore: [archiver (db)] could not execute query: ERROR: language "plpgsql" already exists
Command was: CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql HANDLER plpgsql_call_handler VALIDATOR plpgsql_validator;
pg_restore: creating FUNCTION func_buyitem_af_de_row()

|
|

pg_restore: creating FUNCTION func_sellitem_update()
pg_restore: creating TABLE accountmain
pg_restore: creating TABLE accountsub
pg_restore: creating SEQUENCE bscp
pg_restore: executing SEQUENCE SET bscp
pg_restore: creating TABLE busisumday

|
|

pg_restore: creating TABLE zipcode
pg_restore: restoring data for table "accountmain"

|
|

pg_restore: restoring data for table "BLOBS"
pg_restore: restored 0 large objects
pg_restore: creating CONSTRAINT accountmain_pkey

|
|

pg_restore: creating CONSTRAINT zipcode_pkey
pg_restore: creating INDEX idx_buyitem_custcode

|
|

pg_restore: creating INDEX idx_sellitem_itemcode
pg_restore: creating INDEX pbsyscatcoldict_idx

|
|

pg_restore: creating INDEX pbsyspbe_idx
pg_restore: creating TRIGGER tr_buyitem_af_de_row

|
|

pg_restore: creating TRIGGER tr_sellitem_af_up_row
pg_restore: creating FK CONSTRAINT fk_accounts_ref_21978_accountm

|
|

pg_restore: creating FK CONSTRAINT fk_taxselld_ref_21973_taxsell
pg_restore: creating DUMP TIMESTAMP DUMP TIMESTAMP
pg_restore: setting owner and privileges for DUMP TIMESTAMP DUMP TIMESTAMP
pg_restore: setting owner and privileges for SCHEMA public
pg_restore: setting owner and privileges for COMMENT SCHEMA public
pg_restore: setting owner and privileges for ACL public
pg_restore: setting owner and privileges for FUNCTION plpgsql_call_handler()
pg_restore: setting owner and privileges for FUNCTION plpgsql_validator(oid)
pg_restore: setting owner and privileges for PROCEDURAL LANGUAGE plpgsql
pg_restore: setting owner and privileges for FUNCTION func_buyitem_af_de_row()

|
|

pg_restore: setting owner and privileges for FUNCTION func_sellitem_update()
pg_restore: setting owner and privileges for TABLE accountmain
pg_restore: setting owner and privileges for TABLE accountsub
pg_restore: setting owner and privileges for SEQUENCE bscp
pg_restore: setting owner and privileges for TABLE busisumday

|
|

pg_restore: setting owner and privileges for TABLE zipcode
pg_restore: setting owner and privileges for CONSTRAINT accountmain_pkey

|
|

pg_restore: setting owner and privileges for CONSTRAINT zipcode_pkey
pg_restore: setting owner and privileges for INDEX idx_buyitem_custcode

|
|

pg_restore: setting owner and privileges for INDEX idx_sellitem_itemcode
pg_restore: setting owner and privileges for INDEX pbsyscatcoldict_idx

|
|

pg_restore: setting owner and privileges for INDEX pbsyspbe_idx
pg_restore: setting owner and privileges for TRIGGER tr_buyitem_af_de_row

|
|

pg_restore: setting owner and privileges for TRIGGER tr_sellitem_af_up_row
pg_restore: setting owner and privileges for FK CONSTRAINT fk_accounts_ref_21978_accountm

|
|

pg_restore: setting owner and privileges for FK CONSTRAINT fk_taxselld_ref_21973_taxsell
pg_restore: setting owner and privileges for DUMP TIMESTAMP DUMP TIMESTAMP
WARNING: errors ignored on restore: 3
--
-- PostgreSQL database dump complete
--
Process returned exit code 1.
====================================================================================

이 글에 대한 댓글이 총 2건 있습니다.

맨 마지막 3 개의 오류가 발생했는데, 이놈에 대해서는 무시했다는 경고가 났네요.

윗 부분을 보니,

plpgsql 관련 함수와 언어 설정에서 이미 있다고 오류가 발생했는데,

 

hicom 데이터베이스를 만들때, 그 템플릿 데이터베이스가 template1 이라서 그런 것 같네요.

template1 db 안에 이미, plpgsql 정의가 있고, 이놈을 hicom을 만드니 그대로 따라온게지요.

 

이상태에서 pg_restore에서 plpgsql 놈을 만들어라고 하니, 오류가.

 

이 문제를 피하는 방법은요, hicom 데이터베이스를 만들 때, 템플릿 데이터베이스를 template0 놈으로 사용하세요.

 

template0 에는 어떠한 사용자정의 객체들도 없거든요.

 

관심 가져볼 만한 이야기네요.

pg_restore 사용할 때, 완벽한 데이터베이스 전체 restore 라면, template0 놈을 템플릿으로 사용해서 db를 만들어야한다는... :)

 

다른 한 방법은 pg_restore 에서 -c 옵션인가? 데이터베이스를 만들면됩니다. 이때, 사용할 덤프파일은 반드시 pg_dump -c 옵션으로 데이터베이스를 만들수 있는 정보도 함께 포함해서 덤프받아야하구요.

 

김상기(ioseph)님이 2005-02-18 16:06에 작성한 댓글입니다.

아.. 정확한 이유가 그랬군요...

어쩐지 데이터베이스를 하나 생성하면

1. Languages 밑에 phpsql이 하나 생기고.

2. Schemas - public - Functions에 19개의 Fuction들이

  생기더라구요..

pgAdmin에서는 기본적으로 Templete를 Templete1으로 지정이

되나보네요..

Templete0으로 하니깐 위에 것들도 하나 안생기네여..

 

상기님.. 정확한 답변 감사드립니다.^^

초짜님이 2005-02-18 16:39에 작성한 댓글입니다. Edit
[Top]
No.
제목
작성자
작성일
조회
5908[질문]7.3.X 버전대에서 namespace(schema) 별 백업방법?? [1]
가우나라
2005-02-18
2275
5906유저가 모든 데이터 베이스에 접근 가능한데요? [3]
초심으로
2005-02-18
2462
5905데이터 베이스 유저 변경은? [1]
초심으로
2005-02-18
2672
5904데이터베이스 복원 에러가나는데요.. [2]
초짜
2005-02-18
6151
5903[질문]소스 공개안하나요? [2]
오윤석
2005-02-18
2195
5902제 "PostgreSQL for Win32" 홈피도 방문해 주세요. [3]
오수형
2005-02-18
2449
5901여기에 질문을 올려도 될지 모르겠네요(win 8.0)?? ^-^ [2]
롱다리
2005-02-18
2143
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2024 DSN, All rights reserved.
작업시간: 0.018초, 이곳 서비스는
	PostgreSQL v16.2로 자료를 관리합니다