Oracle Database字符集(1)--案例分析

php中文网
发布: 2016-06-07 16:50:19
原创
1072人浏览过

OracleDatabase字符集(1)--案例分析案例分析:一次数据库导出(exp)案例分析1)数据库字符集12:40:37SYS@prodshowparameternlsNAME&n..

oracle database字符集(1)--案例分析

案例分析:

一次数据库导出(exp)案例分析

1)数据库字符集

12:40:37 SYS@ prod>show parameter nls

NAME                                 TYPE        VALUE ------------------------------------ ----------- ------------------------------ nls_language                         string      AMERICAN nls_territory                        string      AMERICA

12:40:49 SYS@ prod>select userenv('language') from dual;

USERENV('LANGUAGE') ---------------------------------------------------- AMERICAN_AMERICA.ZHS16GBK

12:41:15 SYS@ prod>select to_char(nls_charset_id('ZHS16GBK'), 'xxxx') from dual;

TO_CH -----   354

2、导出table(EXP)

[oracle@rh6 exp]$ exp scott/tiger file=emp.dmp indexes=n log=emp.log tables=emp

Export: Release 11.2.0.1.0 - Production on Tue Aug 12 12:43:18 2014

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

Export done in US7ASCII character set and AL16UTF16 NCHAR character set

server uses ZHS16GBK character set (possible charset conversion)

Note: indexes on tables will not be exported

About to export specified tables via Conventional Path ...

. . exporting table                            EMP         14 rows exported

EXP-00091: Exporting questionable statistics.

Export terminated successfully with warnings.

@导出错误

[oracle@rh6 ~]$ oerr exp 00091

00091, 00000, "Exporting questionable statistics." // *Cause:  Export was able export statistics, but the statistics may not be //          usuable. The statistics are questionable because one or more of //          the following happened during export: a row error occurred, client //          character set or NCHARSET does not match with the server, a query //          clause was specified on export, only certain partitions or //          subpartitions were exported, or a fatal error occurred while //          processing a table. // *Action: To export non-questionable statistics, change the client character //          set or NCHARSET to match the server, export with no query clause, //          export complete tables. If desired, import parameters can be //          supplied so that only non-questionable statistics will be imported, //          and all questionable statistics will be recalculated.


3、查看Client字符集

[oracle@rh6 ~]$ echo $LANG

en_US.UTF-8

4、查看导出文件字符集

[oracle@rh6 exp]$ cat emp.dmp |od -x|head -1|awk '{print $2 $3}'|cut -c 3-6

0345

5、通过ultraedit查看导出文件字符集

wKioL1Pp0baCGJ2HAAhiPeqd16Y837.jpg

@从2、3字节来看,,字符集16进制代码为‘0001’


13:36:27 SYS@ prod>select nls_charset_name(to_number('0001','xxxx')) from dual;

NLS_CHARSET_NAME(TO_NUMBER('0001','XXXX' ---------------------------------------- US7ASCII

@‘0001’的字符集为‘US7ASCII',在导出时发生了转换


6、修改客户端字符集

[oracle@rh6 ~]$ cat .bash_profile

export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK 

[oracle@rh6 ~]$ echo $NLS_LANG

AMERICAN_AMERICA.ZHS16GBK

[oracle@rh6 ~]$ echo $LANG

en_US.UTF-8

7、重新导出table(EXP)

最佳 Windows 性能的顶级免费优化软件
最佳 Windows 性能的顶级免费优化软件

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。

下载
相关标签:
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号