由于行内项目大部分要过XX系统,原有的几套XX系统测试环境已经不足以支撑业务测试需要,因此行内新增加了服务器作为XX系统的测试服务器,新机器采用Aix6.1操作系统、Oracle 11g客户端(现在最低要求11g),数据库服务器为Oracle 10g,行内备份数据采用oracle的exp命令导出文件(正常不会跨版本使用,碰上某些固(er)执(bi)的客户,还是得想点办法)。
1、执行命令备份
exp userid=test/test@orcl file=exp_20161129_bakdata.dmp tables=TBL_RSP_CODE_MAP
报错信息
Export: Release 11.2.0.4.0 - Production on Tue Nov 29 13:55:22 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set
About to export specified tables via Conventional Path ...
EXP-00008: ORACLE error 904 encountered
ORA-00904: "POLTYP": invalid identifier
EXP-00000: Export terminated unsuccessfully
2、查看客户端与服务器端版本版本
[/home/test/Version]which sqlplus
/oracle/product/11.2.0/bin/sqlplus
[/home/test/Version]file /oracle/product/11.2.0/bin/sqlplus
/oracle/product/11.2.0/bin/sqlplus: 64-bit XCOFF executable or object module not stripped
[/home/test/Version]sqlplus bjgfruat/bjgfruat@iccard
SQL*Plus: Release 11.2.0.4.0 Production on Tue Nov 29 13:57:22 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
都是64位,高版本客户端导出低版本服务器的文件的方式存在问题,应该是数据字典有了新增的字段。
3、应用不受影响的情况下,考虑迁移oracle10g的exp到新服务器下。
拷贝Oracle 10g的exp命令到11g的bin路径下,执行备份命令,报错
Export: Release 10.2.0.4.0 - Production on Tue Nov 29 14:14:19 2016
Copyright (c) 1982, 2007, Oracle. All rights reserved.
EXP-00056:
EXP-00000: Export terminated unsuccessfully
有些命令不依赖其他文件的可以直接拷贝,比如系统命令telnet等。
4、迁移10g的exp
思路:应用环境下执行exp时指向到10g的exp,应用及其他命令仍使用11g。
创建10g路径,将对应文件放入文件夹下
$ ls -ltr /oracle/product/10.2.0/bin
total 46544
-rwxr-x--x 1 oracle dba 23826819 Nov 29 10:04 exp
$ ls -ltr /oracle/product/10.2.0/network/admin
total 8
-rw-r--r-- 1 oracle dba 180 Nov 29 10:07 tnsnames.ora
tnsnames.ora配置数据库服务器的地址和sid
5、执行exp命令后仍然报错
Message 206 not found; No message file for product=RDBMS, facility=EXP: Release 10.2.0.4.0 - Production on Tue Nov 29 14:28:18 2016
Copyright (c) 1982, 2007, Orac
Invalid format of Export utility name
Verify that ORACLE_HOME is properly set
Export terminated unsuccessfully
EXP-00000: Message 0 not found; No message file for product=RDBMS, facility=EXP
6、使用truss命令跟踪执行exp执行过程
kopen("/oracle/product/10.2.0/rdbms/mesg/oraus.msb", O_RDONLY) Err#2 ENOENT
kopen("/oracle/product/10.2.0/rdbms/mesg/oraus.msb", O_RDONLY) Err#2 ENOENT
迁移10g服务器上的文件oraus.msb,多次truss命令跟踪并处理错误后,无报错信息,可以正常使用exp命令。
7、应用用户sbin目录下编写脚本exp,内容
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0
export PATH=$ORACLE_HOME/bin:$PATH
exp $*
8、将exp命令指向到sbin下的exp,环境变量增加(修改.profile。可以在该文件中将第7步的内容写入alias中,不过会使环境变量改变,启动应用服务时就可能会出问题)
alias exp='$HOME/ncup/sbin/exp'