oracle 캐릭터셋 설정바꾸기
####################################################
#### .bash_profile 환경변수
export ORACLE_BASE=/home/oracle
export ORACLE_HOME=$ORACLE_BASE/oracle/product/10.2.0/db_1
export ORACLE_SID=ora10
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
#export LD_ASSUME_KERNEL=2.4.19
export PATH=$PATH:$ORACLE_HOME/bin
export NLS_LANG=KOREAN_KOREA.KO16KSC5601 #한글
export NLS_LANG=KOREAN_KOREA.KO16MSWIN949 #한글(추천:지원캐릭터가 더 많음 -뷃,숖..)
export NLS_LANG=AMERICAN_AMERICA.UTF8 #유니코드
####################################################
#### 캐릭터 셋 설정 확인
SELECT NAME,VALUE$ FROM PROPS$ WHERE NAME ='NLS_LANGUAGE' OR NAME ='NLS_TERRITORY' OR NAME ='NLS_CHARACTERSET';
####################################################
#### 오라클 캐릭터 셋 변경
update props$ set VALUE$='UTF-8' where name='NLS_CHARACTERSET';
update props$ set VALUE$='KO16MSWIN949' where name='NLS_CHARACTERSET';
update props$ set VALUE$='KO16KSC5601' where name='NLS_CHARACTERSET';
update props$ set VALUE$='KOREAN' where name='NLS_LANGUAGE';
update props$ set VALUE$='KOREA' where name='NLS_TERRITORY';
####################################################
#### 캐릭터 셋 변경후에 확인 사항(필수)
에러 유형 :
EXP-00008: ORACLE 오류 6552가 발생했습니다
ORA-06552: PL/SQL: Compilation unit analysis terminated
ORA-06553: PLS-553: 알 수 없는 문자 집합 이름입니다
Problem description
===================
You receive the following error when (re)compiling or calling a piece of pl/sql:
ORA-06550: line <num>, column <num>: ....
or
ORA-06552: PL/SQL: Compilation unit analysis terminated
followed by
ORA-06553: PLS-553: character set name is not recognized
에러 원인 : character set 이 섞여있음.
캐릭터셋 확인 쿼리 :
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);
캐릭터셋 확인 쿼리 결과(잘못된 경우): varchar2가 2개 의 캐릭터셋이 설정되어있음.
CHARACTERSET TYPES_USED_IN
-----------------------------------------------------
AL16UTF16 NCHAR
AL16UTF16 NVARCHAR2
AL16UTF16 NCLOB
US7ASCII CHAR
US7ASCII VARCHAR2
WE8DEC VARCHAR2
US7ASCII CLOB
캐릭터셋 확인 쿼리 결과(정상인 경우): TYPES_USERD_IN 하나당 하나의 캐릭터셋
CHARACTERSET TYPES_USED_IN
-----------------------------------------------------
AL16UTF16 NCHAR
AL16UTF16 NVARCHAR2
AL16UTF16 NCLOB
AL32UTF8 CHAR
AL32UTF8 VARCHAR2
AL32UTF8 CLOB
해결방법:
c:\ sqlplus / as sysdba
select * from sys.props$ where name='NLS_CHARACTERSET';
시스템 프로퍼티 변경
update sys.props$ set value$='UTF8' where name='NLS_CHARACTERSET';
update sys.props$ set value$='UTF8' where name='NLS_NCHAR_CHARACTERSET';
update sys.props$ set value$='KOREAN_KOREA.UTF8' where name='NLS_LANGUAGE';
commit;
shutdown immediate;
startup mount/RESTRICT; 둘중하나를 해보고 메세지에 따라 달리 선택해본다.
alter system enable restricted session;
alter system set job_queue_processes=0;
alter system set aq_tm_processes=0;
alter database open;
alter database charcter set internal_use UTF8;
alter database national character set internal_use UTF8;
두번에 걸쳐 반복한다.
shutdown immediate;
startup;
shutdown immediate;
startup;
댓글
댓글 쓰기