A、oracle server 端 字符集查詢 linux
select userenv('language') from dual
其中NLS_CHARACTERSET 爲server端字符集 數據庫
NLS_LANGUAGE 爲 server端字符顯示形式 oracle
B、查詢oracle client端的字符集 spa
$echo $NLS_LANG 操作系統
若是發現你select 出來的數據是亂碼,請把client端的字符集配置成與linux操做系統相同的字符集。若是仍是有亂碼,則有多是數據庫中的數據存在問題,或者是oracle服務端的配置存在問題。 code
C、server端字符集修改 server
***************************************************************** blog
* 更改字符集步驟方法(WE8ISO8859P1 --> ZHS16GBK) * class
***************************************************************** cli
SQL>
將數據庫啓動到RESTRICTED模式下作字符集更改:
SQL> conn /as sysdba
Connected.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 236000356 bytes
Fixed Size 451684 bytes
Variable Size 201326592 bytes
Database Buffers 33554432 bytes
Redo Buffers 667648 bytes
Database mounted.
SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION;
System altered.
SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
System altered.
SQL> ALTER SYSTEM SET AQ_TM_PROCESSES=0;
System altered.
SQL> alter database open;
Database altered.
SQL> ALTER DATABASE CHARACTER SET ZHS16GBK;
ALTER DATABASE CHARACTER SET ZHS16GBK
*
ERROR at line 1:
ORA-12712: new character set must be a superset of old character set
提示咱們的字符集:新字符集必須爲舊字符集的超集,這時咱們能夠跳過超集的檢查作更改:
SQL> ALTER DATABASE character set INTERNAL_USE ZHS16GBK;
Database altered.
SQL> select * from v$nls_parameters;
略
19 rows selected.
重啓檢查是否更改完成:
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 236000356 bytes
Fixed Size 451684 bytes
Variable Size 201326592 bytes
Database Buffers 33554432 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.
SQL> select * from v$nls_parameters;
略
19 rows selected.