KSH script SQL timeout issue


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting KSH script SQL timeout issue
# 1  
Old 05-12-2009
KSH script SQL timeout issue

Hi all,

I have a KSH script which is kicking off an sql scripts as follows:

Code:
/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 something along the lines of too many simultaneous logins (this is a shared account and unfortunately I don't administer the Oracle database).

My scripts then sits there for ages until, and I guessing a bit here, some kind of Oracle timeout kicks in.

Is there a way that I can alter my KSH script to only wait say 10 mins for a result, and if it doesn't get one then just exit from the sql query and continue to the next part of my script, or better still attempt the sql query again in another 10 mins?

Many thanks in advance!!!
# 2  
Old 05-12-2009
Not very nice, but you could try and start a child process that sleeps for 10 minutes and then sends a kill signal to its parent. Probably better would be to use a Perl database interface to attempt to make the connection, and only when that's good, to send the SQL and retrieve the results, although this may still suffer from a login jam!
# 3  
Old 05-15-2009
thanks for your response, I think I might have to go for an option like that. As you say not nice but what can I do?! :-)
# 4  
Old 05-15-2009
I would give more emphais on the contents of sql_query.sql . Does it have any commit; rollback statements. Why do you think the script sometimes take a long time. Does it keep waiting for a transactions to commit; May be you should check the other process, locking etc?
# 5  
Old 05-15-2009
Quote:
Originally Posted by Donkey25
...The problem I have is that sometimes the 10g Oracle Database spits out an error saying something along the lines of too many simultaneous logins (this is a shared account and unfortunately I don't administer the Oracle database).
...
What's the exact "ORA-" error message thrown by Oracle 10g in such cases ?

tyler_durden
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Oracle/SQLPlus help - ksh Script calling .sql file not 'pausing' at ACCEPT, can't figure out why

Hi, I am trying to write a script that calls an Oracle SQL file who in turns call another SQL file. This same SQL file has to be run against the same database but using different username and password at each loop. The first SQL file is basically a connection test and it is supposed to sort... (2 Replies)
Discussion started by: newbie_01
2 Replies

2. Shell Programming and Scripting

Issue with SQL UNIX shell script -

Hi all I am writing a shell script which will run a select query from a table . If the ouput is not 500 - then send a email to the team saying there is a error . But i am not sure how to redirect this output of the select query to the log file - #!/bin/ksh sqlplus /nolog conect... (1 Reply)
Discussion started by: honey26
1 Replies

3. Shell Programming and Scripting

how to Connect from ksh script to SQL server

I need to connect sql server 2008 from korn shell script. Can you please give me the script which connects sql server 2008 from korn shell script. (2 Replies)
Discussion started by: santoshhegde
2 Replies

4. Shell Programming and Scripting

command timeout in ksh

I probably read all the threads in almost all the forums for a solution to my need. I am a beginner in shell scripting and I dont have a perfect solution yet. Below is my code snippet. idql -n $REPOSITORY_NAME.$cs -Udmadmin -P"" -R$DM_SCRIPTS/test.api > /dev/null 2>&1 if ; then echo... (7 Replies)
Discussion started by: vishnudev1
7 Replies

5. Shell Programming and Scripting

Calling SQL script from ksh job and send mail on some error.

Hi, I am trying to call sql script from ksh job with parameters.The parameters passed from ksh job will be used in SELECT query in sql file to SPOOL the data in extract file.My questions are: 1) How to call a sql script from ksh job with parameters? 2) How to use the parameter in sql file to... (1 Reply)
Discussion started by: anil029
1 Replies

6. Shell Programming and Scripting

How to call an sql script inside a while statement in KSH

Hi all, I'm trying to run an sql inside a loop which looks like this #!bin/ksh while IFS=, read var1 var2 do sqlplus -s ${USERNAME}/${PASSWORD}@${ORACLE_SID} << EOF insert into ${TABLE} ( appt_date ) values ( '${var1 }' ); ... (6 Replies)
Discussion started by: ryukishin_17
6 Replies

7. Shell Programming and Scripting

what is the uses in sql script in ksh

hi, iam new of unix. how to call sql script in ksh script (1 Reply)
Discussion started by: naveeng.81
1 Replies

8. UNIX for Dummies Questions & Answers

SQL Script run in KSH Script

I've got a SQL script that is executed through a UNIX ksh script. It is working fine, but I wanted to add a line to put a date/time stamp in the log file that it generates. This is more of a SQL question, but I'm hoping someone can help me get the date/time...I've changed the script with the... (2 Replies)
Discussion started by: dstinsman
2 Replies

9. Shell Programming and Scripting

ksh read timeout

any idea on how to timeout the read statement for ksh? for bash u can use read -t option -t timeout Cause read to time out and return failure if a complete line of input is not read within timeout seconds. This option has ... (2 Replies)
Discussion started by: ashterix
2 Replies

10. Shell Programming and Scripting

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,... (3 Replies)
Discussion started by: E2004
3 Replies
Login or Register to Ask a Question