简体   繁体   English

如何更改Oracle 11g r2 Express版中的字符集

[英]How to change character set in Oracle 11g r2 Express edition

I have to change the character set from AL32UTF8 to WE8MSWIN1252 in a Oracle 11g r2 Express instance... I tried to use the command: 我必须在Oracle 11g r2 Express实例中将字符集从AL32UTF8更改为WE8MSWIN1252 ...我尝试使用以下命令:

ALTER DATABASE CHARACTER SET WE8MSWIN1252;

But it fails saying that MSWIN1252 isn't a superset of AL32UTF8. 但它没有说MSWIN1252不是AL32UTF8的超集。 Then I found some articles talking about CSSCAN, and that tool doesn't seem to be available in Oracle 11 Express. 然后我发现了一些关于CSSCAN的文章,这个工具似乎在Oracle 11 Express中不可用。

http://www.oracle-base.com/articles/10g/CharacterSetMigration.php http://www.oracle-base.com/articles/10g/CharacterSetMigration.php

Anyone has an idea on how to do that? 任何人都知道如何做到这一点? Thanks in advance 提前致谢

Edit Clarifying a little bit: The real issue is that I'm trying to import data into a table that has a column defined as VARCHAR(6 byte). 编辑澄清一点:真正的问题是我正在尝试将数据导入到一个表中,该表的列定义为VARCHAR(6字节)。 The string causing the issue is 'eq.mês', it needs 6 bytes in MSWIN1252 and 7 bytes in UT8 导致问题的字符串是'eq.mês',它在MSWIN1252中需要6个字节,在UT8中需要7个字节

You can't. 你不能。

The Express Edition of 11g is only available using a UTF-8 character set. 11g的Express Edition仅使用UTF-8字符集。 If you want to go back to the express edition of 10g, there was a Western European version that used the Windows-1252 character set. 如果你想回到10g的快递版,有一个使用Windows-1252字符集的西欧版本。 Unlike with the other editions, Oracle doesn't support the full range of character sets in the Express Edition nor does it support changing the character set of an existing XE database. 与其他版本不同,Oracle不支持Express Edition中的所有字符集,也不支持更改现有XE数据库的字符集。

Why do you believe you need to change the database character set? 为什么您认为需要更改数据库字符集? Other than potentially taking a bit more storage space to support the characters in the upper half of the Windows-1252 range, which generally aren't particularly heavily used, there aren't many downsides to a UTF-8 database. 除了可能需要更多存储空间来支持Windows-1252范围上半部分中的字符(通常没有特别大量使用)之外,UTF-8数据库没有太多缺点。

The problem of only execute that ALTER DATABASE command is that the Data Dictionary was not converted and it can be corrupted. 仅执行ALTER DATABASE命令的问题是数据字典未被转换且可能已损坏。

I had the same problem. 我有同样的问题。 In my case, we are using a Oracle 11g Express Edition (11.2.0.2.0) and we really need that it runs on WE8MSWIN1252 character set, but I cannot change the character set on installation (it always install with AL32UTF8). 在我的例子中,我们使用的是Oracle 11g Express Edition(11.2.0.2.0),我们确实需要它在WE8MSWIN1252字符集上运行,但我无法在安装时更改字符集(它始终与AL32UTF8一起安装)。

With a Oracle Client 11g installed as Administrator and run only the csscan full=y (check this link https://oracle-base.com/articles/10g/character-set-migration ) and we notice that are lossy and convertible data problems in our database. 以管理员身份安装Oracle Client 11g并仅运行csscan full=y (请查看此链接https://oracle-base.com/articles/10g/character-set-migration ),我们注意到有损和可转换的数据问题在我们的数据库中 But, the problems are with the MDSYS (Oracle Spatial) and APEX_040000 (Oracle Application Express) schemas. 但是,问题在于MDSYS(Oracle Spatial)和APEX_040000(Oracle Application Express)模式。 So, as we dont need this products, we remove them (check this link: http://fast-dba.blogspot.com.br/2014/04/how-to-remove-unwanted-components-from.html ). 因此,由于我们不需要这些产品,我们将其删除(请查看此链接: http//fast-dba.blogspot.com.br/2014/04/how-to-remove-unwanted-components-from.html )。

Then, we export with expdp the users schemas and drop the users (they must be recreated at the end of the process). 然后,我们使用expdp导出用户模式并删除用户(必须在过程结束时重新创建它们)。

Executing csscan again with full=y capture=y , it reports that: The data dictionary can be safely migrated using the CSALTER script . 使用full=y capture=y再次执行csscan,它报告: The data dictionary can be safely migrated using the CSALTER script If the report doesnt have this, the csalter.plb script will not work, because there are some conditions that will not be satisfied: 如果报告没有这个,那么csalter.plb脚本将不起作用,因为有些条件无法满足:

  • changeless for all CHAR VARCHAR2, and LONG data (Data Dictionary and Application Data) 所有CHAR VARCHAR2和LONG数据(数据字典和应用程序数据)都没有变化
  • changeless for all Application Data CLOB 所有Application Data CLOB都没有变化
  • changeless and/or convertible for all Data Dictionary CLOB 所有数据字典CLOB都没有变化和/或可转换

In our case, this conditions were satisfied and we could ran the CSALTER script successfully. 在我们的例子中,这个条件得到满足,我们可以成功运行CSALTER脚本。 Moreover, this script executes the ALTER DATABASE command you are trying to run and it converts the CLOB data of Data Dictionary that is convertible. 此外,此脚本执行您尝试运行的ALTER DATABASE命令,并转换可转换的数据字典的CLOB数据。

Finally, we create the users and the tablespaces of our application and we import the dump of the user data successfully. 最后,我们创建应用程序的用户和表空间,并成功导入用户数据的转储。

I would say that your best option when you want to go to a character set that supports only a subset of the original characters, that your best option is to use exp and imp back (or expdp and impdp). 当你想要一个只支持原始字符子集的字符集时,我会说你最好的选择,你最好的选择是使用exp和imp back(或expdp和impdp)。

Are you sure that no single table will contain any character not found in the 1252 code page ? 您确定没有单个表格会包含1252代码页中找不到的任何字符吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM