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

Home -> Community -> Usenet -> c.d.o.server -> How to grab the output from SQLPlus or Svrmgrl

How to grab the output from SQLPlus or Svrmgrl

From: Norman Dunbar <Norman.Dunbar_at_lfs.co.uk>
Date: Wed, 27 Mar 2002 14:04:53 -0000
Message-ID: <E2F6A70FE45242488C865C3BC1245DA701943483@lnewton.leeds.lfs.co.uk>


Harry,

I'm assuming you want the entire output from the sqlplus/svrmgrl to be displayed in the GUI and not just the exit code, if so, I've seen this done a couple of ways :

sqlplus -S username/password @script.sql >logfile.log

If you have the username and password in the script in a 'connect' then

sqlplus -S /nolog @script.sql >logfile.log

in either case, the file logfile.log can be read and displayed. Just make sure that your script has an 'exit' in it at the end - otherwise sqlplus will sit there and wait for you :o)

(this method will not work with svrmgrl by the way.)

Regards,
Norman,

-----Original Message-----
From: harry [mailto:harry_h_tang_at_yahoo.com] Posted At: Monday, March 25, 2002 7:50 PM Posted To: server
Conversation: How to grab the output from SQLPlus or Svrmgrl Subject: How to grab the output from SQLPlus or Svrmgrl

I tried to write a utility in C++ which needs to take the output from SQLPlus and/or Svrmgrl then present it to GUI. I write code such as:

Assume: GMDBshutdown.sql is a shutdown scrip.

char shutdownDBCmd[] = "svrmgrl @GMDBshutdown"; returnVal = system(shutdownDBCmd);

/* the execution result can be something as:
"ORA-01034: ORACLE not available

ORA-27101: shared memory realm does not exist" or
"Database closed.

Database dismounted.
ORACLE instance shut down."

I want to get the error code and text returned but the above way does not
achieve the goal. Anyone knows how to get the returned text to the code? Received on Wed Mar 27 2002 - 08:04:53 CST

Original text of this message

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