Friday, April 19, 2013

perl

Posted by Mahalingesh On Friday, April 19, 2013

My perl onliners

perl -pi -e 's/PROD/TEST/g' create_control_file.sql

awk

Posted by Mahalingesh On Friday, April 19, 2013

MY AWK oneliners 

dbora

Posted by Mahalingesh On Friday, April 19, 2013


#!/bin/ksh
#################################################################################
# script location for Solaris /etc/init.d/dbora 
#
#  
#################################################################################
initvar() #1#
{
SCRIPTDIR="/u01/app/oracle/admin/DBA/scripts";export SCRIPTDIR
ORACLE_HOME="/u01/app/oracle/product/11.2.0.3/";export ORACLE_HOME
SCRIPTDIR=$ORACLE_HOME/bin #default#
ORA_OWNER="oracle";export ORA_OWNER
ORACLE_BASE=${ORACLE_BASE:=/u01/app/oracle};export ORACLE_BASE
LOG=${ORACLE_BASE}/admin/DBA/log/dbora.$1.$$.log;export LOG
HOST_TYPE="`uname`"
if [ ${HOST_TYPE} = "AIX" -o ${HOST_TYPE} = "HP-UX" ]
then
    ORATABDIR=${TNS_ADMIN:=/etc}
else
    ORATABDIR=${TNS_ADMIN:=/var/opt/oracle}
fi
}
logmsg() #2#
{
echo "`date '+%m/%d/%Y %T'` $1" | tee -a ${LOG}
}
start_all() #3#
{
if [ -f ${SCRIPTDIR}/dbstart ]
then
    su - ${ORA_OWNER} -c "${SCRIPTDIR}/dbstart $ORACLE_HOME" | tee -a ${LOG} &
else
    logmsg "ERROR dbstart script is missing.  Databases not started"
fi
        su - $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl start"
        touch /var/lock/subsys/dbora
}
stop_all() 
{
if [ -f ${SCRIPTDIR}/dbshut ]
then
    su - ${ORA_OWNER} -c "${SCRIPTDIR}/dbshut $ORACLE_HOME" | tee -a ${LOG} &
else
    logmsg "ERROR dbstop script is missing.  Databases not shutdown cleanly"
fi
        su - $ORA_OWNER -c "$ORACLE_HOME/bin/lsnrctl stop"
        touch /var/lock/subsys/dbora
}
#main#
initvar "$1"
case "$1" in
    'start')
            start_all
            ;;
    'stop')
            stop_all
            ;;
esac
exit 0
#################################################################################
# Add this scripts in init.d 
# Solaris ln -s /etc/init.d/dbora /etc/rc0.d/K01dbora
# ln -s /etc/init.d/dbora /etc/rc3.d/S99dbora
#################################################################################
# Test this scripts as root - then test with reboot
# Solaris su - ${ORA_OWNER} -c "${SCRIPTDIR}/dbstart $ORACLE_HOME"
# su - ${ORA_OWNER} -c "${SCRIPTDIR}/dbstop $ORACLE_HOME"
#################################################################################

Monday, April 1, 2013

Database Roll Switchover and Failover

Posted by Mahalingesh On Monday, April 01, 2013



Procedures

The physical standby instance will be startup and shutdown by the VCS.  If you want to do it manually for maintenance, please follow the Scenario 1.

The standby database is normally operated in Managed recovery mode.   In managed recovery mode, the primary database archives redo logs to the standby database and log apply services automatically apply the redo logs to the standby database.

my.txt 

Look like