Character set字符集
发布时间:2018-08-20 16:27:56 所属栏目:电商 来源:站长网
导读:Character set字符集 作者:zyqin 建设:2005-03-25 英文:http://www.dbonline.cn If the database has been created with the wrong character set, use the following to change the character set UPDATE SYS.PROPS$ SET VALUES$ = 'WE8ISO8859P1' WHE
Character set字符集 作者:zyqin 建设:2005-03-25 英文:http://www.dbonline.cn If the database has been created with the wrong character set, use the following to change the character set UPDATE SYS.PROPS$ SET VALUES$ = 'WE8ISO8859P1' WHERE NAME = 'NLS_CHARACTERSET'; It is VERY important to specify the character set name correctly. If the NLS_CHARACTERSET is updated to an invalid value, it will not then be possible to restart the database once it has been shutdown. 假如已经建设的数据库行使了错误的字符集,你可以行使下面的要领修改字符集: UPDATE SYS.PROPS$ SET VALUES$ = 'WE8ISO8859P1' WHERE NAME = 'NLS_CHARACTERSET'; 留意:确保字符集名称的精确性长短常重要的。假如NLS_CHARACTERSET被更新成一个错误的值,数据库封锁后就无法从头启动了。 Update ―――――――――――――――――――――――――――――――――――― From version 8 you can now update the character set using the alter database command. An extract from the documentation is included below, the basic rule being that the new characterset must be a superset of the current set. Interestingly enough, I tried the above update with a characterset that violated that rule, it still works - of course, any character code differences will would inevitably cause some problems, so it would be safest to use the supported syntax. Quote from the (8.1.6) documentation reveals: Oracle8往后的数据库可以通过行使alter database 呼吁修改字符集。引用文档中的一句话:新的字符集必需是原本字符集的一个超集。故意思的是,我曾经更新字符集是违背了这一原则,数据库照样事变;虽然了,任何字符码都也许导致同样的题目,以是最安详的要领照旧遵照法则服务。 ―――――――――――――――――――――――――――――――――――― "Changing the Character Set After Database Creation In some cases, you may wish to change the existing database character set. For instance, you may find that the number of languages that need to be supported in your database have increased. In most cases, you will need to do a full export/import to properly convert all data to the new character set. However, if and only if, the new character set is a strict superset of the current character set, it is possible to use the ALTER DATABASE CHARACTER SET to expedite the change in the database character set. 偶然辰,你也许必要修改当前数据库的字符集。这时你会发明你必要增进数据库支持的缘故起因的种类。大都环境下,你也许必要通过完全的export/import导入/导出来实现。假如,仅仅是假如,新的字符集是当前字符集的一个严酷的超集,行使ALTER DATABASE CHARACTER SET呼吁是一个可行的要领。 The target character set is a strict superset if and only if each and every codepoint in the source character set is available in the target character set, with the same corresponding codepoint value. For instance the following migration scenarios can take advantage of the ALTER DATABASE CHARACTER SET command since US7ASCII is a strict subset of WE8ISO8859P1, AL24UTFFSS, and UTF8: Current Character Set New Character Set New Character Set is strict superset? US7ASCII WE8ISO8859P1 yes US7ASCII ALT24UTFFSS yes US7ASCII UTF8 yes 假如A字符齐集的每一个codepoint在B字符齐集都有沟通的有用值,那么B字符集就可以成为A字符集的一个超集。譬喻,下面的迁徙方案可以行使ALTER DATABASE CHARACTER SET呼吁,由于US7ASCII是WE8ISO8859P1, AL24UTFFSS和 UTF8的超集。 当前字符集 新字符集 新字符集是否为超集 US7ASCII WE8ISO8859P1 是 US7ASCII ALT24UTFFSS 是 US7ASCII UTF8 是 WARNING: Attempting to change the database character set to a character set that is not a strict superset can result in data loss and data corruption. To ensure data integrity, whenever migrating to a new character set that is not a strict superset, you must use export/import. It is essential to do a full backup of the database before using the ALTER DATABASE [NATIONAL] CHARACTER SET statement, since the command cannot be rolled back. The syntax is: ALTER DATABASE [<db_name>] CHARACTER SET <new_character_set>; ALTER DATABASE [<db_name>] NATIONAL CHARACTER SET <new_NCHAR_character_set>; The database name is optional. The character set name should be specified without quotes, for example: ALTER DATABASE CHARACTER SET WE8ISO8859P1; To change the database character set, perform the following steps. Not all of them are absolutely necessary, but they are highly recommended: SQL> SHUTDOWN IMMEDIATE; -- or NORMAL <do a full backup> SQL> STARTUP MOUNT; SQL> ALTER SYSTEM ENABLE RESTRICED SESSION; SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0; SQL> ALTER DATABASE OPEN; SQL> ALTER DATABASE CHARACTER SET <new_character_set_name>; SQL> SHUTDOWN IMMEDIATE; -- or NORMAL SQL> STARTUP; To change the national character set, replace the ALTER DATABASE CHARACTER SET statement with ALTER DATABASE NATIONAL CHARACTER SET. You can issue both commands together if desired." (编辑:湖南网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |