SQL 在 Oracle 11g XE 上更改 NLS 字符集参数

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23779159/
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-01 01:55:23  来源:igfitidea点击:

Change NLS Character set parameters on Oracle 11g XE

sqloracleoracle11goracle-apexoracle-xe

提问by Parth Bhagat

I am using Oracle 11g Express Edition. Currently when I check NLS character set parameter using SELECT * FROM nls_database_parameters;it gives the default values:

我正在使用 Oracle 11g 快捷版。目前,当我使用SELECT * FROM nls_database_parameters;它检查 NLS 字符集参数时,它给出了默认值:

NLS_CHARACTERSET: AL32UTF8
NLS_NCHAR_CHARACTERSET: AL16UTF16

I want to set both these parameters to UTF8. How can I do so? I have just installed Oracle 11g XE, so there is not data except those required by Oracle itself.

我想将这两个参数都设置为 UTF8。我怎么能这样做?我刚刚安装了Oracle 11g XE,所以除了Oracle本身需要的数据外没有数据。

回答by Gary

This worked for me where an application was checking for UTF8 rather than AL32UTF8.

这对我有用,其中应用程序正在检查UTF8 rather than AL32UTF8.

SQL> shutdown immediate;

SQL> startup restrict

SQL> select name from v$database;

SQL> ALTER DATABASE CHARACTER SET INTERNAL_USE UTF8 ;

SQL> select value from NLS_DATABASE_PARAMETERS 
     where parameter='NLS_CHARACTERSET';

SQL> shutdown immediate;

SQL> startup

回答by Wernfried Domscheit

Maybe this works: alter database character set UTF8;--> Not supported anymore on Oracle 10.1 or later.

也许这有效:alter database character set UTF8;--> 在 Oracle 10.1 或更高版本上不再受支持。

However, are you really sure to change it? AL32UTF8isUTF-8, actually.

然而,你真的确定要改变吗?实际上AL32UTF8UTF-8。

On Oracle you have also a character set called UTF8, this is a kind of misnomer and means Character set CESU-8. As far as I know this is like "UTF-8 as of Unicode version 3 from 1999". As long as you use Unicode characters less than 65535 (Basic Multilingual Plane) AL32UTF8and UTF8are identical.

在 Oracle 上,您还有一个名为 的字符集UTF8,这是一种用词不当,表示字符集CESU-8。据我所知,这就像“1999 年的 Unicode 版本 3 中的 UTF-8”。只要您使用的 Unicode 字符小于 65535(基本多语言平面)AL32UTF8并且UTF8是相同的。

Note, this command works only if the new character set is a strict superset of old character set. I.e. you can change from US7ASCIIto AL32UTF8or WE8ISO8859P1but you cannot change from WE8ISO8859P1to AL32UTF8.

请注意,此命令仅在新字符集是旧字符集的严格超集时才起作用。即您可以从 更改US7ASCIIAL32UTF8WE8ISO8859P1但您不能从 更改WE8ISO8859P1AL32UTF8

回答by Rosel

You can't change the character setonce you set installation. If you want to change then there is long procedure for which you need to raise SR with Oracle.

一旦设置安装,您就无法更改字符集。如果要更改,则需要向 Oracle 提出 SR 的过程很长。

回答by user4273977

SQL> shutdown immediate;

SQL> startup restrict

SQL> select name from v$database;

SQL> ALTER DATABASE CHARACTER SET INTERNAL_USE WE8MSWIN1252 ;

SQL> select value from NLS_DATABASE_PARAMETERS where parameter='NLS_CHARACTERSET';

SQL> shutdown immediate;

SQL> startup

SQL> select value from NLS_DATABASE_PARAMETERS where parameter='NLS_CHARACTERSET';