如何在 Oracle 中配置 UTF8 字符集?

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

How to configure UTF8 character set in Oracle?

oracle

提问by PPShein

How to configure UTF8 character set in Oracle? I've tried to update as follow :

如何在 Oracle 中配置 UTF8 字符集?我尝试更新如下:

UPDATE NLS_DATABASE_PARAMETERS SET VALUE = 'UTF8' WHERE PARAMETER='NLS_CHARACTERSET';

But the error show like that

但是错误显示是这样的

ERROR at line 1:
ORA-01031: insufficient privileges

回答by Mark J. Bobak

Yeah, good thing that failed too...that's not a good idea... :-)

是的,好东西也失败了......这不是一个好主意...... :-)

First off, for UTF-8 support in Oracle, you'll want to use the 'AL32UTF8' character set.

首先,对于 Oracle 中的 UTF-8 支持,您需要使用“AL32UTF8”字符集。

Is this a brand new database? Or an existing database with data already in it?

这是一个全新的数据库吗?或者一个现有的数据库中已经有数据?

If we're talking new database, you should just drop the database, and create it again, specifying the AL32UTF8 character set in DBCA, when you create the database.

如果我们谈论的是新数据库,您应该删除该数据库,然后在创建数据库时重新创建它,并在 DBCA 中指定 AL32UTF8 字符集。

If it's an existing database, with data already in it, it's a bit more complicated. What character set does it currently use? Is AL32UTF8 a direct superset of that character set?

如果它是一个现有的数据库,其中已经有数据,那就有点复杂了。它目前使用什么字符集?AL32UTF8 是该字符集的直接超集吗?

This is really a non-trivial subject. In short, you need to know the current character set, and the character set you're moving to, and you'll need to run the 'CSSCAN' utility to check for compatibility and data conversion problems.

这确实是一个不平凡的话题。简而言之,您需要知道当前的字符集,以及您要移动到的字符集,并且您需要运行“CSSCAN”实用程序来检查兼容性和数据转换问题。

For the full story, you should check the following document on MOS:

对于完整的故事,您应该查看 MOS 上的以下文档:

Changing the NLS_CHARACTERSET to AL32UTF8 / UTF8 (Unicode) [ID 260192.1]

将 NLS_CHARACTERSET 更改为 AL32UTF8 / UTF8 (Unicode) [ID 260192.1]

Hope that helps.

希望有帮助。