SQL scripts not running, possible timeout issue?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting SQL scripts not running, possible timeout issue?
# 1  
Old 07-07-2005
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
# 2  
Old 07-08-2005
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
# 3  
Old 07-14-2005
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
# 4  
Old 07-14-2005
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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Primary key issue when running Oracle sql file

I got a issue with running the following script below if I remove the inserts and alter table the tables will install just fine but if I try and do the full thing in one go i get the below error dose any one have any ideas on this problem? its got me spinning, thanks. REM REM List of... (1 Reply)
Discussion started by: Wpgn
1 Replies

2. Shell Programming and Scripting

Issue with quotes when running SQL command from within su -c

RHEL 6.2/Bash shell root user will be executing the below script. It switches to oracle user logs in using sqlplus and tries to run the below UPDATE statement. All the commands after su -c are enclosed in a single quote delimited by semicolon. The execution has failed because the quotes... (3 Replies)
Discussion started by: omega3
3 Replies

3. Shell Programming and Scripting

Issue with SUNOS running sed scripts

Hi I probably dont have GNU extended sed in my SUNOS . and its creating lot of problems ex: a simple sed command like this is not working sed '/WORD/ a\ sample text line 1 \ sample text line 1 ' filename sed: command garbled: /WORD/ a I took precaution to have a new line after... (11 Replies)
Discussion started by: vash
11 Replies

4. Shell Programming and Scripting

Issue in SQL Loader scripts

Hi, I'm planning to load the data from FLAT files into tables. Source file: more input.txt LRNO|Bale|Horsepower|NumberOfBarges|BollardPull|NumberOfCars|GasCapacity|GrainCapacity|IndicatedHorsepower|LiquidCapacity|... (6 Replies)
Discussion started by: shyamu544
6 Replies

5. Shell Programming and Scripting

[Solved] Running scripts in parallel that issue prompt

Hi all - I am totally stuck here :wall I have been asked to write a shell script that does a few little things and then reads from a config file and kicks off an instance of another script, say scriptB.ksh for each line in the config file. These should all be run in parallel. This is all fine but... (2 Replies)
Discussion started by: sjmolloy
2 Replies

6. UNIX for Advanced & Expert Users

Call parallel sql scripts from shell and return status when both sql are done

Hi Experts: I have a shell script that's kicked off by cron. Inside this shell script, I need to kick off two or more oracle sql scripts to process different groups of tables. And when both sql scripts are done, I will continue in the shell script to do other things like checking processing... (3 Replies)
Discussion started by: huasheng8
3 Replies

7. Shell Programming and Scripting

KSH script SQL timeout issue

Hi all, I have a KSH script which is kicking off an sql scripts as follows: /usr/local/installs/instantclient_10_2/sqlplus -s username/password @$sql_path/sql_query.sql > $tmp_path/sql_query_results The problem I have is that sometimes the 10g Oracle Database spits out an error saying... (4 Replies)
Discussion started by: Donkey25
4 Replies

8. Shell Programming and Scripting

How should I add a timeout to my scripts?

I am running several tcsh scripts in the crontab of my workstation for acquiring, processing and visualizing data. Some of the quicklooks generated by these scripts are automatically copied to an intranet page. However, I just found out that I have currently about 50 (old) scripts still running... (1 Reply)
Discussion started by: SharkM
1 Replies

9. Shell Programming and Scripting

Running Sql scripts accross db2

Hi, I would be really thankful, if anyone could help me out with this,since i am very new to this shell scripting. I have 6 sql scripts that i am trying to run in unix across db2. i want the scripts to be executed as follows, script_1 should be executed first. Then... (4 Replies)
Discussion started by: jnimz
4 Replies

10. Shell Programming and Scripting

Running SQL Scripts from Shell script - Need insight!

I've a script that fetches various values from the database as below: #! /bin/ksh $conn="user/pwd@service_name" `sqlplus -s << $conn EOF1 @xyz.sql @pqr.sql @abc.sql EOF1` The output of the script should generate txt files containing the results from queries which are further... (6 Replies)
Discussion started by: manthasirisha
6 Replies
Login or Register to Ask a Question