下面我们看一下在Little-Endian下的情况是如何的。
3、Little-Endian操作系统
下面我们来试验一下Little-Endian操作系统环境。
[oracle@localhost ~]$ uname -a
Linux localhost.localdomain 2.6.32-431.el6.x86_64 #1 SMP Sun Nov 10 22:19:54 EST 2013 x86_64 x86_64 x86_64 GNU/Linux
在Linux平台上,依然使用不指定NLS_LANG参数进行导出。
[oracle@localhost ~]$ exp \"/ as sysdba\" owner=scott file=scott.dmp
Export: Release 11.2.0.4.0 - Production on Wed Jul 1 18:33:38 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.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 AL32UTF8 character set (possible charset conversion)
About to export specified users ...
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user SCOTT
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user SCOTT
About to export SCOTT's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export SCOTT's tables via Conventional Path ...
. . exporting table BONUS 0 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table DEPT 5 rows exported
EXP-00091: Exporting questionable statistics.
(篇幅原因,有省略……)
Export terminated successfully with warnings.
在未指定NLS_LANG参数的情况下,Oracle选择了US4ASCII字符集作为默认导出方式,进行了AL32UTF8到US4ASCII格式转换。
[oracle@localhost ~]$ cat scott.dmp | od -x | head
0000000 0003 4501 5058 524f 3a54 3156 2e31 3230
0000020 302e 0a30 5344 5359 520a 5355 5245 0a53
0000040 3138 3239 300a 370a 0a32 0a30 0100 6903
0000060 d007 0100 0000 0000 0000 0000 0900 2000
0000100 2020 2020 2020 2020 2020 2020 2020 2020
*
0000140 2020 2020 2020 2020 5720 6465 4a20 6c75
0000160 3120 3120 3a38 3333 333a 2038 3032 3531
0000200 6373 746f 2e74 6d64 0070 0000 0000 0000
0000220 0000 0000 0000 0000 0000 0000 0000 0000
Little Endian和Big EndIan最大的区别在于字符顺序上,如果是Little Endian,起始文件头结构常为xx03的十六进制结构。原来定义的第二、三位,变成了第一、第四位数字。结果依然是0001,对应Little Endian下的US7ASCII字符集合。
下面看一下指定NLS_LANG环境变量方法。
[oracle@localhost ~]$ export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
[oracle@localhost ~]$ exp \"/ as sysdba\" owner=scott file=scott_set.dmp
Export: Release 11.2.0.4.0 - Production on Wed Jul 1 18:35:31 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in AL32UTF8 character set and AL16UTF16 NCHAR character set
About to export specified users ...
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user SCOTT
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user SCOTT
About to export SCOTT's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export SCOTT's tables via Conventional Path ...
. . exporting table BONUS 0 rows exported
(篇幅原因,有省略……)
Export terminated successfully without warnings.
查看文件头信息,对应位置:
[oracle@localhost ~]$ cat scott_set.dmp | od -x | head
0000000 0303 4569 5058 524f 3a54 3156 2e31 3230
0000020 302e 0a30 5344 5359 520a 5355 5245 0a53
0000040 3138 3239 300a 370a 0a32 0a30 6903 6903
0000060 d007 0100 0000 0000 0000 0000 0d00 2000
0000100 2020 2020 2020 2020 2020 2020 2020 2020
*
0000140 2020 2020 2020 2020 5720 6465 4a20 6c75
0000160 3120 3120 3a38 3533 333a 2031 3032 3531
0000200 6373 746f 5f74 6573 2e74 6d64 0070 0000
0000220 0000 0000 0000 0000 0000 0000 0000 0000
对应第一和第四位置上为0x0369,是AL32UTF8字符集类型。
4、结论
使用Exp/Imp在当前的技术环境下,最大的优势是客户端操作模式,虽然也容易引起一些问题。很多操作人员是不被允许直接访问到数据库服务器使用DataPump的。
应该说,DataPump应该是提供给DBA和管理员的大数据规模备份还原、迁移工具。Exp/Imp在开发团队中,特别是中小数据环境下,还有一些适应的空间。使用Exp/Imp过程中,字符集匹配、版本兼容是两个必须注意的问题。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/17203031/viewspace-1721217/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/17203031/viewspace-1721217/