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: Controlling batch SQLPLUS

RE: Controlling batch SQLPLUS

From: <Jared.Still_at_radisys.com>
Date: Thu, 17 Apr 2003 11:37:19 -0800
Message-ID: <F001.005843CD.20030417113719@fatcity.com>


Ron,

Here's some shell script that times out a connection attempt.

You could use something like this to first test the connection.

HTH Jared

OS_USER=jkstill
USERNAME=jkstill
PASSWORD=$(pwc.pl -username $USERNAME -instance $ORACLE_SID)

echo $PASSWORD

unset SQLPATH

# emulating a 10 second shutdown

(

sqlplus -s /nolog <<EOF

        connect $USERNAME/$PASSWORD@$ORACLE_SID;
        exec dbms_lock.sleep(10)

EOF
)&

BG=$!

echo BG: $BG

# we only want to wait 5 seconds for shutdown # we are very impatient

sleep 5

STILL_RUNNING=$(ps -flu${OS_USER}|awk '{print $4}'|grep "^${BG}$") echo STILL_RUNNING: $STILL_RUNNING

[ -z $STILL_RUNNING ] || {

        echo Took too long. You could run shutdown abort here
        ps -flu${OS_USER}
        kill -9 $BG
        ps -flu${OS_USER}

}

"Smith, Ron L." <rlsmith_at_kmg.com>
Sent by: root_at_fatcity.com
 04/17/2003 09:06 AM
 Please respond to ORACLE-L  

        To:     Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com>
        cc: 
        Subject:        RE: Controlling batch SQLPLUS


Wish it were that easy. 7.3.4 and 8.1.7

-----Original Message-----
Sent: Thursday, April 17, 2003 10:42 AM
To: Multiple recipients of list ORACLE-L

Ron,

You didn't specify the version. If it's 9i, then you could use the option LOGON to attempt logon only once.

sqlplus -LOGON user/pass_at_remotedb

If the connection is not successful for whatever reason, the prompt returns.

HTH. Arup
----- Original Message -----
To: "Multiple recipients of list ORACLE-L" <ORACLE-L_at_fatcity.com> Sent: Thursday, April 17, 2003 10:42 AM

> When I try to run a sqlplus in batch against a remote database and the 
> database is down or the password is incorrect, the batch script hangs 
> for

a
> long time. Is there a parameter that can be set to limit or eliminate this
> 'hang time'?
>
> Ron Smith
> If you are not the intended recipient of this e-mail message, any use, 
> distribution or copying of the message is prohibited.  Please let me 
> know immediately by return e-mail if you have received this message by 
> mistake, then delete the e-mail message. Thank you.
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.net
> --
> Author: Smith, Ron L.
>   INET: rlsmith_at_kmg.com
>
> Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
> San Diego, California        -- Mailing list and web hosting services
> ---------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in 
> the message BODY, include a line containing: UNSUB ORACLE-L (or the 
> name of mailing list you want to be removed from).  You may also send 
> the HELP command for other information (like subscribing).
>
>
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Arup Nanda
  INET: orarup_at_hotmail.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the
message BODY, include a line containing: UNSUB ORACLE-L (or the name of
mailing list you want to be removed from).  You may also send the HELP
command for other information (like subscribing).
If you are not the intended recipient of this e-mail message, any use,
distribution or copying of the message is prohibited.  Please let me know
immediately by return e-mail if you have received this message by mistake,
then delete the e-mail message. Thank you.
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Smith, Ron L.
  INET: rlsmith_at_kmg.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L

(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: INET: Jared.Still_at_radisys.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).
Received on Thu Apr 17 2003 - 14:37:19 CDT

Original text of this message

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