Thought this might be of interest.
It's not the most complicated of script, but it's the principle that counts :)
Tim.
----- Forwarded message from "Jack C. Applewhite" <[EMAIL PROTECTED]> -----
Date: Wed, 29 Aug 2001 11:15:36 -0800
To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]>
X-Comment: Oracle RDBMS Community Forum
Sender: [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
From: "Jack C. Applewhite" <[EMAIL PROTECTED]>
Subject: RE: Auto log apply to standby db using Perl
Rob (Jo?),
This is from the Oracle8i docs (Chapter 5 of "Oracle8i Standby Database
Concepts and Administration"), but it's so basic that I believe it would
apply to 8.0
...
9. Write a script that you can periodically run to check the log files
in the managed recovery directory and move the log files that
have a specified timestamp to the manual recovery directory.
If new redo logs are being moved, start the manual recovery
mode and apply the newly moved redo logs.
The following PERL script performs what is outlined in this step:
#!/usr/local/bin/perl
#How many hours the standby database should lag behind the primary database
$LAG_HOUR = 4;
#The manual recovery directory
$DEST_DIR = '/fs2/oracle/stdby/';
#The flag for whether there are new logs to be applied.
$needApply = 0;
#Check the managed recovery directory
while ( </fs2/oracle/stby_log/*.arc> ) {
# Get the timestamp of the file
$file_time = (stat($_))[9];
# See if the file is "old enough"
if ( time-$file_time > $LAG_HOUR*60*60 ) {
print "mv $_ $DEST_DIR\n";
system "mv $_ $DEST_DIR";
$needApply = 1;
}
}
#If redo logs were moved in this round, apply them
if ( $needApply == 1 ) {
system "/usr/Lagged_Standby/ApplyLog";
}
The SHELL script (/usr/Lagged_Standby/ApplyLog) used to apply the
redo logs consists of the following:
sqlplus internal << EOF
recover automatic standby database;
cancel
exit
EOF
10. Refer to your platform-specific documentation for information on
how to create a job that is triggered at specific
times throughout the day.
For example, in UNIX, you can write a CRON job file. Issue the man
crontab command at the UNIX
command shell to get help on how to write a CRON job file.
...
Jack
--------------------------------
Jack C. Applewhite
Database Administrator/Developer
OCP Oracle8 DBA
iNetProfit, Inc.
Austin, Texas
www.iNetProfit.com
[EMAIL PROTECTED]
(512)327-9068
----- End forwarded message -----