SQL scripts not running, possible timeout issue?

I am a novice Unix scripter and need a little advice/help on a script I've written that's causing some problems. We are using Solaris 9 on a Sun box and the script is invoked with the korn shell. I have a two-part question: I wrote a shell script that calls and executes 3 separate sql scripts, each spooling a text file. The first sql script calls an Oracle procedure that takes over 2 hours to run and the other 2 sql scripts take about 15 minutes each (when running them individually).

My first question is that after the procedure is finished (from the first sql script), I do not see any screen output, indicating when the job is complete. I cannot scroll to see the output but rather get a message saying my session is timed out. Is there a command/process I could type to see all the output if a job is timed out? We do have an OS timeout and firewall timeout process but this should occur only after the job is completed.

My other question ties in with the first. The other 2 sql jobs do not run after the 1st is complete. In each sql script, I am exiting the Oracle session and the shell script invokes each sql session one after the other. However, I cannot view the output to see where the process stopped and in looking in the destination directory for which the files should be spooled to, I only see the 1st sql script's file present. I then commented out the 1st sql script and ran the shell and the 2 other files appeared. I use the same exiting logic in each sql script. It appears that the timeout causes the other 2 scripts to not perform but I'm not sure.

I hope this makes sense. Any insight or help would be greatly appreciated.

Thank you,
Eric

When you run any thing from the command line you run the risk of the session, or the connection timing out. And not just from time-outs; for example, a windows telnet session could be abruptly terminated if Windows fails in some way.

First check to see if you have an environment variable TMOUT set. If it is then you could disable the shell timeout by not setting this variable.

Secondly, you can instruct the shell/OS to run a process in the background similar to a daemon process. If you use the command 'nohup' the process will continue to run, even if the shell it was called from exits (or times out). Use the command thus:

nohup <COMMAND> &

The output normally sent to the tty is saved in the file nohup.out, which will be in the directory where you issued the nohup command.

You could be more specific about where you want your messages to go:

nohup <COMMAND> 1>/tmp/error.log 2>&1 &

As to the second part of your question, I assume that the three calls to ORACLE are executed by the same script. If your shell times out, any child processes, like your running script, will be terminated as well, without completing. Using the 'nohup' command should avoid this kind of failure.

Hope this helps

MBB

MMB,

I appologize for the delayed response. I tried nohup and with the first run, the job only produced the first file. That was the procedure that took 2 1/2 hours to run. I checked the log file and I saw 'terminated' in there. Couldn't figure out why that occured. I then modified the shell script to run the longest job last and that seemed to work. All three files ran. I'm not sure why switching the job worked one way over the other but I'm glad it worked.

Thanks for your help,
Eric

Have you confirmed that the final script in the job is actually completing?

The nohup should work, so I can only suppose that the timeout is being initiated by Oracle. The error message 'terminated' is not particularly helpful so I would at least try to get some more information about why the script is failing. This may be tedious, but have you run the script interactively? You may be given more information on the screen. Are there any messages being reported to the console? Any error messages in the Oracle error logs?

I am no expert on Oracle so, sorry, I can't help you further in any depth.

Hope this helps.

MBB