Sunday, March 13, 2016

Sample code or Autmation to check EBS Health check or sanity regularly


Below Shell script should be registered with a concurrent program and scheduled at regular intervals to confirm the sanity check of EBS Components

#! /usr/bin/ksh
SUBJECT="QFIN_SANITY_CHECK"
EMAIL=giriraj.inja@xyz.com

rm sanity.log
rm sanity_check.log
rm s.log
rm qfinsanity.log
touch qfinsanity.log
touch sanity.log
touch sanity_check.log

/opt/oracle/qfin/qfincomn/admin/scripts/qfin_sq099fin02/adcmctl.sh status apps/goofy |grep -i "Internal Concurrent Manager is" >> sanity.log
echo " Active User Request " >> sanity.log

CONCSUB apps/goofy@qfin SYSADMIN 'System Administrator' SYSADMIN WAIT=N CONCURRENT FND FNDSCURS >> sanity.log
if [ $? -ne 0 ]
then
    echo failed
mailx -s "QFIN INSTANCE CHECK ERROR "  giriraj.inja@xyz.com < error.log
else
sqlplus apps/goofy@qfin <<END
set echo off
set lines 120
set heading off
set feedback off
set serveroutput on
set echo off
spool s.log
exec test_check.db_check();
exec test_check.comp_check();
exit
END
if [ $? -ne 0 ]
then
    echo failed
mailx -s "QFIN INSTANCE CHECK ERROR "  giriraj.inja@xyz.com < error.log
else
cat s.log |grep -v "SQL>" >> sanity.log
mailx -s $SUBJECT $EMAIL < sanity.log
fi




test_check.db_check is package that query status of db and application nodes

select
NODE_NAME,
decode(STATUS,'Y','ACTIVE','INACTIVE') Status,
decode(SUPPORT_CP,'Y', 'ConcMgr','No') ConcMgr,
decode(SUPPORT_FORMS,'Y','Forms', 'No') Forms,
decode(SUPPORT_WEB,'Y','Web', 'No') WebServer,
decode(SUPPORT_ADMIN, 'Y','Admin', 'No') Admin,
decode(SUPPORT_DB, 'Y','Rdbms', 'No') Database
from fnd_nodes
where node_name != 'AUTHENTICATION';

No comments: