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: Unix Script --- Archive Log Destination Issue

RE: Unix Script --- Archive Log Destination Issue

From: <Brian_P_MacLean_at_efunds.com>
Date: Tue, 14 May 2002 08:43:54 -0800
Message-ID: <F001.0046023D.20020514084354@fatcity.com>

I have found doing a "ps" command for your job name alone is just asking for a world of pain, and very very unreliable for reasons that I will not go into here. I like to create a lock file as the following ksh example illustrates:

JOB_LOCK="/tmp/${0##*/}"
if [ -f ${JOB_LOCK} ]
then
  cat ${JOB_LOCK} | read v_LOCK_PID
  echo "Found job lock pid ${v_LOCK_PID}"   if ps -ef | grep " ${v_LOCK_PID} " | grep -v grep | grep ${0##*/}
>/dev/null

  then
    echo "Job lock pid ${v_LOCK_PID} is running"     exit
  fi
  echo "Job lock pid ${v_LOCK_PID} not found, removing old job lock"   rm ${JOB_LOCK}
fi
v_LOCK_PID=${$}
echo "${v_LOCK_PID}" >${JOB_LOCK}
echo "Created job file lock"

.
.the rest of your script goes here
.

rm ${JOB_LOCK}

PS: I'm looking for a new TV, think you could get me a deal at BestBuy with your employee discount?

Brian P. MacLean
Oracle DBA, OCP8i

                                                                                                                                          
                      "Reddy, Madhusudana"                                                                                                
                      <Madhusudana.Reddy_at_b        To:       Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com>                   
                      estbuy.com>                 cc:                                                                                     
                      Sent by:                    Subject:  RE: Unix Script --- Archive Log Destination Issue                             
                      root_at_fatcity.com                                                                                                    
                                                                                                                                          
                                                                                                                                          
                      05/13/02 10:48 AM                                                                                                   
                      Please respond to                                                                                                   
                      ORACLE-L                                                                                                            
                                                                                                                                          
                                                                                                                                          




My mistake , this new script is only working sometimes. Which is scheduled every hour , but not working at all the hour changes .

-----Original Message-----
Sent: Monday, May 13, 2002 11:28 AM
To: Multiple recipients of list ORACLE-L

Hello All,
I have a script, which cleans up the archive log destination by moving the old archive logs to a retention area based on the thresholds 1. Percent of space utilization
2. greater than 2 days old.

The script was working fine , except for the reason , sometimes we see multiple copies of the same. So I have added the following to code just to stop multiple copies. But now the script is not running at all and we did see more than 90% space utilization archive log destination.

Here is the added code:

####################################################
# Exit If Already Running
####################################################
function ExitIfAlreadyRunning
{
copies=`ps -ef | grep OraProcessArch | grep "$SID_NAME" | grep -v grep | wc -l`
if [ $copies -gt 2 ]
then

   echo $(date)" Number Of Copies Running : $copies"    exit 0
else

   return 0
fi
}

Any suggestions ???

I am not so good in using semaphores and all , looking for a simple solution if possible ..

Thanks in advance,
Madhu

--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Reddy, Madhusudana
  INET: Madhusudana.Reddy_at_bestbuy.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
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.com
--
Author: Reddy, Madhusudana
  INET: Madhusudana.Reddy_at_bestbuy.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
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.com
-- 
Author: 
  INET: Brian_P_MacLean_at_eFunds.Com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
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 Tue May 14 2002 - 11:43:54 CDT

Original text of this message

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