exp导出操作结果判断

在日常的导出exp操作中,在自动的计划操作脚本中执行命令,有时候需要判断导出操作是否成功执行,以便做下一步的操作,这个时候就需要获取得到exp操作的结果返回值了,对此,oracle提供了3个返回值:
操作结果                                                    返回值
Export terminated successfully without warnings EX_SUCC     0
Export terminated successfully with warnings    EX_OKWARN   linux 0 win 3
Export terminated unsuccessfully                EX_FAIL     1
下面针对linux和win平台进行测试下。
0. linux平台测试
0.0. EX_SUCC
[oracle@localhost ~]$ exp gtlions/gtlions tables=test

Export: Release 10.2.0.4.0 - Production on Thu Dec 15 11:01:43 2011

Copyright (c) 1982, 2007, Oracle.  All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 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 ...
. . exporting table                           TEST          1 rows exported
Export terminated successfully without warnings.
[oracle@localhost ~]$ echo $?
0
0.1. EX_OKWARN
[oracle@localhost ~]$ exp gtlions/gtlions tables=test1,test5

Export: Release 10.2.0.4.0 - Production on Thu Dec 15 10:53:20 2011

Copyright (c) 1982, 2007, Oracle.  All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 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-00011: GTLIONS.TEST1 does not exist
EXP-00011: GTLIONS.TEST5 does not exist
Export terminated successfully with warnings.
[oracle@localhost ~]$ echo $?
0
0.2. EX_FAIL
[oracle@localhost ~]$ exp gtlions/gtlions tables=test1,test5 full=y

Export: Release 10.2.0.4.0 - Production on Thu Dec 15 10:53:35 2011

Copyright (c) 1982, 2007, Oracle.  All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
EXP-00026: conflicting modes specified
EXP-00000: Export terminated unsuccessfully
[oracle@localhost ~]$ echo $?
1
1. win平台
1.0. EX_SUCC
D:\>exp gtlions/gtlions@test2.4 tables=test

Export: Release 10.2.0.1.0 - Production on 星期四 12月 15 11:05:16 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.


连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
已导出 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集

即将导出指定的表通过常规路径...
. . 正在导出表                            TEST导出了           1 行
成功终止导出, 没有出现警告。

D:\>echo %errorlevel%
0
1.1. EX_OKWARN
D:\>exp gtlions/gtlions@test2.4 tables=test,test5

Export: Release 10.2.0.1.0 - Production on 星期四 12月 15 11:05:40 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.


连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
已导出 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集

即将导出指定的表通过常规路径...
. . 正在导出表                            TEST导出了           1 行
EXP-00011: GTLIONS.TEST5 不存在
导出成功终止, 但出现警告。

D:\>echo %errorlevel%
3
1.2. EX_FAIL  
D:\>exp gtlions/gtlions@test2.4 tables=test full=y

Export: Release 10.2.0.1.0 - Production on 星期四 12月 15 11:05:56 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.


连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
EXP-00026: 指定了冲突模式
EXP-00000: 导出终止失败

D:\>echo %errorlevel%
1
-The End-


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值