Character set字符集

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."

 

时间: 2024-10-29 14:15:41

Character set字符集的相关文章

查看mysql字符集及修改表结构--表字符集,字段字符集

MySQL 乱码的根源是的 MySQL 字符集设置不当的问题,本文汇总了有关查看 MySQL 字符集的命令.包括查看 MySQL 数据库服务器字符集.查看 MySQL 数据库字符集,以及数据表和字段的字符集.当前安装的 MySQL 所支持的字符集等. 一.查看 MySQL 数据库服务器和数据库字符集. mysql> show variables like '%char%';+--------------------------+----------------------------------

Linux下MySQL 5.5的修改字符集编码为UTF8(彻底解决中文乱码问题)

PS:昨天一同事遇到mysql 5.5中文乱码问题,找我解决.解决了,有个细节问题网上没人说,我就总结一下. 一.登录MySQL查看用SHOW VARIABLES LIKE 'character%';下字符集,显示如下:+--------------------------+----------------------------+| Variable_name | Value |+--------------------------+----------------------------+|

mysql字符集乱码问题解决方法介绍_Mysql

character-set-server/default-character-set:服务器字符集,默认情况下所采用的. character-set-database:数据库字符集. character-set-table:数据库表字符集. 优先级依次增加.所以一般情况下只需要设置character-set-server,而在创建数据库和表时不特别指定字符集,这样统一采用character-set-server字符集. character-set-client:客户端的字符集.客户端默认字符集.

MySQL字符集 GBK、GB2312、UTF8区别 解决MYSQL中文乱码问题_Mysql

MySQL中涉及的几个字符集 character-set-server/default-character-set:服务器字符集,默认情况下所采用的. character-set-database:数据库字符集. character-set-table:数据库表字符集. 优先级依次增加.所以一般情况下只需要设置character-set-server,而在创建数据库和表时不特别指定字符集,这样统一采用character-set-server字符集. character-set-client:客户

mysql字符集乱码解决方法总结

character-set-server/default-character-set:服务器字符集,默认情况下所采用的. character-set-database:数据库字符集. character-set-table:数据库表字符集. 优先级依次增加.所以一般情况下只需要设置character-set-server,而在创建数据库和表时不特别指定字符集,这样统一采用character-set-server字符集. character-set-client:客户端的字符集.客户端默认字符集.

【转贴】Linux下MySQL 5.5的修改字符集编码为UTF8(彻底解决中文乱码问题)

来源: http://www.ha97.com/5359.html PS:昨天一同事遇到mysql 5.5中文乱码问题,找我解决.解决了,有个细节问题网上没人说,我就总结一下. 一.登录MySQL查看用SHOW VARIABLES LIKE 'character%';下字符集,显示如下:+--------------------------+----------------------------+| Variable_name | Value |+-----------------------

Oracle数据库备份策略的相关概念及使用

这篇论坛文章主要介绍了Oracle数据库备份策略的相关概念及使用中的注意事项,详细内容请大家参考下文 一.了解备份的重要性 可以说,从计算机系统出世的那天起,就有了备份这个概念,计算机以其强大的速度处理能力,取代了很多人为的工作,但是,往往很多时候,它又是那么弱不禁风,主板上的芯片.主板电路.内存.电源等任何一项不能正常工作,都会导致计算机系统不能正常工作.当然,这些损坏可以修复,不会导致应用和数据的损坏.但是,如果计算机的硬盘损坏,将会导致数据丢失,此时必须用备份恢复数据. 其实,在我们的现实

MySQL的性能优化和使用技巧

本文是笔者从工作中总结而出.由于时间问题和考虑的不可能足够全面,所以本文会很长时间才会完成,下面会陆续给出内容,与大家分享^_^ 在windows下,配置文件为%mysql_home%/my.ini 在linux下,配制文件为/etc/my.cnf 一 性能优化 1--------INNODB_BUFFER_POOL_SIZE 该参数是innodb引擎的最主要的性能参数,对数据库的性能起了决定性作用.说白了就是数据库的使用内存. 2--------性能分析, show status like '

细谈 oracle备份的方法

细谈 oracle备份的方法 [内容导航] 第1页:了解ORACLE的运行方式 第2页:ORACLE备份的分类 第3页:定制恰当的备份策略 [IT168 服务器学院]一.了解备份的重要性  可以说,从计算机系统出世的那天起,就有了备份这个概念,计算机以其强大的速度处理能力,取代了很多人为的工作,但是,往往很多时候,它又是那么弱不禁风,主板上的芯片.主板电路.内存.电源等任何一项不能正常工作,都会导致计算机系统不能正常工作.当然,这些损坏可以修复,不会导致应用和数据的损坏.但是,如果计算机的硬盘损