Control not returning to UNIX when sqlplus is executed in while loop of shell script
Hi All,
I have observed some of the scripts gets stuck because sqlplus session is not completing it's session. This behavior is intermittent. I will give one of the scenario. Below is the code which executes one sql query.
below is the unix session.
pwlm 8297 8290 0 00:16 ? 00:00:03 /bin/ksh -a /opt/XWLMLL02
pwlm 29121 8297 0 00:32 ? 00:00:00 sqlplus -s
The script has run a process internally and above code part is to monitor whether the process is completed. Even though the process is completed, the script has not moved further from this point. Upon checking further, I have seen one active sqlplus session. I suspect that the sqlplus session is from the above code and it is somehow stuck in turn the script has stuck.
I have observed this similar issue 3 times till now in the past 7 days. But, it is for different scripts. The logic remains the same.
This script was working fine in our old infrastructure where there was AIX server. We have not at all faced this issue over there.
Anyone, could help me to resolve the issue?
Thanks in Advance.
Last edited by preetham30; 04-15-2020 at 10:23 AM..
Start with only the sql, run it from the sqlplus prompt.
Next wrap JUST the sql that ran above in a shell wrapper. Execute it. Use the parameter associated with the problem.
One thing I've seen that causes hangs is the sqlplus gets what it thinks is garbage, usually caused by trying to quote or escape something so the shell will not wreck it, and passing it through the shell script to sqlplus. sqlpus hangs because it is waiting for more input, like to complete the quote for example.
As a first guess consider this is your problem, especially since it is intermittent. Intermittent == parameter problems
The issue is confirmed with the below
I have added exit at the end of the sqlplus. Still, it didn't help. I am just wondering why we face the issue intermittently. This block of the code is executed by all the scripts. 50+ scripts. Internally, it calls the sqlplus block to execute. I think that sqlplus is executed for much much more than thousands and out of those once it gets stuck. I have faced this issue today as well. Still not able to fix the issue.
Hello All,
I have exactly same issue @vikas_trl had in following link:
https://www.unix.com/shell-programming-and-scripting/259854-control-not-returning-sqlplus-calling-unix-shell-script.html
I wonder if he or somebody else could find the issue's cause or the solution.
Any help would... (4 Replies)
Hello All,
I have a UNIX script which will prepare anonymous oracle pl/sql block in a temporary file in run time and passes this file to sqlplus as given below.
cat > $v_Input_File 2>>$v_Log << EOF
BEGIN
EXECUTE IMMEDIATE 'ALTER SESSION FORCE PARALLEL DML PARALLEL 16';
EXECUTE... (1 Reply)
Hi All,
My program flow is as below
Windows batch -- > Cygwin batch --> zsh script
There are multiple Cygwin batch scripts that are called from Windows batch file . But when i am executing the first cygwin batch script the control goes to the zsh file and executes and stoping from... (1 Reply)
I want to execute a shell script from sqlplus prompt and get its output back to sqlplus. Is this possible?
if yes just give me an example for doing that. (2 Replies)
Hi,
I need help urgently for following issue. Pls help me to resolve this issue.
I am calling sql script file(file1.sql) from UNIX Shell Script(script1.ksh) using sql plus and trying to create flat file that contains all records returned from SQL query in SQL script(file1.sql)
I given... (6 Replies)
Hi all, i'm pritty new to chell scripting
I'm trying to find a way to return a value to shell without it executing. is there a special character that will encase a sting including the command to a shell without executing, so waiting for the user to press enter.
say i wanted to return a value... (3 Replies)
Hi,
I'm having a requirement where I need to call a C program from a shell script and return the value from the C program to shell script.
I refered a thread in this forum. But using that command in the code, it is throwing an error
clear_text_password=$(get_password)
Error: bash:... (24 Replies)
I have wrriten a script to call sql script to do some work in database. However, the script couldn't be executed. The only information was: ksh: ./updt_attrib.ksh cannot execute. Please help me to identify where the problem is. I post script here for your reference. Thanks a lot.
#!/bin/ksh
... (8 Replies)
Hi,
Iam calling a C program from a Unix shell script. The (C) program reads encrypted username/password from a text file , decrypts and returns the decrypted string.
Is there any way i can return the decrypted string to Unix shell program.
My shell script uses the output of the program to... (11 Replies)