如何判断我的 Oracle 系统是否设置为支持 Unicode 或多字节字符?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9703421/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 04:02:49  来源:igfitidea点击:

How can I tell if my Oracle system is set to support Unicode or multibyte characters?

oracleunicodeplsqloracle11g

提问by zundarz

I understand that Oracle supports multiple character sets, but how can determine if the current 11g system where I work has that functionality enabled?

我知道 Oracle 支持多个字符集,但是如何确定我工作的当前 11g 系统是否启用了该功能?

回答by Justin Cave

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

will show you the database and national character set. The database character set controls the encoding of data in CHARand VARCHAR2columns. If the database supports Unicode in those columns, the database character set should be AL32UTF8 (or UTF8 in some rare cases). The national character set controls the encoding of data in NCHARand NVARCHAR2columns. If the database character set does not support Unicode, you may be able to store Unicode data in columns with these data types but that generally adds complexity to the system-- applications may have to change to support the national character set.

将向您显示数据库和国家字符集。数据库字符集控制数据输入CHARVARCHAR2列的编码。如果数据库在这些列中支持 Unicode,则数据库字符集应为 AL32UTF8(或在极少数情况下为 UTF8)。国家字符集控制数据输入NCHARNVARCHAR2列的编码。如果数据库字符集不支持 Unicode,您可以将 Unicode 数据存储在具有这些数据类型的列中,但这通常会增加系统的复杂性——应用程序可能必须更改以支持国家字符集。

回答by Rajesh Chaudhary

Unicode is a character encoding system that defines every character in most of the spoken languages in the world, Support for Unicode in Oracle Database:

Unicode 是一种字符编码系统,它定义了世界上大多数口语中的每个字符,Oracle 数据库中对 Unicode 的支持:

Character Set   Supported in RDBMS Release  Unicode Encoding
AL24UTFFSS      7.2 - 8i                    UTF-8
UTF8            8.0 - 11g                   UTF-8
UTFE            8.0 - 11g                   UTF-EBCDIC
AL32UTF8        9i?- 11g                    UTF-8
AL16UTF16       9i?- 11g                    UTF-16

To Make sure your database is Unicode, please check the value of "NLS_CHARACTERSET" Parameter and it should be AL32UTF8 or AL16UTF16 from above list.

要确保您的数据库是 Unicode,请检查“NLS_CHARACTERSET”参数的值,它应该是上面列表中的 AL32UTF8 或 AL16UTF16。

SQL>
SQL> SELECT * FROM v$nls_parameters WHERE parameter='NLS_CHARACTERSET';

PARAMETER                   VALUE               CON_ID
--------------------------- ------------------- ----------
NLS_CHARACTERSET            AL32UTF8            0

To Change the value of Parameter, Please Take the Fullback up because ALTER DATABASE statement cannot be rolled back and the Use following statements:

要更改 Parameter 的值,请使用 Fullback,因为 ALTER DATABASE 语句无法回滚,请使用以下语句:

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;
ALTER DATABASE CHARACTER SET AL32UTF8;
SHUTDOWN IMMEDIATE;
STARTUP;