automation-healthcheck

Problem for automation

[user@server lk]$ CONCSUB apps/passwordofuser SYSADMIN 'System Administrator' SYSADMIN WAIT=N CONCURRENT FND FNDSCURS > req.txt
[user@server lk]$ cat req.txt
Submitted request 4632124 for CONCURRENT FND FNDSCURS

[user@server lk]$ awk '{print $3}' req.txt
4632124


SQL> SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[user@server lk]$ CONCSUB apps/passwordofuser SYSADMIN 'System Administrator' SYSADMIN WAIT=N CONCURRENT FND FNDSCURS > req.txt
[user@server lk]$ > req.txt
[user@server lk]$ cat req.txt
[user@server lk]$ CONCSUB apps/passwordofuser SYSADMIN 'System Administrator' SYSADMIN WAIT=N CONCURRENT FND FNDSCURS > req.txt
[user@server lk]$ cat req.txt
Submitted request 4632126 for CONCURRENT FND FNDSCURS

[user@server lk]$ sqlplus apps/passwordofuser << EOF
> spool healthcheck.txt
> set lines 300
> select a.user_concurrent_program_name , a.CONCURRENT_PROGRAM_ID , REQUEST_ID
> ,REQUEST_TYPE,PHASE_CODE  , STATUS_CODE , ACTUAL_START_DATE ,COMPLETION_TEXT
> from fnd_concurrent_programs_tl a, fnd_concurrent_requests b
> where a.concurrent_program_id=b.concurrent_program_id
> and program_application_id=0
> and REQUEST_ID=4632126;
> spool off;
> exit;
> EOF

SQL*Plus: Release 8.0.6.0.0 - Production on Wed Apr 1 07:41:10 2020

(c) Copyright 1999 Oracle Corporation.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> SQL> SQL>   2    3    4    5    6
USER_CONCURRENT_PROGRAM_NAME                                                                                                               CONCURRENT_PROGRAM_ID REQUEST_ID R P S ACTUAL_ST
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ --------------------- ---------- - - - ---------
COMPLETION_TEXT
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Active Users                                                                                                                               20641     4632126   C C 01-APR-20
Normal Running


***After few minits--we dont estimate the time***

SQL> SQL> SQL>   2    3    4    5    6
USER_CONCURRENT_PROGRAM_NAME                                                                                                               CONCURRENT_PROGRAM_ID REQUEST_ID R P S ACTUAL_ST
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ --------------------- ---------- - - - ---------
COMPLETION_TEXT
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Active Users                                                                                                                               20641     4632126   C C 01-APR-20
Normal completion


when it get the status like completion then we need to conculde that reqeust has been completed and application is running fine




########################SOLUTION IS #######healthcheck report for oracle apps

#!/bin/sh
username=$1;
password=$2;
> req.txt;
> healthcheck.txt;
sd=`echo $TWO_TASK`
CONCSUB $1/$2 SYSADMIN 'System Administrator' SYSADMIN WAIT=N CONCURRENT FND FNDSCURS > req.txt
requid=`awk '{print $3}' req.txt`
echo $requid;
sqlplus $1/$2 << EOF
spool healthcheck.txt
set lines 300
select a.user_concurrent_program_name , a.CONCURRENT_PROGRAM_ID , REQUEST_ID
,REQUEST_TYPE,PHASE_CODE  , STATUS_CODE , ACTUAL_START_DATE ,COMPLETION_TEXT
from fnd_concurrent_programs_tl a, fnd_concurrent_requests b
where a.concurrent_program_id=b.concurrent_program_id
and program_application_id=0
and REQUEST_ID=$requid;
spool off;
exit;
EOF
####REQSTATUS####
a=`cat healthcheck.txt|grep Normal|wc -l`
while [ $a -le 1 ]
do
> healthcheck.txt
echo "$requid is running"
sleep 2
sqlplus $1/$2 << EOF
spool healthcheck.txt
set lines 300
select a.user_concurrent_program_name , a.CONCURRENT_PROGRAM_ID , REQUEST_ID
,REQUEST_TYPE,PHASE_CODE  , STATUS_CODE , ACTUAL_START_DATE ,COMPLETION_TEXT
from fnd_concurrent_programs_tl a, fnd_concurrent_requests b
where a.concurrent_program_id=b.concurrent_program_id
and program_application_id=0
and REQUEST_ID=$requid;
spool off;
exit;
EOF
a=`cat healthcheck.txt|grep Normal|wc -l`
done
rm -rf healthcheck.txt
>outfile.txt
echo REQUESTID=$requid > outfile.txt
echo PROGRAMNAME="Active users" >>outfile.txt
echo STATUS="COMPLETED" >> outfile.txt
echo PHASE="NORMAL" >> outfile.txt
###DBSTATUS#####
###spool DB.txt
sqlplus $1/$2 << EOF
spool DB.txt
conn $1/$2
select * from global_name;
spool off;
exit;
EOF
b=`cat DB.txt|grep Connected|wc -l`
if [$b -ge 1 ]
then
rm -rf DB.txt
echo DATABASENAME=$sd >> outfile.txt
echo DBSTATUS="UP AND RUNNING" >> outfile.txt
fi
########APACHE STATUS#############
as=`pwd`
rm -rf apache.txt
cd $COMMON_TOP/admin/scripts/$TWO_TASK*
rm -rf apache.txt
sh adapcctl.sh status > apache.txt
chmod -R 777 apache.txt
cp -r apache.txt $as
cd $as
p=`cat apache.txt|grep not|wc -l`
if [$p -ge 1 ]
then
echo APACHESTATUS="APACHE IS NOT RUNNING"  >> outfile.txt
else
echo APACHESTATUS="APACHE IS UP AND  RUNNING" >> outfile.txt
fi