Staring multiple sqlplus sessions from a shell script

I wrote the following shell script to start multiple sqplus sessions running the same procedure. But is running one procedure after the other and not creating a new session, how do I make my script creat a new session? Thanks in advance.
 [oracle@linux3 scripts]$ sqlplus_proc_in1.sh 'simulate_workload_with_binds(2000)'

0 [oracle@linux3 scripts]$ sqlplus_proc_in1.sh 'simulate_workload_with_binds(2000)'
Enter the number of sessions
3

PL/SQL procedure successfully completed.

0
PL/SQL procedure successfully completed.

1
PL/SQL procedure successfully completed.



#!/bin/ksh

echo "Enter the number of sessions"
read session

num=0                   # Initialize num
while (( $num < $session ))   # or  while [ num -lt 10 ]
do

#if exit; is not here there will be no result printed to the screen
$ORACLE_HOME/bin/sqlplus -s admin/limk1234 <<EOF
begin
$1;
end;
/

EOF
      echo  -n "$num "
      let num+=1           # Increment num
done
exit;
echo -e "\nAfter loop exits, continue running here"
dplinnaneAsked:
Who is Participating?
 
amit_gCommented:
Change

$ORACLE_HOME/bin/sqlplus -s admin/limk1234 <<EOF

to

$ORACLE_HOME/bin/sqlplus -s admin/limk1234 <<EOF &
0
 
sathyagiriCommented:
You will need to submit your sqlplus sessions as a background process or you will need to spawn a child process

To submit it in background use this
$ORACLE_HOME/bin/sqlplus -s admin/limk1234 <<EOF
0
 
sathyagiriCommented:
Oops missed the &
$ORACLE_HOME/bin/sqlplus -s admin/limk1234 <<EOF &
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
dplinnaneAuthor Commented:
excellent I was so close Thanks
0
 
dplinnaneAuthor Commented:
Just a quick question.
What is the difference between sessions and threads? are they the same?  
0
 
amit_gCommented:
Session could mean different things in different context. Generally session refers to a shell instance in the context you probably are asking. Thread is a subunit in a process. A process could have multiple threads.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.