【故障处理】IMP-00010错误 12C的dmp文件导入11G
各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识,~O(∩_∩)O~:
① 12C的dmp文件导入11g数据库
② IMP-00010: not a valid export file, header failed verification错误解决一例
③ 软件PilotEdit Lite的使用
④ 从dmp文件头获取导出的版本、时间、用户
⑤ 查看dmp文件的字符集
Tips:
① 本文在itpub(http://blog.itpub.net/26736162)、博客园(http://www.cnblogs.com/lhrbest)和微信公众号(xiaomaimiaolhr)上有同步更新。
② 文章中用到的所有代码、相关软件、相关资料及本文的pdf版本都请前往小麦苗的云盘下载,小麦苗的云盘地址见:http://blog.itpub.net/26736162/viewspace-1624453/。
③ 若网页文章代码格式有错乱,请下载pdf格式的文档来阅读。
④ 在本篇BLOG中,代码输出部分一般放在一行一列的表格中。其中,需要特别关注的地方我都用灰色背景和粉红色字体来表示,比如在下边的例子中,thread 1的最大归档日志号为33,thread 2的最大归档日志号为43是需要特别关注的地方;而命令一般使用黄色背景和红色字体标注;对代码或代码输出部分的注释一般采用蓝色字体表示。
List of Archived Logs in backup set 11 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- ------------------- ---------- --------- 1 32 1621589 2015-05-29 11:09:52 1625242 2015-05-29 11:15:48 1 33 1625242 2015-05-29 11:15:48 1625293 2015-05-29 11:15:58 2 42 1613951 2015-05-29 10:41:18 1625245 2015-05-29 11:15:49 2 43 1625245 2015-05-29 11:15:49 1625253 2015-05-29 11:15:53 [ZHLHRDB1:root]:/>lsvg -o T_XLHRD_APP1_vg rootvg [ZHLHRDB1:root]:/> 00:27:22 SQL> alter tablespace idxtbs read write; ====》2097152*512/1024/1024/1024=1G |
本文如有错误或不完善的地方请大家多多指正,ITPUB留言或QQ皆可,您的批评指正是我写作的最大动力。
今天客户给了一个ash的dmp文件,需要分析一下,结果导入数据库的时候发生了IMP-00010: not a valid export file, header failed verification的错误,我用软件PilotEdit Lite打开的时候发现原来导出文件使用的是12C的客户端,而我手头没有12c的客户端,于是将文件头修改为TEXPORT:V11.02.00,然后即可顺利导入了数据库,下面给出详细过程。
D:\Users\xiaomaimiao>imp 'sys/[email protected]/oratest as sysdba' full=y file="E:\ash_20161108.dmp\ash_20161108.dmp"
Import: Release 11.2.0.1.0 - Production on Wed Nov 9 11:26:05 2016
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options
IMP-00010: not a valid export file, header failed verification IMP-00000: Import terminated unsuccessfully |
使用软件PilotEdit Lite打开(此软件可以打开上G的文件):
修改为如下的形式:
重新导入数据库:
D:\Users\xiaomaimiao>imp 'sys/[email protected]/oratest as sysdba' full=y file="E:\ash_20161108.dmp\ash_20161108_01.dmp"
Import: Release 11.2.0.1.0 - Production on Wed Nov 9 11:28:24 2016
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export file created by EXPORT:V11.02.00 via conventional path import done in ZHS16GBK character set and AL16UTF16 NCHAR character set export client uses US7ASCII character set (possible charset conversion) . importing SYS's objects into SYS . importing SYS's objects into SYS . . importing table "ASH_20161108" 29394 rows imported Import terminated successfully without warnings. |
其实之前在文章http://blog.itpub.net/26736162/viewspace-2122942/中已经介绍过这部分的内容,今天把这部分内容重新拷贝过来,因为实在太有用了。
[ZFZHLHRDB1:oracle]:/tmp>strings exp_ddl_lhr_02.dmp | head -10 TEXPORT:V11.02.00 ====》版本号 DSYS ====》使用SYS用户导出 RTABLES ====》基于表模式导出,RUSERS表示基于用户模式,RENTIRE表示基于全库模式 4096 Tue Aug 2 16:8:8 2016/tmp/exp_ddl_lhr_02.dmp====》生成的时间和文件地址 #C#G #C#G +00:00 BYTE UNUSED |
[ZFZHLHRDB1:oracle]:/tmp>strings exp_ddl_lhr_02.dmp | grep "CREATE TABLE"|awk '{print $3}'|sed 's/"//g' EMP ====》说明exp_ddl_lhr_02.dmp中只有一个emp表 |
[ZFZHLHRDB1:oracle]:/tmp>strings exp_ddl_lhr_03.dmp | grep "CREATE TABLE"|awk '{print 3}'|sed 's/"//g'|awk '{ if (FNR==1) print "tables="3}'|sed 's/"//g'|awk '{ if (FNR==1) print "tables=" 1 ; else print ","$1 }' tables=DEF$_AQCALL ,DEF$_AQERROR ,DEF$_CALLDEST ,DEF$_DEFAULTDEST ,DEF$_DESTINATION ,DEF$_ERROR ,DEF$_LOB ,DEF$_ORIGIN ,DEF$_PROPAGATOR ,DEF$_PUSHED_TRANSACTIONS ,MVIEW$_ADV_INDEX [ZFZHLHRDB1:oracle]:/tmp> |
其实这个可以使用UE或editplus文本编辑器的列模式实现也很快。
[ZFZHLHRDB1:oracle]:/oracle>ORACLE_SID=lhrdb [ZFZHLHRDB1:oracle]:/oracle>exp \'/ AS SYSDBA\' tables=scott.emp file=/tmp/exp_ddl_lhr_03.dmp log=/tmp/exp_table.log buffer=41943040 rows=n compress=n
Export: Release 11.2.0.4.0 - Production on Tue Oct 25 17:14:49 2016
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, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Tes Export done in AL32UTF8 character set and AL16UTF16 NCHAR character set<<<<--当前环境下NLS_LANG的设置 server uses ZHS16GBK character set (possible charset conversion)<<<<--当前数据库的字符集 Note: table data (rows) will not be exported
About to export specified tables via Conventional Path ... Current user changed to SCOTT . . exporting table EMP EXP-00091: Exporting questionable statistics. EXP-00091: Exporting questionable statistics. Export terminated successfully with warnings.
[ZFZHLHRDB1:oracle]:/oracle>ORACLE_SID=mydb [ZFZHLHRDB1:oracle]:/oracle>export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK [ZFZHLHRDB1:oracle]:/oracle>imp \'/ AS SYSDBA\' tables=xxx.xx file=/tmp/exp_ddl_lhr_03.dmp
Import: Release 11.2.0.4.0 - Production on Tue Oct 25 17:21:02 2016
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, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Tes
Export file created by EXPORT:V11.02.00 via conventional path import done in ZHS16GBK character set and AL16UTF16 NCHAR character set<<<<--当前环境的NLS_LANG import server uses WE8ISO8859P1 character set (possible charset conversion)<<<<--当前数据库的字符集 export client uses AL32UTF8 character set (possible charset conversion)<<<<--当前dmp文件的字符集 IMP-00029: cannot qualify table name by owner (xxx.xx), use FROMUSER parameter IMP-00000: Import terminated unsuccessfully |
用Oracle的exp工具导出的dmp文件包含了字符集的信息,dmp文件的第2和第3个字节记录了dmp文件的字符集的信息。若dmp文件比较小,比如只有几M或几十M,可以用UltraEdit或Editplus以16进制的方式打开,查看第2和第3个字节的内容。
将刚导出的文件/tmp/exp_ddl_lhr_02.dmp下载到Windows环境下,用UE或editplus打开。
可以看到第2第3个字节的内容是0354,用如下的SQL语句可以查出它对应的字符集:
SYS@lhrdb> SELECT NLS_CHARSET_NAME(TO_NUMBER('0354','XXXX')) FROM DUAL; NLS_CHARSET_NAME(TO_NUMBER('0354','XXXX' ---------------------------------------- ZHS16GBK |
如果dmp文件很大,比如有2G以上(这也是最常见的情况),用文本编辑器打开很慢或者完全打不开,可以用以下命令(在unix主机上):
cat /tmp/exp_ddl_lhr_02.dmp |od -x|head -1|awk '{print 2 2 3}'|cut -c 3-6 |
然后用上述SQL也可以得到它对应的字符集。
[ZFZHLHRDB1:oracle]:/oracle>cat /tmp/exp_ddl_lhr_02.dmp |od -x|head -1|awk '{print 2 2 3}'|cut -c 3-6 0354 |
About Me
............................................................................................................................... ● 本文作者:小麦苗,只专注于数据库的技术,更注重技术的运用 ● 本文在itpub(http://blog.itpub.net/26736162)、博客园(http://www.cnblogs.com/lhrbest)和个人微信公众号(xiaomaimiaolhr)上有同步更新 ● 本文itpub地址:http://blog.itpub.net/26736162/viewspace-2128197/ ● 本文博客园地址:http://www.cnblogs.com/lhrbest/p/6048307.html ● 本文pdf版及小麦苗云盘地址:http://blog.itpub.net/26736162/viewspace-1624453/ ● QQ群:230161599 微信群:私聊 ● 联系我请加QQ好友(642808185),注明添加缘由 ● 于 2016-11-09 19:00 ~ 2016-11-09 22:00 在中行完成 ● 文章内容来源于小麦苗的学习笔记,部分整理自网络,若有侵权或不当之处还请谅解 ● 版权所有,欢迎分享本文,转载请保留出处 ............................................................................................................................... 手机长按下图识别二维码或微信客户端扫描下边的二维码来关注小麦苗的微信公众号:xiaomaimiaolhr,免费学习最实用的数据库技术。 |
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26736162/viewspace-2128197/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/26736162/viewspace-2128197/