Q.
안녕하세요. 데이타를 exp 로 받으려고 하는데 아래와 같은 오류가 뜨고 있습니다.


EXP-00008: ORACLE 오류 6552가 발생했습니다
ORA-06552: PL/SQL: Compilation unit analysis terminated
ORA-06553: PLS-553: character set name is not recognized
EXP-00000: 엑스포트가 실패로 끝났습니다

일단 제가 취해본 방법은 sys 권한으로 로그인하여

$ORACLE_HOME/rdbms/admin/utlrp.sql
$ORACLE_HOME/rdbms/admin/catalog.sql
$ORACLE_HOME/rdbms/admin/catproc.sql

를 순서대로 실행을 시켜보았으나 역시 안되고 있습니다.

캐릭터셋과 관련한 문제일지도 몰라서 조회해보니 캐릭터셋에 대한 값은 아래와 같습니다.

SELECT VALUE
FROM NLS_DATABASE_PARAMETERS
WHERE PARAMETER in ('NLS_NCHAR_CHARACTERSET','NLS_CHARACTERSET')


VALUE

KO16KSC5601
KO16KSC5601

SELECT DISTINCT (NLS_CHARSET_NAME (CHARSETID)) CHARACTERSET
,DECODE (type#
,1, DECODE (CHARSETFORM, 1, 'VARCHAR2', 2, 'NVARCHAR2', 'UNKOWN')
,9, DECODE (CHARSETFORM, 1, 'VARCHAR', 2, 'NCHAR VARYING', 'UNKOWN')
,96, DECODE (CHARSETFORM, 1, 'CHAR', 2, 'NCHAR', 'UNKOWN')
,112, DECODE (CHARSETFORM, 1, 'CLOB', 2, 'NCLOB', 'UNKOWN')
) types_used_in
FROM SYS.col$
WHERE CHARSETFORM IN (1, 2)
AND type# IN (1, 9, 96, 112);


CHARACTERSET TYPES_USED_IN

AL16UTF16 NCHAR
AL16UTF16 NCLOB
AL16UTF16 NVARCHAR2
KO16KSC5601 CHAR
KO16KSC5601 CLOB
KO16KSC5601 NVARCHAR2
KO16KSC5601 VARCHAR2
US7ASCII CHAR
US7ASCII CLOB
US7ASCII VARCHAR2

이런 문제는 어떻게 해야 해결할 수 있을지요?
경험해 보시거나 아시는 분께서는 조언 좀 부탁드립니다.


A.
우선 ORA-06552 로 게시판 검색을 하시면 06년 9월 초 질문 사항에 대해서
제가 답변한 것이 있습니다. 그에 대한 해결방법을 보시지요. 그런데
character set 문제에 대한 처리과정에서 위험한 것이 있습니다.
character set을 잘못 변경 했을 경우에는 도저히 DB가 OPEN하지 않는 경우가
많습니다. 그러니 꼭 metalink를 통해서 한국 오라클의 공식적인 지원이 필요합니다.


CHARACTERSET TYPES_USED_IN


AL16UTF16 NCHAR
AL16UTF16 NCLOB
AL16UTF16 NVARCHAR2
KO16KSC5601 CHAR
KO16KSC5601 CLOB
KO16KSC5601 NVARCHAR2
KO16KSC5601 VARCHAR2
US7ASCII CHAR
US7ASCII CLOB
US7ASCII VARCHAR2


에서 VARCHAR2 부분에 KO16KSC5601 뿐만 아니라 US7ASCII 까지 있네요.
기존에 OS환경에서 NLS_LANG 을 설정하지 않아서 American_America.US7ASCII
로 exp/imp한 적이 있는지요?

제 테스트 환경에서 보면 아래와 같이 나옵니다.
9.2.0.8 32bit , RedHat Enterprise Server 3 32bit

SQL>
SQL> COL VALUE NEW_VALUE CHARSET
SQL> SELECT VALUE FROM
2 NLS_DATABASE_PARAMETERS WHERE PARAMETER='NLS_CHARACTERSET';

VALUE


KO16KSC5601

SQL> COL VALUE NEW_VALUE NCHARSET
SQL> SELECT VALUE
2 FROM NLS_DATABASE_PARAMETERS
3 WHERE PARAMETER='NLS_NCHAR_CHARACTERSET';

VALUE


AL16UTF16

