Linux安全网 - Linux操作系统_Linux 命令_Linux教程_Linux黑客

绿色网站无广告
会员投稿 投稿指南 本期推荐:
搜索:
您的位置: Linux安全网 > Linux编程 > 数据库管理 > » 正文

exp导出操作结果判断

来源: gtlions 分享至:
在日常的导出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@linuxso.com ~]$ 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@linuxso.com ~]$ echo $?
0
0.1. EX_OKWARN
[oracle@linuxso.com ~]$ 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@linuxso.com ~]$ echo $?
0
0.2. EX_FAIL
[oracle@linuxso.com ~]$ 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@linuxso.com ~]$ 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-



Tags:
分享至:
最新图文资讯
1 2 3 4 5 6
验证码:点击我更换图片 理智评论文明上网,拒绝恶意谩骂 用户名:
关于我们 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 发展历史