改 oracle 的內碼成 utf8 commands

select * from v$nls_parameters

1	NLS_LANGUAGE	TRADITIONAL CHINESE
2	NLS_TERRITORY	TAIWAN
3	NLS_CURRENCY	NT$
4	NLS_ISO_CURRENCY	TAIWAN
5	NLS_NUMERIC_CHARACTERS	.,
6	NLS_CALENDAR	GREGORIAN
7	NLS_DATE_FORMAT	DD-MON-RR
8	NLS_DATE_LANGUAGE	TRADITIONAL CHINESE
9	NLS_CHARACTERSET	WE8ISO8859P1
10	NLS_SORT	BINARY
11	NLS_TIME_FORMAT	HH.MI.SSXFF AM
12	NLS_TIMESTAMP_FORMAT	DD-MON-RR HH.MI.SSXFF AM
13	NLS_TIME_TZ_FORMAT	HH.MI.SSXFF AM TZR
14	NLS_TIMESTAMP_TZ_FORMAT	DD-MON-RR HH.MI.SSXFF AM TZR
15	NLS_DUAL_CURRENCY	NT$
16	NLS_NCHAR_CHARACTERSET	AL16UTF16
17	NLS_COMP	BINARY
18	NLS_LENGTH_SEMANTICS	BYTE
19	NLS_NCHAR_CONV_EXCP	FALSE


要把這個 NLS_CHARACTERSET 改成:
9	NLS_CHARACTERSET	AL32UTF8

查 oracle 的內碼使用的是啥?

SELECT parameter, value FROM v$nls_parameters WHERE parameter LIKE '%CHARACTERSET';

PARAMETER
------------------------
VALUE
------------------------
NLS_CHARACTERSET
WE8ISO8859P1

NLS_NCHAR_CHARACTERSET
AL16UTF16


看一下 NLS_CHARACTERSET 不是 AL32UTF8

在 sqlplus 用 sysdba 進去, 下這些 commands

shutdown immediate;
STARTUP MOUNT;
ALTER SESSION SET SQL_TRACE=TRUE;
ALTER SYSTEM ENABLE RESTRICTED SESSION;
ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
ALTER SYSTEM SET AQ_TM_PROCESSES=0;
ALTER DATABASE OPEN;
ALTER DATABASE character set INTERNAL_USE AL32UTF8;
ALTER SESSION SET SQL_TRACE=FALSE;

shutdown immediate;
startup;


環境變數
NLS_LANG="TRADITIONAL CHINESE_TAIWAN".AL32UTF8
export NLS_LANG