Thursday, July 20, 2017

Easy OFSAA DR testing / DR solution

1. All the ODA VMs have DNS entries. So, for DR testing or DR switch over, we just need change the DNS entries/alias to point to the different IPs. e.g.:
    OFSAA app server (i.e.: ofsaaprd): 10.120.132.117
    OFSAA Weblogic server (i.e.: ofsawlsprd) and Web Server (i.e.: ofsawebprd): 10.120.132.118
    Database server (i.e.: ofsadbprd): oda-scan or 10.120.132.111 (ODA base)

2. Get a copy of the OFSAA files (backup every day, maybe)
tar -pczf /cloudfs/backup/ofsaa_tar/ftpshare.tar.gz -C / u03/app/ftpshare

The following script will backup all the OFSAA apps, for DR testing, just need ftpshare copied over to the DR site.

# cat tarOFSAA4DR.sh
#!/bin/bash

# tarOFSAA4DR.sh

#-------------------------------------------------------------------------------
# Description:
#   tar OFSAA app for DR
# Example:
#
# Modification History
#   07/17/2017 xxxxxxx Created
#
#-------------------------------------------------------------------------------
# User defined parameters
#

nowDate=$(date '+%Y%m%d')
hostName=$(hostname)
tarDir=/mfs/backup/ofsaa_tar
logFile=/mfs/logs/OFSAA/GuestVMBackup/tarOFSAA4DR_${nowDate}.log

ftpshareFile=${hostName}_ftpshare_${nowDate}.tar.gz
ofsaaFile=${hostName}_ofsaa_${nowDate}.tar.gz
odiFile=${hostName}_odi_${nowDate}.tar.gz
pidLst=""

echo "################################################################################" | tee -a ${logFile}
echo "# BEGIN TAR GZIP OFSAA,FTPSHARE,ODI $(date '+%Y-%m-%d %H:%M:%S')" | tee -a ${logFile}
echo "################################################################################" | tee -a ${logFile}
echo "$(date '+%Y-%m-%d %H:%M:%S') Tar Directory.......: "${tarDir} | tee -a ${logFile}
echo "$(date '+%Y-%m-%d %H:%M:%S') FTPSHARE FileName...: "${ftpshareFile} | tee -a ${logFile}
echo "$(date '+%Y-%m-%d %H:%M:%S') OFSAA FileName......: "${ofsaaFile} | tee -a ${logFile}
echo "$(date '+%Y-%m-%d %H:%M:%S') ODI FileName........: "${odiFile} | tee -a ${logFile}
echo "$(date '+%Y-%m-%d %H:%M:%S') Script Log FileName.: "${logFile} | tee -a ${logFile}
echo "" | tee -a ${logFile}

echo "$(date '+%Y-%m-%d %H:%M:%S') EXECUTING: tar ${tarDir}/${ofsaaFile}" | tee -a ${logFile}
tar -pczf ${tarDir}/${ofsaaFile} -C / u03/app/ofsaa &
aPid=$!

if [ "${aPid}" = "0" ]; then
 echo "$(date '+%Y-%m-%d %H:%M:%S') ERROR: HALTING!!!!"
 exit 1
else
 pidLst="$pidLst ${aPid}"
fi

echo "$(date '+%Y-%m-%d %H:%M:%S') EXECUTING: tar ${tarDir}/${ftpshareFile}" | tee -a ${logFile}
tar -pczf ${tarDir}/${ftpshareFile} -C / u03/app/ftpshare &
aPid=$!
echo ${aPid}

if [ "${aPid}" = "0" ]; then
 echo "$(date '+%Y-%m-%d %H:%M:%S') ERROR: HALTING!!!!"
 exit 1
else
 pidLst="$pidLst ${aPid}"
fi

#echo "$(date '+%Y-%m-%d %H:%M:%S') EXECUTING: tar ${tarDir}/${odiFile}" | tee -a ${logFile}
#tar -pczf ${tarDir}/${odiFile} -C / u03/app/odi &
#aPid=$!

if [ "${aPid}" = "0" ]; then
 echo "$(date '+%Y-%m-%d %H:%M:%S') ERROR: HALTING!!!!"
 exit 1
else
 pidLst="$pidLst ${aPid}"
fi

echo "tar waiting list: =$pidLst=..." | tee -a $logFile
wait $pidLst
sleep 60
echo "All tars are done. Time at `date`."  | tee -a $logFile

echo "$(date '+%Y-%m-%d %H:%M:%S') LIST FILES..." | tee -a ${logFile}
ls -al ${tarDir}/*${nowDate}*.tar.gz | tee -a ${logFile}
echo "" | tee -a ${logFile}

echo "$(date '+%Y-%m-%d %H:%M:%S') COMPLETE" | tee -a ${logFile}
echo "$(date '+%Y-%m-%d %H:%M:%S') Tar Directory.......: "${tarDir} | tee -a ${logFile}
echo "################################################################################" | tee -a ${logFile}
echo "# END TAR GZIP OFSAA,FTPSHARE,ODI $(date '+%Y-%m-%d %H:%M:%S')" | tee -a ${logFile}
echo "################################################################################" | tee -a ${logFile}
exit 0

3. Copy the ftpshare to the DR site and untar it.
tar -pzxvf /cloudfs/backup/ofsaa_tar/btcodaasp003v_ftpshare.tar.gz -C /

4. Prepare the database
    1). For DR testing, you convert the physical standby to snapshot standby and after done the DR testing, switch back to physical standby. If your master database and standby have the same dbname, add a unique name to the service_names:
     From DR database – sqlplus - add a new service name ofsdbprod:
alter system set service_names = 'ofsdbroc, ofsdbprod' scope=memory;


DGMGRL> convert database ofsaadb to snapshot standby;
DGMGRL> convert database ofsaadb to physical standby;

    2). For DR switchover, you switch the database too.

That's it. so simple and easy!

Friday, July 7, 2017

Access ODA ILOM

1, on ODA BASE, run oakcli to get the ip address for ILOM:

# oakcli show server

 ILOM Address             : 10.60.16.212

2a. access web interface
 
  http://10.60.16.212

2b. access ILOM CLI
 
  ssh -l root 10.60.16.212

login/connect as root, enter password.