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 -> Re: How to know when archivelog is fully written

Re: How to know when archivelog is fully written

From: Brian P. Mac Lean <brian.maclean_at_iridiumna.com>
Date: Wed, 17 Feb 1999 22:26:14 GMT
Message-ID: <36CB4247.648363EB@iridiumna.com>


Assuming your on UNIX you have several options:

  1. In Korn shell do a for loop that gets the archived logfile size, sleeps for a few seconds, then checks the size again. If the before and after size are the same you should be free and clear (assuming your archive destination isn't full and Oracle is waiting for more space before it starts to write again.
  2. In Korn shell you can user the "fuser" command to ensure that no process has the file open.
  3. The ideal solution would combine 1 and 2 above and would look something like:

  echo "----- CHECKING FILE ${FILE} -----"   SIZE_BEFORE=$(ls -l ${FILE} | awk '{ print $5 }')   sleep 5
  SIZE_AFTER=$(ls -l ${FILE} | awk '{ print $5 }')   if [ ${SIZE_BEFORE} = ${SIZE_AFTER} ]   then #file size unchanged
    CNT_USERS=$(fuser ${FILE} 2>&1 | wc -w 2>/dev/null)     if [ ${CNT_USERS} = 1 ]
    then
      echo "File ${FILE} is available for processing"     else
      echo "Bypassing file ${FILE}, currently in use"     fi
  else #file size has changed
    echo "Bypassing file ${FILE}, size has changed"   fi
done

.....sample output from the above looks like.....

Stephen Harris wrote:
>
> Apologies if this appears twice.... server played up!
>
> As part of my log shipping, I am performing a
> alter system switch logfile
> to force a new archive log to be created.
>
> However, before I copy this file to the standby machine how can I know
> that the log file is fully written? I can't go by length, because the
> filesize can be different each time (switching log before redo fills up
> means the archive size isn't the same size as a full redo log), but they
> can still take a non-neglible amount of time to write.
>
> So how I can know when it is safe to copy?
>
> Your ideas much appreciated...
>
> --
>
> rgds
> Stephen
Received on Wed Feb 17 1999 - 16:26:14 CST

Original text of this message

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