################################################################# # # # Modified by EMEA OracleDBA Team for enhancements & automation # # DEC 2016 # # # ################################################################# # # # # # USAGE : To be executed as oracle user # # (pbrun to oracle or pboracle) # # # # Manual execution # # sh bl_status.ksh # # # # Via job scheduler tools and by-passing the prompt # # sh bl_status.ksh y # # # #---------------------------------------------------------------# # # # //Generic information about the batch of scripts developed// # # bl_status.ksh # # bl_stop.ksh # # bl_stop_crs.ksh # # bl_start_crs.ksh # # bl_start.ksh # # # # Versions/Combinations Supported # # Clustware 12c # # Clustware 11g # # Clustware 10g # # NON-RAC with ASM 11g # # NON-RAC with ASM 10g # # NON-RAC & NON-ASM # # # # Components in scope # # Clusterware # # ASM Instance # # Database Instance # # Cluster Listener # # Local Listener # # Manager Recovery Process # # GoldenGate Replication # # Port Utility # # Enterprise Manager Agent # # OSWatcher Utility # # Foglight Monitoring Agent # # Filesystem # # Rawdisk # # # ################################################################# export OS=`uname -a | awk '{ print $1 }'` eval timevalue=`date '+%m%d%Y_%H%M%S'` #Handle First Argument (oraowner:oragroup) if specified if [[ ! -z $1 ]]; then export oracred=$1 export oraowner=`echo $oracred | cut -d":" -f1 -s` export oragroup=`echo $oracred | cut -d":" -f2 -s` echo "Oracle Ownership Captured ARGUMENTS ... oracred=$oracred oraowner=$oraowner oragroup=$oragroup " else export oracred=oracle:dba export oraowner=oracle export oragroup=dba fi # CHECK IF THE USER IS as Arg#1 if specified echo " " if [ $(whoami) != "${oraowner}" ] then echo ' \t \t' "ATTENTION : Please execute this script as ${oraowner} user" exit 0; fi # SCRIPT AND OUTPUT DIRECTORIES INITIALIZATION SCRIPT_DIRECTORY=/efs/dist/gmrtdba/dbascripts/scripts/common if [[ ${oraowner} = "oracle" ]]; then if [[ -d /oracle/dba/output/generic ]]; then OUTPUT_DIRECTORY=/oracle/dba/output/generic else OUTPUT_DIRECTORY=/var/bl_ora/log if [[ ! -d $OUTPUT_DIRECTORY ]]; then echo "OUTPUT_DIRECTORY: $OUTPUT_DIRECTORY was not found on this server ... Exiting" exit 0 fi fi else if [[ -d /oracle/dba/output/generic ]]; then OUTPUT_DIRECTORY=/oracle/dba/output/generic/${oraowner} else OUTPUT_DIRECTORY=/var/bl_ora/log/${oraowner} if [[ ! -d $OUTPUT_DIRECTORY ]]; then echo "OUTPUT_DIRECTORY: $OUTPUT_DIRECTORY was not found on this server ... Exiting" exit 0 fi fi fi if [[ -f $OUTPUT_DIRECTORY/server_type.log ]]; then #server_type=$(<$OUTPUT_DIRECTORY/server_type.log) rm -f $OUTPUT_DIRECTORY/server_type.log fi if [ "$(ps -ef | grep crsd.bin | grep -v grep | wc -l)" -eq 1 ] then if [ "$(ps -ef | grep crsd.bin | grep -v grep | grep "12\." | wc -l)" -eq 1 ] then export server_type="rac_12c" elif [ "$(ps -ef | grep crsd.bin | grep -v grep | grep "11\." | wc -l)" -eq 1 ] then export server_type="rac_11g" else export server_type="rac_10g" fi else if [ "$(ps -ef | grep ohasd.bin | grep -v grep | grep "12\." | wc -l)" -eq 1 ] then export server_type="norac_asm12c" elif [ "$(ps -ef | grep ohasd.bin | grep -v grep | grep "11\." | wc -l)" -eq 1 ] then export server_type="norac_asm11g" elif [ "$(ps -ef | grep pmon | grep -v grep | grep "+ASM" | grep -v onitor | wc -l)" -eq 1 ] then export server_type="norac_asm10g" else export server_type="norac_noasm" fi fi # Address rare issue seen where crsd.bin not picked up even though it is in fact a RAC system! if [[ "$server_type" == norac_asm* ]] && [[ -f /etc/oratab ]]; then ASM_LAST_CHAR=`grep "^\+ASM" /etc/oratab | cut -d":" -f1 -s | sed -e "s/.*\(.\)/\1/"` echo $ASM_LAST_CHAR | egrep '^[0-9]+$' if [ $? -eq 0 ]; then #echo "$ASM_LAST_CHAR is a number .. So it's a RAC " server_str_2=`echo $server_type | sed 's/asm//g' |cut -d"_" -f2 -s` export server_type="rac_${server_str_2}" fi fi echo $server_type > $OUTPUT_DIRECTORY/server_type.log ######################################################################## ## Get standard pw for db connections ################################## ## Gen: echo "*****" | openssl enc -base64 export dba_ro_p=`echo "c2FmMzJ1c2UK" | openssl enc -base64 -d` export gem_re_p=`echo "Z2Vtc19wYXNzdzByZAo=" | openssl enc -base64 -d` ######################################################################## status_ora_homes() { rm -f $OUTPUT_DIRECTORY/bl_ora_homes.tmp rm -f $OUTPUT_DIRECTORY/bl_ora_homes.lst #Get ORA HOME info from running instances ps -ef | grep pmon | sort -k9 | grep "^.*${oraowner} " | grep -v grep | grep -v onitor | awk '{ print $NF }' | cut -d"_" -f3,4 -s | while read ORA_INST do if [[ ! -z $ORA_INST ]]; then grep "^${ORA_INST}:" /etc/oratab | grep -v "^#" | cut -d":" -f2 -s | while read ORA_HOME do echo $ORA_HOME >> $OUTPUT_DIRECTORY/bl_ora_homes.tmp done fi done if [[ -f $OUTPUT_DIRECTORY/bl_ora_homes.tmp ]]; then cat $OUTPUT_DIRECTORY/bl_ora_homes.tmp | sort -u > $OUTPUT_DIRECTORY/bl_ora_homes.lst echo " Active Oracle Homes Found in /etc/oratab on this host: " >> ${LOG} echo "`cat $OUTPUT_DIRECTORY/bl_ora_homes.lst`" >> ${LOG} echo "" >> ${LOG} else echo "" >> ${LOG} echo "No Oracle Home Information Found from /etc/oratab on this host " >> ${LOG} echo "" >> ${LOG} fi } status_has() { echo "Collecting CLUSTERWARE information ..... "; echo "" echo "************************** CLUSTERWARE *********************" >> ${LOG}; echo "" >> ${LOG} export ORACLE_SID=`ps -ef | grep pmon | sort -k9 | grep "^.*${oraowner} " | grep -v grep | grep "+ASM" | grep -v onitor | awk 'BEGIN{FS="_"}{print $NF}'` export ORAENV_ASK=NO >/dev/null; . oraenv >/dev/null crs_en_dis=`cat /etc/oracle/scls_scr/$(echo $(hostname) | cut -d. -f1)/root/crsstart | awk 'BEGIN{FS=":"}{print $1}'` echo "CRS status : $crs_en_dis" >> ${LOG}; echo "" >> ${LOG} crsctl check has >> ${LOG} ; echo "" >> ${LOG} crsctl check crs >> ${LOG} ; echo "" >> ${LOG} srvctl status asm -n $(hostname) >> ${LOG} ; >> ${LOG} ; echo "" >> ${LOG} crs_stat -t >> ${LOG} ; >> ${LOG} ; echo "" >> ${LOG} crsctl stat res -t >> ${LOG} ; >> ${LOG} ; echo "" >> ${LOG} echo "CRS status : $crs_en_dis" >$OUTPUT_DIRECTORY/"$when"_"$why"_"$what".log } status_crs() { echo "Collecting CLUSTERWARE information ..... "; echo "" echo "************************** CLUSTERWARE *********************" >> ${LOG}; echo "" >> ${LOG} ORACLE_SID=`cat /etc/oratab | awk 'BEGIN{FS=":"}{print $1}' | grep CRS | grep -v "#"` export ORAENV_ASK=NO >/dev/null; . oraenv >/dev/null crs_en_dis=`cat /etc/oracle/scls_scr/$(echo $(hostname) | cut -d. -f1)/root/crsstart | awk 'BEGIN{FS=":"}{print $1}'` echo "CRS status : $crs_en_dis" >> ${LOG}; echo "" >> ${LOG} crsctl check crs >> ${LOG} ; echo "" >> ${LOG} crs_stat -t >> ${LOG} ; >> ${LOG} ; echo "" >> ${LOG} if [ "$(ps -ef | grep crs | grep -v grep | awk 'BEGIN{FS=" "}{print $(NF)}' | grep "10\." | wc -l)" -eq 0 ] then crsctl stat res -t >> ${LOG} ; >> ${LOG} ; echo "" >> ${LOG} crsctl stat res -t >$OUTPUT_DIRECTORY/"$when"_"$why"_"$what".log else #crsctl stat res -t >> ${LOG} ; >> ${LOG} ; echo "" >> ${LOG} echo ""; fi } status_asm() { echo "Collecting ASM information ..... "; echo "" echo "***************************** ASM ************************" >> ${LOG}; echo "" >> ${LOG} ps -ef | grep pmon | sort -k9 | grep "^.*${oraowner} " | grep -v grep | grep "+ASM" | grep -v onitor >> ${LOG} ; echo "" >> ${LOG} ps -ef | grep pmon | sort -k9 | grep "^.*${oraowner} " | grep -v grep | grep "+ASM" | grep -v onitor | awk 'BEGIN{FS="_"}{print $NF}'>$OUTPUT_DIRECTORY/"$when"_"$why"_"$what".log for SID in `ps -ef | grep pmon | sort -k9 | grep "^.*${oraowner} " | grep -v grep | grep "+ASM" | grep -v onitor | awk 'BEGIN{FS="_"}{print $NF}'` do export ORACLE_SID=${SID} >/dev/null export ORAENV_ASK=NO >/dev/null . oraenv >/dev/null op=`$ORACLE_HOME/bin/sqlplus -s '/ as sysdba'<< EOF set echo off; set linesize 200 pages 1000 col PATH for A40 col NAME for A30 select instance_name,host_name,startup_time from gv\\$instance; select group_number gn,disk_number dn, mount_status, header_status,mode_status,state, total_mb, free_mb, path, name from v\\$asm_disk order by group_number, disk_number; set heading off; select 'Use below ouput for comparing ASM DISK Status Pre and Post' from dual; select 'ASMDISK_COMPARE_STRINGS:'||mount_status||':'||header_status||':'||mode_status||':'||name from v\\$asm_disk where NAME is not null order by name; EOF` echo "$op" >> ${LOG};echo "" >> ${LOG} done } status_db() { echo "Collecting DATABASE & SERVICES information ..... "; echo "" echo "************************** DATABASE & SERVICES *********************" >> ${LOG}; echo "" >> ${LOG} ps -ef | grep pmon | sort -k9 | grep "^.*${oraowner} " | grep -v grep | grep -v "+ASM" | grep -v "\-MGMTDB" | grep -v onitor | awk '{ print $NF }' | cut -d"_" -f3,4 -s>$OUTPUT_DIRECTORY/"$when"_"$why"_"$what".log if [ "$(ps -ef | grep pmon | sort -k9 | grep "^.*${oraowner} " | grep -v grep | grep -v "+ASM" |grep -v "\-MGMTDB" | grep -v onitor | wc -l)" != 0 ] then rm -f $OUTPUT_DIRECTORY/db:inst rm -f $OUTPUT_DIRECTORY/db:inst.log rm -f $OUTPUT_DIRECTORY/unidb:inst.log rm -f $OUTPUT_DIRECTORY/dbopen:info.log rm -f $OUTPUT_DIRECTORY/inst_info.log rm -f $OUTPUT_DIRECTORY/db_stat_info.log rm -f $OUTPUT_DIRECTORY/"$when"_"$why"_dbservices.log # Grab unique name from each runing Instance for SID in `ps -ef | grep pmon | sort -k9 | grep "^.*${oraowner} " | grep -v grep | grep -v "+ASM" |grep -v "\-MGMTDB" | grep -v onitor | awk '{ print $NF }' | cut -d"_" -f3,4 -s` do export ORACLE_SID=$SID export ORAENV_ASK=NO >/dev/null . oraenv >/dev/null $ORACLE_HOME/bin/sqlplus -s '/ as sysdba'<< EOFUDB1 > $OUTPUT_DIRECTORY/inst_info.log set echo off; set heading off; set linesize 200 pages 100; select 'DBINST_ENTRY:'||d.DB_UNIQUE_NAME||':'||i.INSTANCE_NAME from v\$database d, v\$instance i; select 'DBINST_OPEN_INFO:'||i.INSTANCE_NAME from v\$database d, v\$instance i where i.STATUS='OPEN' and d.DATABASE_ROLE='PRIMARY'; EOFUDB1 cat $OUTPUT_DIRECTORY/inst_info.log | grep "DBINST_ENTRY:" >> $OUTPUT_DIRECTORY/unidb:inst.log cat $OUTPUT_DIRECTORY/inst_info.log | grep "DBINST_OPEN_INFO:" >> $OUTPUT_DIRECTORY/dbopen:info.log done # Display some db info in status log based on contents of $OUTPUT_DIRECTORY/dbopen:info.log if [[ -f $OUTPUT_DIRECTORY/dbopen:info.log ]]; then while read data do export ORACLE_SID=$(echo $data | awk 'BEGIN{FS=":"}{print $2}') >/dev/null export ORAENV_ASK=NO >/dev/null . oraenv >/dev/null echo "" >> ${LOG} echo "Collecting db info for instance: ${ORACLE_SID} " >> ${LOG} echo "" >> ${LOG} if [ $(ps -ef | grep -v grep | grep pmon | grep "^.*${oraowner} " | grep "pmon_${ORACLE_SID}\$" | wc -l) -ne 0 ] then $ORACLE_HOME/bin/sqlplus -s '/ as sysdba' << EOF > $OUTPUT_DIRECTORY/db_stat_info.log set linesize 200 pages 100; set heading off; set echo off; column COMP_ID format a15 column COMP_NAME format a40 column STATUS format a10 select '******* DB REGISTRY INFO *******' FROM DUAL; select COMP_NAME, VERSION, STATUS, MODIFIED from dba_registry; select '******* DB OBJECT VALID/INVALID COUNT *******' FROM DUAL; select STATUS,COUNT(*) FROM DBA_OBJECTS GROUP BY STATUS; select 'Checking any INVALID object counts ' FROM DUAL; select owner,object_type,count(1) from dba_objects where status='INVALID' group by owner,object_type order by owner,object_type; select '******* CONTROL FILE LOCATIONS *******' FROM DUAL; select NAME from v\$controlfile; select '******* DB SIZE TOTALS *******' FROM DUAL; set heading on; select (select sum(bytes/1048576) from dba_data_files) "Data Mb", (select NVL(sum(bytes/1048576),0) from dba_temp_files) "Temp Mb", (select sum(bytes/1048576)*max(members) from v\$log) "Redo Mb", (select sum(bytes/1048576) from dba_data_files) + (select NVL(sum(bytes/1048576),0) from dba_temp_files) + (select sum(bytes/1048576)*max(members) from v\$log) "Total Mb" from dual; set heading off; EOF cat $OUTPUT_DIRECTORY/db_stat_info.log >> ${LOG}; echo "" >> ${LOG} fi echo "___________________________________________________________">> ${LOG}; done < $OUTPUT_DIRECTORY/dbopen:info.log fi if [[ $server_type = "rac_11g" ]] || [[ $server_type = "rac_12c" ]] then export ORACLE_SID=`ps -ef | grep pmon | sort -k9 | grep "^.*${oraowner} " | grep -v grep | grep "+ASM" | grep -v onitor | awk 'BEGIN{FS="_"}{print $NF}'` export ORAENV_ASK=NO >/dev/null . oraenv >/dev/null for SID in `ps -ef | grep pmon | sort -k9 | grep "^.*${oraowner} " | grep -v grep | grep -v "+ASM" |grep -v "\-MGMTDB" | grep -v onitor | awk '{ print $NF }' | cut -d "_" -f3,4 -s` do R_DBNAME=` echo $SID | sed "s/[1-9]$//g"|sed "s/_$//g"`;ONENode_DB=""; if [ "$(srvctl config database -d $R_DBNAME |grep -w "RACOneNode" | wc -l)" -eq 1 ] then export LOCAL_NODE=`hostname -s` export ONENode_DB=`echo ":$LOCAL_NODE"` fi UNIQUE_NAME=`echo $(crs_stat | grep "ora." | grep ".db$" | grep -i "$R_DBNAME" | tr "[:lower:]" "[:upper:]")` if [[ -f $OUTPUT_DIRECTORY/unidb:inst.log ]] && [[ ! -z $UNIQUE_NAME ]]; then UNIQUE_SID=`echo $UNIQUE_NAME | cut -d"." -f2 -s` CHK_UNI_LOG=`grep ":${UNIQUE_SID}:" $OUTPUT_DIRECTORY/unidb:inst.log` if [[ -z $CHK_UNI_LOG ]]; then UNIQUE_NAME="" fi fi if [[ ! -z $UNIQUE_NAME ]]; then echo $(crs_stat | grep "ora." | grep ".db$" | grep -i $R_DBNAME | tr "[:lower:]" "[:upper:]" | awk 'BEGIN{FS="."}{print $2}')":"$SID$ONENode_DB >> $OUTPUT_DIRECTORY/db:inst else if [[ -f $OUTPUT_DIRECTORY/unidb:inst.log ]]; then #Do lookup from status file to find correct Unique name UNI_NAME=`grep "DBINST_ENTRY:" $OUTPUT_DIRECTORY/unidb:inst.log | grep ":${SID}$"| cut -d":" -f2 -s` ## if [[ ! -z $UNI_NAME ]]; then ## if unique name is have _tx matching with crs resource if [[ "$(crs_stat | grep "ora." | grep ".db$" | grep -i ${UNI_NAME} | wc -l)" -eq 1 ]]; then echo $(crs_stat | grep "ora." | grep ".db$" | grep -i ${UNI_NAME} | tr "[:lower:]" "[:upper:]" | awk 'BEGIN{FS="."}{print $2}')":"$SID >> $OUTPUT_DIRECTORY/db:inst else echo $(crs_stat | grep "ora." | grep ".db$" | grep -i ${R_DBNAME} | tr "[:lower:]" "[:upper:]" | awk 'BEGIN{FS="."}{print $2}')":"$SID >> $OUTPUT_DIRECTORY/db:inst fi else echo $(crs_stat | grep "ora." | grep ".db$" | grep -i ${R_DBNAME} | tr "[:lower:]" "[:upper:]" | awk 'BEGIN{FS="."}{print $2}')":"$SID >> $OUTPUT_DIRECTORY/db:inst fi fi done elif [[ $server_type = "rac_10g" ]] then ORACLE_SID=`cat /etc/oratab | awk 'BEGIN{FS=":"}{print $1}' | grep CRS | grep -v "#"` export ORAENV_ASK=NO >/dev/null . oraenv >/dev/null for SID in `ps -ef | grep pmon | sort -k9 | grep "^.*${oraowner} " | grep -v grep | grep -v "+ASM" | grep -v "\-MGMTDB" | grep -v onitor | awk '{ print $NF }' | cut -d"_" -f3,4 -s` do echo $(crs_stat | grep ora | grep db | grep -i ${SID%?} | tr "[:lower:]" "[:upper:]" | awk 'BEGIN{FS="."}{print $2}')":"$SID >> $OUTPUT_DIRECTORY/db:inst done else for SID in `ps -ef | grep pmon | sort -k9 | grep "^.*${oraowner} " | grep -v grep | grep -v "+ASM" | grep -v "\-MGMTDB" | grep -v onitor | awk '{ print $NF }' | cut -d"_" -f3,4 -s` do echo $SID":"$SID >> $OUTPUT_DIRECTORY/db:inst done fi cp $OUTPUT_DIRECTORY/db:inst $OUTPUT_DIRECTORY/db:inst.log ps -ef | grep pmon | sort -k9 | grep "^.*${oraowner} " | grep -v grep | grep -v "+ASM" | grep -v "\-MGMTDB" | grep -v onitor >> ${LOG} ; echo "" >> ${LOG} while read data do export ORACLE_DB=$(echo $data | awk 'BEGIN{FS=":"}{print $1}') >/dev/null export ORACLE_SID=$(echo $data | awk 'BEGIN{FS=":"}{print $2}') >/dev/null export ORAENV_ASK=NO >/dev/null . oraenv >/dev/null echo "Database Instance : "$ORACLE_SID >> ${LOG}; if [[ $server_type = "rac_11g" ]] || [[ $server_type = "rac_10g" ]] || [[ $server_type = "rac_12c" ]] then srvctl status database -d $ORACLE_DB >> ${LOG};echo "" >> ${LOG} srvctl status service -d $ORACLE_DB >> ${LOG};echo "" >> ${LOG} echo $ORACLE_DB:$ORACLE_SID":"$(srvctl status service -d $ORACLE_DB | grep $ORACLE_SID | grep -i "is running" | awk '{ print $2 }') >> $OUTPUT_DIRECTORY/"$when"_"$why"_dbservices.log echo "_____________________________________________________________________" >> ${LOG} sleep 3 else op=`$ORACLE_HOME/bin/sqlplus -s '/ as sysdba'<< EOFDB2 set echo off; set linesize 200 pages 100; select instance_name,host_name,startup_time from gv\\$instance; select name,open_mode,database_role from gv\\$database; EOFDB2` echo "$op" >> ${LOG};echo "" >> ${LOG} if [[ "$server_type" == norac_asm* ]]; then echo "" >> ${LOG} echo "srvctl status database -d $ORACLE_DB" >> ${LOG} srvctl status database -d $ORACLE_DB >> ${LOG} echo "srvctl status service -d $ORACLE_DB" >> ${LOG} srvctl status service -d $ORACLE_DB >> ${LOG} echo "" >> ${LOG} fi echo "_____________________________________________________________________" >> ${LOG} fi done < $OUTPUT_DIRECTORY/db:inst.log if [[ "$(cat $OUTPUT_DIRECTORY/db:inst.log | wc -l)" -gt 0 ]]; then echo "yes" > $OUTPUT_DIRECTORY/"$why"_"$what".log else echo "no" > $OUTPUT_DIRECTORY/"$why"_"$what".log fi if [[ "$(cat $OUTPUT_DIRECTORY/dbopen:info.log | wc -l)" -gt 0 ]]; then echo "yes" > $OUTPUT_DIRECTORY/"$why"_dbopenlog else echo "no" > $OUTPUT_DIRECTORY/"$why"_dbopen.log fi else echo "All oracle instances are DOWN" >> ${LOG}; echo "" >> ${LOG} fi } status_lsnr() { echo "Collecting LISTENER information ..... "; echo "" echo "***************************** LISTENER ************************" >> ${LOG}; echo "" >> ${LOG} ps -ef | grep lsnr | grep "^.*${oraowner} " | grep -v grep >> ${LOG} ; echo "" >> ${LOG} ps -ef | grep lsnr | grep "^.*${oraowner} " | grep -v grep |sed -n 's/.*\(tnslsnr.*\).*/\1/p' | awk '{ print $2 }' | sed '/^\s*$/d' >$OUTPUT_DIRECTORY/"$when"_"$why"_"$what".log if [[ $server_type = "rac_11g" ]] || [[ $server_type = "norac_asm11g" ]] || [[ $server_type = "rac_12c" ]] || [[ $server_type = "norac_asm12c" ]] || [[ $server_type = "rac_10g" ]] || [[ $server_type = "norac_asm10g" ]] then ORACLE_SID=`ps -ef | grep pmon | sort -k9 | grep "^.*${oraowner} " | grep -v grep | grep "+ASM" | grep -v onitor | awk 'BEGIN{FS="_"}{print $NF}' | head -1` else ORACLE_SID=`ps -ef | grep pmon | sort -k9 | grep "^.*${oraowner} " | grep -v grep | grep -v "+ASM" | grep -v "\-MGMTDB" | grep -v onitor | awk '{ print $NF }' | cut -d"_" -f3,4 -s | head -1` fi export ORAENV_ASK=NO >/dev/null if [[ ! -z $ORACLE_SID ]]; then . oraenv >/dev/null fi for lsnr in `ps -ef | grep lsnr | grep "^.*${oraowner} " | grep -v grep | sed -n 's/.*\(tnslsnr.*\).*/\1/p' | awk '{ print $2 }'` do LSNR_HOME=`ps -ef | grep lsnr | grep $lsnr | grep "^.*${oraowner} " | grep -v grep | sed -n 's/.*\(..........................................................tnslsnr\).*/\1/p' | awk '{ print $NF }' | sed 's/\/bin\/tnslsnr//g'` if [[ $ORACLE_HOME != $LSNR_HOME ]]; then if [[ -f /etc/oratab ]]; then ORACLE_SID=`grep "$LSNR_HOME" /etc/oratab | grep -v "^#" | cut -d":" -f1 -s | tail -1` export ORAENV_ASK=NO >/dev/null if [[ ! -z $ORACLE_SID ]]; then . oraenv >/dev/null fi fi fi lsnrctl status $lsnr >> ${LOG};echo "" >> ${LOG} done } status_gg() { echo "Collecting GOLDENGATE information ..... "; echo "" echo "***************************** GOLDENGATE **************************" >> ${LOG}; echo "" >> ${LOG} ps -ef | grep -v grep | grep "mgr PARAMFILE" | grep "^.*${oraowner} " | sed -n 's/.*\(....................................................................\/....prm \).*/\1/p' | awk '{ print $NF }' | grep -v "\.\.\.\.mgr.prm" >$OUTPUT_DIRECTORY/"$when"_"$why"_"$what".log if [ "$(ps -ef | grep -v grep | grep "mgr PARAMFILE" | grep "^.*${oraowner} " | wc -l)" -eq 0 ] then echo "GoldenGate is not running" >> ${LOG};echo "" >> ${LOG} else echo "GoldenGate is running" >> ${LOG};echo "" >> ${LOG} #ps -ef | grep "/ggate/product/" | grep -v grep >> ${LOG};echo "" >> ${LOG} ps -ef | grep -v grep | grep "^.*${oraowner} " | grep "mgr PARAMFILE" >> ${LOG};echo "" >> ${LOG} # Set Ora env ORACLE_SID=`ps -ef | grep pmon | sort -k9 | grep "^.*${oraowner} " | grep -v grep | grep "+ASM" | grep -v onitor | awk 'BEGIN{FS="_"}{print $NF}'` export ORAENV_ASK=NO >/dev/null; if [[ ! -z $ORACLE_SID ]]; then . oraenv >/dev/null else ORACLE_SID=`ps -ef | grep pmon | sort -k9 | grep "^.*${oraowner} " | grep -v grep | grep -v "+ASM" | grep -v "\-MGMTDB" | grep -v onitor | awk '{ print $NF }' | cut -d"_" -f3,4 -s | tail -1` . oraenv >/dev/null fi ps -ef | grep -v grep | grep "mgr PARAMFILE" | grep "^.*${oraowner} " | sed -n 's/.*\(...................................................................\/....prm \).*/\1/p' | awk '{ print $NF }' | sort | while read GG_MGRPROC do # Proceed only if Golden Gate Manager is running if [[ ! -z $GG_MGRPROC ]]; then #GG_HOME=`echo $GG_MGRPROC | sed 's/\/dirprm\/mgr.prm//g'` GG_HOME=`echo $GG_MGRPROC | sed 's/\/dirprm\/mgr.prm//g' | sed 's/\/dirprm\/MGR.prm//g'` if [[ -d $GG_HOME ]]; then ${GG_HOME}/ggsci << EOF >> ${LOG} info all exit EOF #echo "$op" >> ${LOG};echo "" >> ${LOG} fi fi done fi } status_dbfs() { echo "Collecting DBFS information ..... "; echo "" echo "***************************** DBFS **************************" >> ${LOG}; echo "" >> ${LOG} ps -ef | grep -v grep | grep "dbfs_client" | grep "^.*${oraowner} " | sed -n 's/.*\(................................................................\/bin\/dbfs_client\).*/\1/p' | awk '{ print $NF }' | grep -v "\.\.\.\.dbfs_client" >$OUTPUT_DIRECTORY/"$when"_"$why"_"$what".log if [ "$(ps -ef | grep -v grep | grep "dbfs_client" | grep "^.*${oraowner} " | wc -l)" -eq 0 ] then echo "DBFS is not running" >> ${LOG};echo "" >> ${LOG} else echo "DBFS is running" >> ${LOG};echo "" >> ${LOG} ps -ef | grep -v grep | grep "^.*${oraowner} " | grep "dbfs_client" >> ${LOG};echo "" >> ${LOG} fi } status_mrp() { echo "Collecting MRP information ..... "; echo "" echo "******************************** MRP *****************************" >> ${LOG}; echo "" >> ${LOG} ps -ef | grep mrp | sort -k9 | grep "^.*${oraowner} " | grep -v grep >> ${LOG} ; echo "" >> ${LOG} ps -ef | grep mrp | sort -k9 | grep "^.*${oraowner} " | grep -v grep | awk '{ print $NF }' | cut -d"_" -f3,4 -s >$OUTPUT_DIRECTORY/"$when"_"$why"_"$what".log if [ "$(ps -ef | grep mrp | grep "^.*${oraowner} " | grep -v grep | wc -l)" -eq 0 ] then echo "MRP is not running" >> ${LOG} ; echo "" >> ${LOG} else echo "MRP is running .. Collecting DG related Info" >> ${LOG} ; echo "" >> ${LOG} #Pickup DG LAG STATUS from Primary db DG_INST_1_LOG=$OUTPUT_DIRECTORY/pre_stop_dg_dbinst.log DG_INST_2_LOG=$OUTPUT_DIRECTORY/pre_stop_dg_Primdbinst.log rm -f ${DG_INST_1_LOG} rm -f ${DG_INST_2_LOG} while read data do export ORACLE_DB=$(echo $data | awk 'BEGIN{FS=":"}{print $1}') >/dev/null export ORACLE_SID=$(echo $data | awk 'BEGIN{FS=":"}{print $2}') >/dev/null export ORAENV_ASK=NO >/dev/null . oraenv >/dev/null echo "Checking Database Instance : "$ORACLE_SID >> ${LOG}; op=`$ORACLE_HOME/bin/sqlplus -s '/ as sysdba'<< EOFDB2 set heading off; set echo off; set linesize 200 pages 100; select 'PRIMARY_DB_UNIQUE:'||PRIMARY_DB_UNIQUE_NAME||':STANDBY_DB_UNIQUE:'||DB_UNIQUE_NAME||':STANDBY_DB_INST:${ORACLE_SID}' from v\\$database where database_role like 'PHYSICAL STANDBY'; EOFDB2` echo "$op" | grep "PRIMARY_DB_UNIQUE:" >> ${DG_INST_1_LOG} done < $OUTPUT_DIRECTORY/db:inst.log if [[ -f ${DG_INST_1_LOG} ]]; then STANDBY_CNT=`cat ${DG_INST_1_LOG} | wc -l` if [[ $STANDBY_CNT -ne 0 ]]; then cat ${DG_INST_1_LOG} | while read dgline do PRIM_DB_SID=`echo $dgline | cut -d":" -f2 -s` STANDBY_DB_SID=`echo $dgline | cut -d":" -f4 -s` STANDBY_DB_INST=`echo $dgline | cut -d":" -f6 -s` if [[ ! -z $PRIM_DB_SID ]]; then op=`$ORACLE_HOME/bin/sqlplus -s '/ as sysdba' << EOFDB2 conn dba_ro/${dba_ro_p}@${PRIM_DB_SID} set heading off; set echo off; set linesize 200 pages 100; select d.name||':'||b.dest_id||':'||b.DRNAME||':'||max(a.Primary_sequence - b.DR_sequence) from v\\$database d,(select thread#, SEQUENCE# Primary_sequence from v\\$log where status='CURRENT') a, (select thread#,RESETLOGS_CHANGE#,max(sequence#) DR_sequence,dest_id,upper(name) DRNAME from v\\$archived_log where dest_id in (2,3) and applied in ('YES','IN-MEMORY') group by thread#,RESETLOGS_CHANGE#,dest_id,upper(name)) b where d.RESETLOGS_CHANGE#=b.RESETLOGS_CHANGE# and a.thread#=b.thread# and b.DRNAME is not null and b.DRNAME not like '%/%' group by d.name,b.dest_id,b.DRNAME; EOFDB2` echo "${op}:${STANDBY_DB_INST}" >> ${DG_INST_2_LOG} if [[ -f ${DG_INST_2_LOG} ]]; then echo "" >> ${LOG}; echo "Active DG destinations detected on Primary db: $PRIM_DB_SID .. " >> ${LOG}; echo "" >> ${LOG}; echo "PRIMARY_DB:DEST_ID:STANDBY_DB:CURRENT_LAG:STANDBY_LOCAL_INST" >> ${LOG}; echo "============================================================" >> ${LOG}; echo "`cat ${DG_INST_2_LOG} | grep ":${STANDBY_DB_SID}:"`" >> ${LOG}; echo "" >> ${LOG}; echo "" >> ${LOG}; fi fi done fi fi fi } status_em() { echo "Collecting EMAGENT information ..... "; echo "" echo "***************************** EMAGENT ************************" >> ${LOG}; echo "" >> ${LOG} if [ $(ps -ef | grep emagent | grep "^.*${oraowner} " | grep -v grep | wc -l) != 0 ] then ORACLE_SID=`cat /etc/oratab | awk 'BEGIN{FS=":"}{print $1}' | grep OEM | grep -v "^#"` export ORAENV_ASK=NO >/dev/null; if [[ ! -z $ORACLE_SID ]]; then . oraenv >/dev/null emctl status agent >> ${LOG} ; echo "" >> ${LOG} fi emctl status agent | grep "Agent is Running and Ready" > $OUTPUT_DIRECTORY/"$when"_"$why"_"$what".log else echo "EMAgent is not running" >> ${LOG} ; echo "" >> ${LOG} fi } status_fgl() { echo "Collecting FOGLIGHT information ..... "; echo "" echo "**************************** FOGLIGHT ****************************" >> ${LOG}; echo "" >> ${LOG} ps -ef | grep -i foglight | grep "^.*${oraowner} " | grep -v grep >> ${LOG} ; echo "" >> ${LOG} ps -ef | grep -i foglight | grep "^.*${oraowner} " | grep -v grep|head -1 > $OUTPUT_DIRECTORY/"$when"_"$why"_"$what".log if [ "$(ps -ef | grep -i foglight | grep "^.*${oraowner} " | grep -v grep | wc -l)" -eq 0 ] then echo "Foglight is not running" >> ${LOG} ; echo "" >> ${LOG} fi } status_osw() { echo "Collecting OSWATCHER information ..... "; echo "" echo "**************************** OSWATCHER ****************************" >> ${LOG}; echo "" >> ${LOG} ps -ef | grep -i OSW | grep "^.*${oraowner} " | grep -v grep >> ${LOG} ; echo "" >> ${LOG} ps -ef | grep -i OSW | grep "^.*${oraowner} " | grep -v grep |head -1 > $OUTPUT_DIRECTORY/"$when"_"$why"_"$what".log if [ "$(ps -ef | grep -i OSW | grep "^.*${oraowner} " | grep -v grep | wc -l)" -eq 0 ] then echo "OSWatcher is not running" >> ${LOG} ; echo "" >> ${LOG} fi } status_portutil() { echo "Collecting PORT UTILITY information ..... "; echo "" echo "**************************** PORT UTILITY ****************************" >> ${LOG}; echo "" >> ${LOG} #ps -ef | grep 10101 | grep -v grep | grep port >> ${LOG} ; echo "" >> ${LOG} ps -ef | grep "portdaemon.pl" | grep -v grep | grep port >> ${LOG} ; echo "" >> ${LOG} ps -ef | grep "portdaemon.pl" | grep -v grep | grep port |head -2 > $OUTPUT_DIRECTORY/"$when"_"$why"_"$what".log #if [ "$(ps -ef | grep 10101 | grep -v grep | grep port | wc -l)" -ge 1 ] if [ "$(ps -ef | grep "portdaemon.pl" | grep -v grep | grep port | wc -l)" -ge 1 ] then echo "Port Utility is running" >> ${LOG} ; echo "" >> ${LOG} else echo "Port Utility is not running" >> ${LOG} ; echo "" >> ${LOG} fi } status_tfa() { echo "Collecting TFA information ..... "; echo "" echo "***************************** TFA **************************" >> ${LOG}; echo "" >> ${LOG} ps -ef | grep -v grep | grep tfa_home |head -1 > $OUTPUT_DIRECTORY/"$when"_"$why"_"$what".log if [ "$(ps -ef | grep -v grep | grep tfa_home | wc -l)" -eq 0 ] then echo "TFA is not running" >> ${LOG};echo "" >> ${LOG} else echo "TFA is running" >> ${LOG};echo "" >> ${LOG} ps -ef | grep -v grep | grep "tfa_home" >> ${LOG};echo "" >> ${LOG} fi } status_bda() { echo "Collecting BDA Agent information ..... "; echo "" echo "***************************** BDA **************************" >> ${LOG}; echo "" >> ${LOG} ps -ef | grep -v grep | grep dagent.conf |head -1 > $OUTPUT_DIRECTORY/"$when"_"$why"_"$what".log BDA_AGT=$OUTPUT_DIRECTORY/pre_stop_bda.log if [ "$(ps -ef | grep -v grep | grep dagent.conf | wc -l)" -eq 0 ] then echo "BDA Agent is not running" >> ${LOG};echo "" >> ${LOG} echo "no" > $BDA_AGT else echo "BDA Agent is running" >> ${LOG};echo "" >> ${LOG} ps -ef | grep -v grep | grep "dagent.conf" >> ${LOG};echo "" >> ${LOG} echo "yes" > $BDA_AGT fi } status_fs() { echo "Collecting FILESYSTEM information ..... "; echo "" echo "**************************** FILESYSTEM ***************************" >> ${LOG}; echo "" >> ${LOG} ; df -Pk > $OUTPUT_DIRECTORY/"$when"_"$why"_"$what".log df -Pk >> ${LOG} ; echo "" >> ${LOG} echo "OCFS Information... " >> ${LOG} ; if [[ -f /etc/fstab ]]; then grep ocfs /etc/fstab >> ${LOG} ; echo "" >> ${LOG} fi #Get Core FS Count df -Pk | sed -n '1!p' | grep -v " /home" | grep -v " /.efs" | grep -v " /efs" | grep -v " /run" | grep -v " /apps/oracle" | grep -v " /tempmnt" | grep -v " /Net" | grep -v " /net" | grep -v " /dbacl" | wc -l > $OUTPUT_DIRECTORY/pre_disk_fs_mount.cnt df -Pk | sed -n '1!p' | awk '{ print $NF }' | grep -v "^/home" | grep -v "^/.efs" | grep -v "^/efs" | grep -v "^/run" | grep -v "^/apps/oracle" | grep -v "^/tempmnt" | grep -v "^/Net" | grep -v "^/net" | grep -v "^/dbacl" > $OUTPUT_DIRECTORY/pre_disk_fs_mount.log } status_disk() { echo "Collecting DISK information ..... "; echo "" echo "******************************* DISK ******************************" >> ${LOG}; echo "" >> ${LOG} ; if [[ $OS != "AIX" ]]; then ls -l /dev/mapper|egrep "asm.*p1|fra.*p1|gg.*p1"|while read line do named_disk=$(echo $line|xargs|cut -f9 -d" ") dm_disk=$(echo $line|xargs|cut -f11 -d" "|cut -f2 -d"/") echo "${named_disk}" ls -l /dev/${dm_disk} done > $OUTPUT_DIRECTORY/disk_info.lst filename=$(date '+%m%d%Y_%H%M%S') mv $OUTPUT_DIRECTORY/disk_info.lst $OUTPUT_DIRECTORY/disk_info_$filename.lst echo "Disk ownership information is available at $OUTPUT_DIRECTORY/disk_info_$filename.lst" >> ${LOG} ; echo "" >> ${LOG} fi } status_standalone_autostart() { echo "Collecting ORATAB and LSNRTAB information ..... "; echo "" echo "******************************* STANDALONE AUTO-START INFO (/etc/oratab and /etc/lsnrtab contents) ******************************" >> ${LOG}; echo "" >> ${LOG} ; if [[ -f /etc/oratab ]]; then echo "" >> ${LOG} echo "/etc/oratab =>" >> ${LOG} echo "" >> ${LOG} echo "`cat /etc/oratab`" >> ${LOG} ; echo "" >> ${LOG} echo "" >> ${LOG} else echo "" >> ${LOG} echo " NO /etc/oratab FOUND on this host!" >> ${LOG} ; echo "" >> ${LOG} echo "" >> ${LOG} fi if [[ -f /etc/lsnrtab ]]; then echo "" >> ${LOG} echo "/etc/lsnrtab =>" >> ${LOG} echo "" >> ${LOG} echo "`cat /etc/lsnrtab`" >> ${LOG} ; echo "" >> ${LOG} echo "" >> ${LOG} else echo "" >> ${LOG} echo " NO /etc/lsnrtab FOUND on this host!" >> ${LOG} ; echo "" >> ${LOG} echo "" >> ${LOG} fi } status_status() { if [[ -f $OUTPUT_DIRECTORY/pre_"$why"_"$what".log ]]; then if [[ "$(cat $OUTPUT_DIRECTORY/pre_"$why"_"$what".log | wc -l)" -gt 0 ]]; then echo "yes" > $OUTPUT_DIRECTORY/"$why"_"$what".log else echo "no" > $OUTPUT_DIRECTORY/"$why"_"$what".log fi fi } # Remove the temporary log file rm -f $OUTPUT_DIRECTORY/status.log # Assign a new log file LOG=$OUTPUT_DIRECTORY/status.log; echo "" >> ${LOG}; #ASSIGNING THE OUTPUT VARIABLES assign_log() { if [ -s $OUTPUT_DIRECTORY/pre_status_crs.log ] then crs_output=`cat $OUTPUT_DIRECTORY/pre_status_crs.log` else crs_output="no_status" fi if [ -s $OUTPUT_DIRECTORY/pre_status_has.log ] then crs_output=`cat $OUTPUT_DIRECTORY/pre_status_has.log` else crs_output="no_status" fi if [ -s $OUTPUT_DIRECTORY/pre_status_asm.log ] then asm_output=`cat $OUTPUT_DIRECTORY/pre_status_asm.log` else asm_output="no_status" fi if [ -s $OUTPUT_DIRECTORY/pre_status_esm.log ] then esm_agent_output=`cat $OUTPUT_DIRECTORY/pre_status_esm.log` else esm_agent_output="no_status" fi if [ -s $OUTPUT_DIRECTORY/pre_status_dma.log ] then dma_agent_output=`cat $OUTPUT_DIRECTORY/pre_status_dma.log` else dma_agent_output="no_status" fi if [ -s $OUTPUT_DIRECTORY/pre_status_lsnr.log ] then listener_output=`cat $OUTPUT_DIRECTORY/pre_status_lsnr.log` else listener_output="no_status" fi if [ -s $OUTPUT_DIRECTORY/db:inst ] then db_instance_output=`cat $OUTPUT_DIRECTORY/db:inst` else db_instance_output="no_status" fi if [ -s $OUTPUT_DIRECTORY/dbopen:info.log ] then db_open_output=`cat $OUTPUT_DIRECTORY/dbopen:info.log` else db_open_output="no_status" fi if [ -s $OUTPUT_DIRECTORY/unidb:inst.log ] then db_unique_output=`cat $OUTPUT_DIRECTORY/unidb:inst.log` else db_unique_output="no_status" fi if [ -s $OUTPUT_DIRECTORY/pre_status_dbmount.log ] then db_mount_output=`cat $OUTPUT_DIRECTORY/pre_status_dbmount.log` else db_mount_output="no_status" fi if [ -s $OUTPUT_DIRECTORY/pre_status_dbservices.log ] then service_alignment_output=`cat $OUTPUT_DIRECTORY/pre_status_dbservices.log` else service_alignment_output="no_status" fi if [ -s $OUTPUT_DIRECTORY/pre_status_mrp.log ] then mrp_output=`cat $OUTPUT_DIRECTORY/pre_status_mrp.log` else mrp_output="no_status" fi if [ -s $OUTPUT_DIRECTORY/pre_status_em.log ] then oem_agent_output=`cat $OUTPUT_DIRECTORY/pre_status_em.log` else oem_agent_output="no_status" fi if [ -s $OUTPUT_DIRECTORY/pre_status_portutil.log ] then port_utility_output=`cat $OUTPUT_DIRECTORY/pre_status_portutil.log` else port_utility_output="no_status" fi if [ -s $OUTPUT_DIRECTORY/pre_status_fgl.log ] then foglight_output=`cat $OUTPUT_DIRECTORY/pre_status_fgl.log` else foglight_output="no_status" fi if [ -s $OUTPUT_DIRECTORY/pre_status_osw.log ] then os_watcher_output=`cat $OUTPUT_DIRECTORY/pre_status_osw.log` else os_watcher_output="no_status" fi if [ -s $OUTPUT_DIRECTORY/pre_status_usb.log ] then usb_output=`cat $OUTPUT_DIRECTORY/pre_status_usb.log` else usb_output="no_status" fi if [ -s /oracle/dba/foglight/fgl_5/bin/fglam ] then fglam_output=`/oracle/dba/foglight/fgl_5/bin/fglam --check-connection` else fglam_output="no_status" fi if [ -s $OUTPUT_DIRECTORY/server_type.log ] then instance_type=`cat $OUTPUT_DIRECTORY/server_type.log` else instance_type="no_status" fi if [ -s $OUTPUT_DIRECTORY/version_executed_status.log ] then script_version=`cat $OUTPUT_DIRECTORY/version_executed_status.log` else script_version="no_status" fi } insert_repdb() { why=status; for what in fgl osw agent portutil lsnr mrp db asm has em dma esm do status_status; done for what in fgl osw agent portutil lsnr mrp db asm has em do if [ -s $OUTPUT_DIRECTORY/status_$what.log ] then eval var_$what=`cat $OUTPUT_DIRECTORY/status_$what.log` else eval var_$what="no_status" fi done var_esm=na; var_dma=na; #PREPARING THE INSERT STATEMENT if [ $(cat /etc/oratab | grep oracle | grep -v -i asm | grep -v -i crs | grep -v -i oem | grep -v "#" | awk 'BEGIN{FS=":"}{print $1}' | head -1 | wc -l) = 1 ] then export ORACLE_SID=`cat /etc/oratab | grep oracle | grep -v -i asm | grep -v -i crs | grep -v -i oem | grep -v "#" | awk 'BEGIN{FS=":"}{print $1}' | head -1` export ORAENV_ASK=NO >/dev/null . oraenv >/dev/null $ORACLE_HOME/bin/sqlplus -s OSH_SEH/dbaas_operations1@SUNDVD94 << EOFSTATUS set echo off; set head off; set feedback off; insert into OSH_SEH.dbss_log (DBSS_ID, SCRIPT_VERSION, INSTANCE_TYPE, STOP_OR_START, CRS_OR_DB, SERVER_NAME, SERVER_TIMESTAMP, CRS, ASM, LISTENER, DB_INSTANCE, MRP_PROCESS, ESM_AGENT, DMA_AGENT, OEM_AGENT, PORT_UTILITY, FOGLIGHT, OS_WATCHER, SENT_MAIL, CRS_OUTPUT, ASM_OUTPUT, LISTENER_OUTPUT, DB_INSTANCE_OUTPUT, DB_OPEN_OUTPUT, DB_OPENRO_OUTPUT, DB_MOUNT_OUTPUT, SERVICE_ALIGNMENT_OUTPUT, MRP_OUTPUT, ESM_AGENT_OUTPUT, DMA_AGENT_OUTPUT, OEM_AGENT_OUTPUT, PORT_UTILITY_OUTPUT, FOGLIGHT_OUTPUT, OS_WATCHER_OUTPUT, USB_OUTPUT, FGLAM_OUTPUT, DB_UNIQUE_OUTPUT) values (DBSS_LOG_SEQ.nextval, '$script_version', '$instance_type', 'status', 'db', '$(hostname -f)', '$timevalue', '$var_has', '$var_asm', '$var_lsnr', '$var_db', '$var_mrp', '$var_esm', '$var_dma', '$var_em', '$var_portutil', '$var_fgl', '$var_osw', 0, '$crs_output', '$asm_output', '$listener_output', '$db_instance_output', '$db_open_output', '$db_openro_output', '$db_mount_output', '$service_alignment_output', '$mrp_output', '$esm_agent_output', '$dma_agent_output', '$oem_agent_output', '$port_utility_output', '$foglight_output', '$os_watcher_output', '$usb_output', '$fglam_output', '$db_unique_output'); commit; EOFSTATUS fi } echo "************************* START TIME : $(date) ************************" >> ${LOG}; echo "" >> ${LOG} case $server_type in "rac_12c") echo "" ; echo "---------------------------------------------------------------------------------------" >> ${LOG}; echo "---------------------------> THIS IS A 12c CLUSTERWARE SYSTEM <------------------------- " >> ${LOG}; echo "---------------------------------------------------------------------------------------" >> ${LOG}; why=status; when=pre; for what in has asm db mrp lsnr dbfs gg em fgl osw portutil fs disk tfa ora_homes bda do status_$what; done assign_log insert_repdb ;; "rac_11g") echo "" ; echo "---------------------------------------------------------------------------------------" >> ${LOG}; echo "---------------------------> THIS IS A 11g CLUSTERWARE SYSTEM <------------------------- " >> ${LOG}; echo "---------------------------------------------------------------------------------------" >> ${LOG}; why=status; when=pre; for what in has asm db mrp lsnr dbfs gg em fgl osw portutil fs disk tfa ora_homes bda do status_$what; done assign_log insert_repdb ;; "rac_10g") echo "" ; echo "---------------------------------------------------------------------------------------" >> ${LOG}; echo "---------------------------> THIS IS A 10g CLUSTERWARE SYSTEM <------------------------- " >> ${LOG}; echo "---------------------------------------------------------------------------------------" >> ${LOG}; why=status; when=pre; for what in crs asm db mrp lsnr gg em fgl osw portutil fs disk ora_homes bda do status_$what; done assign_log insert_repdb ;; "norac_asm12c") echo "" ; echo "---------------------------------------------------------------------------------------" >> ${LOG}; echo "-------------------------> THIS IS A NON-RAC SYSTEM BUT WITH ASM 12c <----------------- " >> ${LOG}; echo "---------------------------------------------------------------------------------------" >> ${LOG}; why=status; when=pre; for what in asm db mrp lsnr dbfs gg em fgl osw portutil fs disk tfa ora_homes bda do status_$what; done assign_log insert_repdb ;; "norac_asm11g") echo "" ; echo "---------------------------------------------------------------------------------------" >> ${LOG}; echo "-------------------------> THIS IS A NON-RAC SYSTEM BUT WITH ASM 11g <----------------- " >> ${LOG}; echo "---------------------------------------------------------------------------------------" >> ${LOG}; why=status; when=pre; for what in asm db mrp lsnr dbfs gg em fgl osw portutil fs disk tfa ora_homes bda do status_$what; done assign_log insert_repdb ;; "norac_asm10g") echo "" ; echo "---------------------------------------------------------------------------------------" >> ${LOG}; echo "-------------------------> THIS IS A NON-RAC SYSTEM BUT WITH ASM 10g <----------------- " >> ${LOG}; echo "---------------------------------------------------------------------------------------" >> ${LOG}; why=status; when=pre; for what in asm db mrp lsnr gg em fgl osw portutil fs disk tfa ora_homes bda do status_$what; done assign_log insert_repdb ;; "norac_noasm") echo "" ; echo "---------------------------------------------------------------------------------------" >> ${LOG}; echo "--------------------------> THIS IS A NON-RAC & NON-ASM SYSTEM <----------------------- " >> ${LOG}; echo "---------------------------------------------------------------------------------------" >> ${LOG}; why=status; when=pre; for what in db mrp lsnr gg em fgl osw portutil fs disk ora_homes bda standalone_autostart do status_$what; done assign_log insert_repdb ;; *) echo "Invalid Selection" esac filename=$(echo $(hostname) | cut -d. -f1)_$(date '+%m%d%Y_%H%M%S') mv ${LOG} $OUTPUT_DIRECTORY/status_$filename.log echo "" >> ${LOG}; echo "" >> ${LOG}; echo "******************************************************************************************************"; echo "Please check the detailed STATUS report at $OUTPUT_DIRECTORY/status_$filename.log" echo "******************************************************************************************************"; echo "" >> ${LOG};