exp匯出操作結果判斷

iteye_20954發表於2011-12-15
在日常的匯出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-


相關文章