Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Run command on sqlplus repetitively without reconnection.

Re: Run command on sqlplus repetitively without reconnection.

From: Radoulov, Dimitre <cichomitiko_at_gmail.com>
Date: Wed, 9 May 2007 21:53:39 +0200
Message-ID: <00c501c79273$bf34c770$3d08310a@ETP6320>


} 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

--
http://www.freelists.org/webpage/oracle-l
Received on Wed May 09 2007 - 14:53:39 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US