We are using CA Workload Control Center (Autosys) to run a windows batch file which calls another batch file which calls SQLPlus with the following:

sqlplus username/password %1 %2 %3

Since this is all being done remotely I cannot see what is actually happening on the server.

I am wondering if the sqlplus file exists but has invalid syntax (like referring to non-existent table) will the sqlplus prompt exit and return back to the batch file?

The reason I ask is because I am looking at the log file from Autosys and it shows that SQLPlus call was made, it prints out ERROR AT LINE 2: Invalid Table, but then it does not show any other activity with the batch script after that where there are multiple echoes and file copies etc. It seems as though it is not exiting SQLPlus perhaps?

Is there a parm I need to pass to SQLPlus to tell it to exit SQLPlus and return back to the calling script after running a SQL script if it fails?

Edit: We are using "WHENEVER SQL ERROR" inside of our SQL files as well and the log file does show this:

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

But I am still expecting that it should continue with the rest of the Batch script but its not, above is the last that Autosys shows in the log

有帮助吗?

解决方案 2

Found the solution SO Post:

You can do sqlplus -l test/Test@mydatabase @script.sql; the -l flag means it will only try to connect once, and if it fails for any reason will exit instead of prompting. Look at the output of sqlplus -?, or see the documentation.

其他提示

See SQLPlus instruction WHENEVER SQLERROR, it describes in Oracle docs:

http://docs.oracle.com/cd/B19306_01/server.102/b14357/ch12052.htm

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top