Preliminary Discussion on Character Set Problem (2)
- Database character set
Saturday, 2004-09-11 11:38
Eygle
Original text published in ITPUB Technology Series
Oracle Database DBA Special Technology is essential, unauthorized, it is strictly prohibited to reprint this article.
Original link: http://www.eygle.com/special/nls_character_set_02.htm
2. Database character set
The character set specifies when creating a database, usually cannot be changed after being created, so it is especially important to choose a correct character set when creating a database. When you create a database, we can specify the character set and the National Character Set. Character set is used to store: CHAR, VARCHAR2, Clob, long, etc. Type data, such as table name, column name, and PL / SQL program units such as SQL and PL / SQL program units such as the PL / SQL variables are used to store: nchar, nvarchar2, Nclob and other types of data These settings are specified when the database is created, we can see the creation of the database:
connect SYS / change_on_install as SYSDBAset echo onspool E: /oracle/ora92/assistants/dbca/logs/CreateDB.logstartup nomount pfile = "E: /oracle/admin/eygle/scripts/init.ora"; CREATE DATABASE eygleMAXINSTANCES 1MAXLOGHISTORY 1MAXLOGFILES 5MAXLOGMEMBERS 3MAXDATAFILES 100DATAFILE 'E: /oracle/oradata/eygle/system01.dbf' SIZE 250M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITEDEXTENT MANAGEMENT LOCALDEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE 'E: /oracle/oradata/eygle/temp01.dbf' SIZE 40M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITEDUNDO TABLESPACE "UNDOTBS1" DATAFILE 'E: /oracle/oradata/eygle/undotbs01.dbf' SIZE 50M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITEDCHARACTER SET ZHS16GBKNATIONAL CHARACTER SET AL16UTF16LOGFILE GROUP 1 ( 'E: / oracle / oradata / eygle / Redo01.log ') Size 10m, Group 2 (' E: /oracle/oradata/eygle/redo02.log ') size 10m, Group 3 (' e: /oracle/oradata/eygle/redo03.log ') size 10m; Spool offexit;
The above use bold is displayed for our critical character set. In the process of creating a database, select your character set in the following interface. For the Simplified Chinese platform, the default character set is: zhs16GBK Once your character set is selected, the characters that can be stored in the database are limited, so The character set you have chosen should be able to accommodate all you will use characters. Common Chinese characters are:
ZHS16CGB231280 CGB2312-80 16-Bit Simplified Chinese MB, ASCIzHS16GBK GBK 16-bit Simplified Chinese MB, ASCII, UDC where GB2312 code is the Chinese character information exchange coding, full name "information exchange, Chinese character set - Basic set ", Published by the State Administration of State, implemented on May 1, 1981, through the mainland. This encoding is also used in Singapore and other places. GBK coding is a guiding specification promulgated in December 1995. The GBK corresponds to the national standard GB 2312-80 information processing exchange code, in fact, the internal code standard is compatible; at the same time, all the Chinese Japanese and Korean (CJK) of ISO / IEC 10646-1 and GB 13000-1 in the word exchange level. Chinese characters (20902 words). Contains more encoding. But we said that the zhs16GBK is not the strict superchard of the zhs16cgb231280 (although the latter Chinese characters exists in the former, the same encoding may express different Chinese characters in different two characters), so it still needs to be required when doing database characters. pay attention. Oracle's character set naming followed the following naming rules:
It should be noted that some character sets naming violates this specification, and the UTF-8 in Oracle8 / Oralce8i is the first character set breaking this naming specification. We can see a type of character set to start with Al, such as: Al16UTF16 where Al represents all, indicates all languages (All Languages), follow this standard UTF-8 this should be named Al24UTF8.