Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to know when archivelog is fully written
Assuming your on UNIX you have several options:
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