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: Archived logs backup

RE: Archived logs backup

From: Stephen Lee <slee_at_dollar.com>
Date: Thu, 05 Dec 2002 07:19:13 -0800
Message-ID: <F001.00513200.20021205071913@fatcity.com>

-----Original Message-----
Within script how do I skip archived log file that is being written by oracle?


I took another look at this and figured out what you were really asking. The commands: "ls -1rt" or "ls -1t" will list the files in the directory and sort according to time. Note that the "1" is a one. This will allow you to see the most recent files. If you would like to keep the two most recent then something like:

#!/bin/ksh

COUNT=0
for i in `ls -1t *.dbf`; do

   COUNT=$(( $COUNT + 1 ))
   if [ $COUNT -gt 2 ]; then

      SEND $i TO TAPE
      if [ $? -ne 0 ]; then
         print "SOMETHING BROKE"
      else
         rm $i
         (or maybe safer to move it to a pre-delete filesystem, then delete
it later)
      fi

   fi
done
--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Stephen Lee
  INET: slee_at_dollar.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 Dec 05 2002 - 09:19:13 CST

Original text of this message

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