SQL> select distinct(nls_charset_name(charsetid)) CHARACTERSET,
2 decode(type#, 1, decode(charsetform, 1, 'VARCHAR2', 2, 'NVARCHAR2','UNKOWN'),
3 9, decode(charsetform, 1, 'VARCHAR', 2, 'NCHAR VARYING', 'UNKOWN'),
4 96, decode(charsetform, 1, 'CHAR', 2, 'NCHAR', 'UNKOWN'),
5 112, decode(charsetform, 1, 'CLOB', 2, 'NCLOB', 'UNKOWN')) TYPES_USED_IN
6 from sys.col$ where charsetform in (1,2) and type# in (1, 9, 96, 112);

CHARACTERSET TYPES_USED_IN


-------------
AL16UTF16 NCHAR
AL16UTF16 NCLOB
AL16UTF16 NVARCHAR2
KO16KSC5601 CHAR
KO16KSC5601 CLOB
KO16KSC5601 VARCHAR2

6 rows selected.

즉 VARCHAR2의 경우에 KO16KSC5601 로만 일관됩니다.


<참고>

안녕하세요. export가 안됩니다. 조언을 부탁드립니다.
게시일: 2006. 10. 30 오후 2:21
       
안녕하세요.
새로 디비를 구축하여 export 를 받는데 아래와 같은 에러가 발생하여
문의드립니다.

KIUP:/home/oracle}exp kiup/kiup00 file=20061130_7.dmp

Export: Release 9.2.0.1.0 - Production on Tue Oct 31 01:04:43 2006

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Connected to: Oracle9i Enterprise Edition Release 9.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
Export done in KO16KSC5601 character set and AL16UTF16 NCHAR character set
server uses UTF8 character set (possible charset conversion)

About to export specified users ...
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user KIUP
. exporting PUBLIC type synonyms
EXP-00008: ORACLE error 6552 encountered
ORA-06552: PL/SQL: Compilation unit analysis terminated
ORA-06553: PLS-553: character set name is not recognized
EXP-00000: Export terminated unsuccessfully

9206다른 서버에서 export받은 파일을 import할때는 이상없이 잘됩니다.

백업없는 DBA는 용답이 되지 않으므로 많은 성원 부탁드립니다.

Re: caused by a "mixup" in the character set of the database.

게시일: 2006. 10. 30 오후 4:20   ghkim님의 질문에 답변 ghkim님의 질문에 답변
       
아래를 알려주십시오.
ORA-06553: PLS-553: character set name is not recognized
으로 보아서는 character set문제로 보입니다.

1. DB에서

COL VALUE NEW_VALUE CHARSET
SELECT VALUE FROM
NLS_DATABASE_PARAMETERS WHERE ARAMETER='NLS_CHARACTERSET';

COL VALUE NEW_VALUE NCHARSET
SELECT VALUE
FROM NLS_DATABASE_PARAMETERS
WHERE PARAMETER='NLS_NCHAR_CHARACTERSET';

2. DB에서
select distinct(nls_charset_name(charsetid)) CHARACTERSET,
decode(type#, 1, decode(charsetform, 1, 'VARCHAR2', 2, 'NVARCHAR2','UNKOWN'),
9, decode(charsetform, 1, 'VARCHAR', 2, 'NCHAR VARYING', 'UNKOWN'),
96, decode(charsetform, 1, 'CHAR', 2, 'NCHAR', 'UNKOWN'),
112, decode(charsetform, 1, 'CLOB', 2, 'NCLOB', 'UNKOWN')) TYPES_USED_IN
from sys.col$ where charsetform in (1,2) and type# in (1, 9, 96, 112);


3. OS에서
echo $NLS_LANG

글 수정:
민천사 (민연홍)

관련사항
Causes
======
This error may be caused by a "mixup" in the character set of the database.

Correcting the problem
======================
This problem was likely caused when the database character set was changed
incorrectly in the past, and some locations where the character set is stored
were updated and others were not.
In order to correct this problem we can simply run a script that correctly
changes the character set in all the locations to the current database character
set:

Re: caused by a "mixup" in the character set of the database.
게시일: 2006. 10. 30 오후 10:52   YeonHong.Min님의 질문에 답변 YeonHong.Min님의 질문에 답변
       
안녕하세요. 민천사님
답변감사합니다.

우선 알려주신 1번에서는...쿼리가 되지 않으며,

2번은
CHARACTERSET TYPES_USED_IN

