Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change NLS Character set parameters on Oracle 11g XE

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:

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.

like image 278
Parth Bhagat Avatar asked May 21 '14 09:05

Parth Bhagat


2 Answers

This worked for me where an application was checking for 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
like image 195
Gary Avatar answered Sep 30 '22 07:09

Gary


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

However, are you really sure to change it? AL32UTF8 is UTF-8, actually.

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) AL32UTF8 and UTF8 are identical.

Note, this command works only if the new character set is a strict superset of old character set. I.e. you can change from US7ASCII to AL32UTF8 or WE8ISO8859P1 but you cannot change from WE8ISO8859P1 to AL32UTF8.

like image 38
Wernfried Domscheit Avatar answered Sep 30 '22 07:09

Wernfried Domscheit