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: Karla, Srini \(HAS-SAT\) <Srini_Karla_at_harcourt.com>
Date: Wed, 9 May 2007 11:10:13 -0500
Message-ID: <A2B00E685298CF4E8D1E5288432D025E0376341C@HASSATEXCP07VA.edu.regn.net>


I didn't test your script but this will fulfill your requirement. See changes in blue bold.    

            while true

            do

            sqlplus -S "/as sysdba" <<EOF >> test.log

            select event,count(*) from v$session group by event;

            exit;

            EOF             sleep 2

            done  

Thanks,

Srini Karla

Sr. Database Administrator,

Harcourt Assessments, Inc.,

San Antonio, TX 78259

210-339-5252 work

210-683-3936 cell


Our Sharepoint: http://hassatappp022/sites/epa/ea/default.aspx


 

-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of
jim.silverman_at_thomson.com
Sent: Wednesday, May 09, 2007 10:50 AM
To: Ajay_Thotangare_at_ml.com; oracle-l_at_freelists.org Subject: RE: Run command on sqlplus repetitively without reconnection.  

How about using "spool filename append" and "spool off" in the body of

your loop? Of course, I'm not sure how you're constructing your loop,

so I'm not sure if this will work or not...


Jim Silverman

Senior Systems Database Administrator

Solucient, LLC - A Thomson Company

Telephone: 734-669-7641

FAX: 734-930-7611 E-Mail: jim.silverman_at_thomson.com             

            From: oracle-l-bounce_at_freelists.org

[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Thotangare, Ajay

(GTI)             Sent: Wednesday, May 09, 2007 11:23 AM

            To: oracle-l_at_freelists.org

            Subject: Run command on sqlplus repetitively without

reconnection.             

            I want to run a command on sqlplus without making

re-connection. At the same time I also want to see the output.

            I can do this using UNIX but only problem is I have to

make reconnection after every interval(which I don't want)

            For e.g I run following script on unix prompt       

#########################################################

            while true

            do

            sqlplus -S "/as sysdba" <<EOF

            select event,count(*) from v$session group by event;

            exit;

            EOF

            sleep 2

            done

      

#########################################################

            I want to achive same functionality without making

reconnection after every 2 secs.

            I tried to use loop,spool file and dbms_lock.sleep() but

spool file does not display output till the procedure is completed

            Can anybody help to achive this functionality ?              

            regards,

            Ajay                           

            If you are not an intended recipient of this e-mail,

please notify the sender, delete it and do not read, act upon, print,

disclose, copy, retain or redistribute it. Click here

<http://www.ml.com/email_terms/> for important additional terms relating

to this e-mail. http://www.ml.com/email_terms/             

--

http://www.freelists.org/webpage/oracle-l

 

 


--
http://www.freelists.org/webpage/oracle-l
Received on Wed May 09 2007 - 11:10:13 CDT

Original text of this message

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