dplinnane
asked on
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_bi nds(2000)'
0 [oracle@linux3 scripts]$ sqlplus_proc_in1.sh 'simulate_workload_with_bi nds(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"
[oracle@linux3 scripts]$ sqlplus_proc_in1.sh 'simulate_workload_with_bi
0 [oracle@linux3 scripts]$ sqlplus_proc_in1.sh 'simulate_workload_with_bi
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"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
excellent I was so close Thanks
ASKER
Just a quick question.
What is the difference between sessions and threads? are they the same?
What is the difference between sessions and threads? are they the same?
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.
To submit it in background use this
$ORACLE_HOME/bin/sqlplus -s admin/limk1234 <<EOF