Re: Run command on sqlplus repetitively without reconnection.

  • From: "Radoulov, Dimitre" <cichomitiko@xxxxxxxxx>
  • To: <Ajay_Thotangare@xxxxxx>
  • Date: Wed, 9 May 2007 21:53:39 +0200

} I want to run a command on sqlplus without making re-connection. At the
} same time I also want to see the output. 

With ksh93 (and pdksh, on Linux for example) you can use co-processes:

$ echo $KSH_VERSION
@(#)PD KSH v5.2.14 99/07/13.2

$ sqlplus -s / as sysdba|& 
[1] 31631
$ while :;do
> print -p "select event,count(*) from v\$session group by event;"
> sleep 2
> done &
[2] 31633
$ while :;do
> read -p; echo "$REPLY"
> done 

EVENT                                                              COUNT(*)
---------------------------------------------------------------- ----------
ASM background timer                                                      1
rdbms ipc message                                                        11
smon timer                                                                1
pmon timer                                                                1
Streams AQ: qmn slave idle wait                                           1
class slave wait                                                          1
SQL*Net message to client                                                 1
Streams AQ: waiting for time management or cleanup tasks                  1
Streams AQ: qmn coordinator idle wait                                     1

9 rows selected.


EVENT                                                              COUNT(*)
---------------------------------------------------------------- ----------
ASM background timer                                                      1
rdbms ipc message                                                        11
smon timer                                                                1
pmon timer                                                                1
Streams AQ: qmn slave idle wait                                           1
class slave wait                                                          1
SQL*Net message to client                                                 1
Streams AQ: waiting for time management or cleanup tasks                  1
Streams AQ: qmn coordinator idle wait                                     1

9 rows selected.
[...]


Regards
Dimitre

Other related posts: