Search This Blog

Total Pageviews

Wednesday, 4 May 2011

Oracle switch logfile in standby

switch logfile in standby
Oracle switch logfile in standby
Oracle switch logfile




Parameter ARCHIVE_LAG_TARGET tells Oracle to switch a log every "N" seconds.


ALTER SYSTEM SET ARCHIVE_LAG_TARGET = 600 SCOPE=BOTH; ---- this set to 10 min

There is no need for this ALTER SYSTEM SWITCH LOGFILE; Oracle does it for you.

But I am still using Cron because we are monitoring this through Nagios

5,20,35,50 0,2-23 * * 0-6 /opt/oracle/admin/cccdb/scripts/switch_log.sh > /dev/null 2>&1

SYS AS SYSDBA>!cat /opt/oracle/admin/cccdb/scripts/switch_log.sh
#!/bin/bash

ORACLE_HOME=/opt/oracle/product/11.2; export ORACLE_HOME
ORACLE_SID=cccdb; export ORACLE_SID
PATH=/usr/bin:/usr/sbin:/usr/local/bin:$ORACLE_HOME/bin:$ORACLE_HOME/jdk:$ORACLE_HOME/perl5:$PATH; export PATH

sqlplus -s / <alter system archive log current;
alter system checkpoint;
!

logsw=$?
if [[ logsw -ne 0 ]]
then
echo "Log Switch Failed"
exit 1
else
echo "Log Switch Successful"
exit 0
fi



No comments:

Oracle DBA

anuj blog Archive