-------------
AL16UTF16 NCHAR
AL16UTF16 NCLOB
AL16UTF16 NVARCHAR2
AL32UTF8 CHAR
AL32UTF8 CLOB
AL32UTF8 VARCHAR2
US7ASCII VARCHAR2
UTF8 CHAR
UTF8 CLOB
UTF8 VARCHAR2

10 rows selected.

3번.
SQL> !echo $NLS_LANG
American_America.UTF8

그리고..DB 캐릭터셋은 UTF8로 설정하였습니다.

Re: caused by a "mixup" in the character set of the database.
게시일: 2006. 10. 30 오후 11:57   ghkim님의 질문에 답변 ghkim님의 질문에 답변
       
AL32UTF8 VARCHAR2
US7ASCII VARCHAR2
UTF8 VARCHAR2
이 부분은 문제가 있습니다. 정상이라면 VARCHAR2가
하나의 CHARACTERSET을 가지고 있습니다.

character set이 어떻게 되는지요? UTF8 인가요?

이 사항은 오라클에 공식적으로 요청을 해서 처리해야할 문제로
보입니다. 함부로 character set을 변경했다가는 위험하기 때문
입니다.

우선 이 사항에 대한 note자료를 보면 아래와 같습니다.
아래에서도 해결방법을 알려주기는 하나 공식적으로 오라클에
요청해서 진행하는 편이 좋을 것 같습니다.
만약 그러한 경우가 되지 않을 경우에는 offline backup을 2 copy
해놓고 아래와 같이 작업을 합니다.

note 286964.1
PLS-553 when calling or compiling pl/sql objects

(obviously the actual character sets can differ)
Here you can see that there are 2 different character sets returned for VARCHAR2
data, which indicates a mixup in the database character set setup, which is the
cause for this PLS-553 error.

<처리방법>

Correcting the problem
======================
This problem was likely caused when the database character set was changed
incorrectly in the past, and some locations where the character set is stored
were updated and others were not.
In order to correct this problem we can simply run a script that correctly
changes the character set in all the locations to the current database character
set:

a) Make sure the parallel_server parameter in INIT.ORA is set to false or it is not set at all.

SQL>show parameter parallel_server

b) Run the next script in SQLPLUS connected "as sysdba"
Please make sure you have a valid backup to fall back on before you run this script!

SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER SYSTEM ENABLE RESTRICTED SESSION;
ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
ALTER SYSTEM SET AQ_TM_PROCESSES=0;
ALTER DATABASE OPEN;
COL VALUE NEW_VALUE CHARSET
SELECT VALUE FROM NLS_DATABASE_PARAMETERS WHERE PARAMETER='NLS_CHARACTERSET';
COL VALUE NEW_VALUE NCHARSET
SELECT VALUE FROM NLS_DATABASE_PARAMETERS WHERE PARAMETER='NLS_NCHAR_CHARACTERSET';
ALTER DATABASE CHARACTER SET INTERNAL_USE &CHARSET;
ALTER DATABASE NATIONAL CHARACTER SET INTERNAL_USE &NCHARSET;
SHUTDOWN IMMEDIATE;
STARTUP;
-- yes, 2 times startup/shutdown . This is not a typo
SHUTDOWN IMMEDIATE;
STARTUP;

c) Restore the parallel_server parameter in INIT.ORA, if necessary.

This script doesn't change anything for the data that is already stored, but it
re-enforces database character set to be known in all places where it should be
stored.

After running this you can run the query under "Verification of the cause" once
more, and now there should just 2 sets of character sets, 1 for N-types and 1
for normal types. When that is indeed the case the PLS error will be solved.

Further actions
===============
It would be useful to do a healthcheck on this database because it has been
running with this incorrectly converted character set. The following note
describes a "character set health check" for the database:
Note 225938.1 Database Character Set Healthcheck

Further reading
===============
Note 257736.1 Changing the Database Character Set - an extended overview
Note 124721.1 Migrating an Applications Installation to a New Character Set

For further NLS / Globalization information you may start here:
Note 267942.1 - Globalization Technology (NLS) Knowledge Browser Product Page
Note 60134.1 Globalization (NLS) - Frequently Asked Questions

Posted by mklee.artist

Trackback Address :: http://www.medianart.com/trackback/177 관련글 쓰기

댓글을 달아 주세요

  1. 아무개 2011/03/10 09:20 Address Modify/Delete Reply

    진짜 너무 친절한 설명 고맙습니다. 덕분에 해결했습니다. ^^