Here's one way to do it:

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/[EMAIL PROTECTED];
        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}
}







Jacques Kilchoer <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
 04/03/2003 11:23 AM
 Please respond to ORACLE-L

 
        To:     Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]>
        cc: 
        Subject:        RE: dbshut script - shutdown or shutdown immediate


> -----Original Message----- 
> From: Pardee, Roy E [mailto:[EMAIL PROTECTED] 
> 
> I would 
> have guessed 
> that optimally, you'd try immediate first & then abort if 
> immediate takes 
> too long. 
I've read that some people on the list have done this. I am curious as to 
how this is implemented. 
How long is too long? And how is this coded? I'm trying to think how you 
would write this with shell scripts for example.


-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: 
  INET: [EMAIL PROTECTED]

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: [EMAIL PROTECTED] (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).

Reply via email to