oracle 字符集是来自用户还是数据库?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4938541/
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
Is character set from the user or the database?
提问by jeph perro
I'm trying to figure out where our project went wrong.
我想弄清楚我们的项目哪里出错了。
A long time ago, our database administrator created a user and a schema for the project we were working on.
很久以前,我们的数据库管理员为我们正在处理的项目创建了一个用户和一个架构。
We gave that user to a contractor who created the tables and installed the application.
我们将该用户交给了创建表并安装应用程序的承包商。
Today I discovered that our database doesn't support UTF-8 characters and we need it to.
今天我发现我们的数据库不支持 UTF-8 字符,我们需要它。
select value from nls_database_parameters
where parameter='NLS_CHARACTERSET'
The result is : WE8ISO8859P1
结果是:WE8ISO8859P1
My question is, was the mistake made when the user was created, or was the mistake done by the contractor who created the tables?
我的问题是,是创建用户时犯的错误,还是创建表的承包商犯的错误?
Thanks
谢谢
回答by Justin Cave
The character set is an attribute of the database. So whoever created the database presumably chose the wrong character set. There are no character set related settings when you create a user or create a table (other than determining whether to use the database character set (CHAR/ VARCHAR2) or the national character set (NCHAR/ NVARCHAR2) data types).
字符集是数据库的一个属性。因此,创建数据库的人可能选择了错误的字符集。创建用户或创建表时没有字符集相关的设置(除了确定是使用数据库字符集(CHAR/VARCHAR2)还是国家字符集(NCHAR/NVARCHAR2)数据类型)。
Changing the character set of an existing database may take a bit of effort. The Globalization Guide has a section on character set migration. Depending on the Oracle version (the procedure is different in 10g and 11g) and what data already exists, doing an export & import to a new database may be the easiest option.
更改现有数据库的字符集可能需要一些努力。全球化指南有一节是关于字符集迁移的。根据 Oracle 版本(10g 和 11g 中的过程不同)以及已经存在的数据,导出和导入新数据库可能是最简单的选择。
I should add that the order of operations you specified in your post doesn't make sense. The database has to be created before the user or the schema can be created. So it doesn't make sense that the DBA could have created the user and the schema a long time ago and the contractor created the database more recently. Are you possibly using the terms "database" and "schema" in a non-Oracle context?
我应该补充一点,您在帖子中指定的操作顺序没有意义。必须先创建数据库,然后才能创建用户或架构。因此,DBA 可以在很久以前创建用户和模式而承包商最近创建数据库是没有意义的。您是否可能在非 Oracle 上下文中使用术语“数据库”和“架构”?