참고글 및 문제해결/문제해결

DB생성 후 SQL실행할 떄 ?? ???? 같은 문자들이 출력될 때

에몽이ㅋ 2012. 4. 25. 05:47

원인 : DB에 setting된 characterset과 NLS_LANG 가 일치하지 않을 때
해결 : export NLS_LANG으로 DB의 character set과 일치시켜준다.



시나리오
1. 문제확인
2. 현재 문자셋확인

select name, value$ from props$
where name='NLS_LANGUAGE' or name='NLS_TERRITORY' or name='NLS_CHARACTERSET';
3. NLS_LANG설정
export NLS_LANG=AMERICAN_AMERICA.KO16MSWIN949
.bash_profile에도 추가

4. 해결확인




1. 문제확인(??? ??? 같은 문자열이 출력됨을 확인하세요)
[oracle@rac1 ~]$ sqlplus  / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Wed Apr 25 05:31:56 2012

Copyright (c) 1982, 2010, Oracle.  All rights reserved.


??? ???:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> select username from dba_users;

USERNAME
------------------------------
SYS
SYSTEM
SCOTT
HR
.... 중략 ....
APEX_PUBLIC_USER
SPATIAL_CSW_ADMIN_USR
SPATIAL_WFS_ADMIN_USR

36 ?? ?? ???????.


2. 현재 문자셋확인
SQL> select name, value$ from props$
  where name='NLS_LANGUAGE' or name='NLS_TERRITORY' or name='NLS_CHARACTERSET';

NAME
------------------------------
VALUE$
-------------------------------------------------------------
NLS_LANGUAGE
AMERICAN

NLS_TERRITORY
AMERICA

NLS_CHARACTERSET
KO16MSWIN949


3. NLS_LANG설정
SQL> exit
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options?? ???????.
[oracle@rac1 ~]$ export NLS_LANG=AMERICAN_AMERICA.KO16MSWIN949
[oracle@rac1 ~]$ vi .bash_profile


4. 해결확인
[oracle@rac1 ~]$ sqlplus  / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Wed Apr 25 05:43:20 2012

Copyright (c) 1982, 2010, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

더이상 ????? 로 출력되지 않습니다.