Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: [q] How to pick up archived logs

Re: [q] How to pick up archived logs

From: Thomas J. Kyte <tkyte_at_us.oracle.com>
Date: 1997/02/20
Message-ID: <330c7a0a.9434916@nntp.mediasoft.net>#1/1

On 20 Feb 1997 08:19:05 +0300, "Vasily R. Kraskovsky" <vasily_at_kvr.spb.ru> wrote:

>Hi!
>
> I have Oracle 7.3.2 under Solaris 2.5 on my place, and I need to switch
>database backup mode from full-offline backup to online backup, trying to
>attain 24-hour database accsessibility. So I want to pick up archive logs
>when they are already finished archiving, move them to another server, and
>there add/compress them to solid archive.
>
> Question: How can I detect from unix (ksh script starting by cron) that
>Oracle have completed another log to archiving, and it can be moved to
>another place? Help, please.
>
>Thanks.
>
>--
> Nemo solus sapit satis
> <<<<<<<<<<<<<<<<<<<<<<< >>>>>>>>>>>>>>>>>>>>>>>
> Kraskovsky Vasily, DBA, Petersburg-Express, SPb, Russia
> vasily_at_kvr.spb.ru
>
>

Here is the cron script I use on my system to compress and copy my archived redo log files:

#!/bin/csh -f  

setenv ORACLE_HOME /usr/oracle
setenv ORACLE_SID oracle
set path=($path $ORACLE_HOME/bin /opt/gnu/bin)  

cd /d01/arch  

echo set heading off > /tmp/$$.sql
echo set feedback off >> /tmp/$$.sql
echo set linesize 80 >> /tmp/$$.sql
echo column cmd format a70 >> /tmp/$$.sql echo spool /tmp/$$.sh >> /tmp/$$.sql
echo select "'gzip ' || archive_name || " >> /tmp/$$.sql echo "'; cp ' || archive_name || '.gz /d05/arch' cmd">> /tmp/$$.sql echo 'from v$log_history' >> /tmp/$$.sql echo 'where archive_name in(' >> /tmp/$$.sql ls /d01/arch/*.log | sed "s/^/'/;s/"'$'"/',/" >> /tmp/$$.sql

echo 'NULL ) and sequence# not in ' >> /tmp/$$.sql
echo '( select sequence# from v$log where archived = '"'NO'"')' >> /tmp/$$.sql
echo '/' >> /tmp/$$.sql

echo spool off >> /tmp/$$.sql
echo exit >> /tmp/$$.sql  

sqlplus tkyte/tkyte @/tmp/$$.sql  

sh /tmp/$$.sh  

rm /tmp/$$.{sh,sql}

--------------------------- eof ------------------------------------

basically I'm building a query in /tmp/$$.sql that will (based on the files existing in my archive dest when the script begins) select out a 'gzip filename; cp file somewhere_else' command from the database for those logs that have been archived completey (i use the file system to tell me which files I already copied, anything that has an extension of .gz won't get processed twice). The query runs and builds another sh script which does the actual gzipping and copying of files.  

Thomas Kyte
Oracle Government
tkyte_at_us.oracle.com                          

http://govt.us.oracle.com


statements and opinions are mine and do not necessarily reflect the opinions of Oracle Corporation Received on Thu Feb 20 1997 - 00:00:00 CST

Original text of this message

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