Retrieve database list without use oratab
Closed this issue · 0 comments
Use pmon command to retrieve running instances and pwdx command to retrieve oracle home path used by database instances on the DB server.
Following command example with related output:
PMON
ps -ef | grep pmon | grep -v grep| grep -v ASM| grep -v APX| grep -v FOMUT0_U| grep -v FOCSB0_T
[root@exavb19db01 ercole-agent]# ps -ef | grep pmon | grep -v grep| grep -v ASM| grep -v APX| grep -v FOMUT0_U| grep -v FOCSB0_T
oracle 28437 1 0 May16 ? 00:13:13 ora_pmon_c014a1py1
oracle 115115 1 0 Mar15 ? 00:23:42 ora_pmon_c012a1py1
oracle 115207 1 0 Mar15 ? 00:18:47 ora_pmon_c006a1py1
oracle 115208 1 0 Mar15 ? 00:19:23 ora_pmon_c002a1py1
oracle 306488 1 0 May17 ? 00:12:44 ora_pmon_c001a1py1
PWDX
for each previous row:
while rows
do
PROC=$(echo $i| awk '{print $2}')
SID=$(echo $i | awk -F "ora_pmon_" '{print $NF}')
ENTRY=$(echo "$SID:$(sudo pwdx $PROC| awk -F : '{print $2}')"| tr -d ' ')
echo ${ENTRY%????}:N
done
c014a1py1:/app/oracle/product/19.19_00:N
c012a1py1:/app/oracle/product/19.19_00:N
c006a1py1:/app/oracle/product/19.17_00:N
c002a1py1:/app/oracle/product/19.17_00:N
c001a1py1:/app/oracle/product/19.17_00:N
These commands have to be executed with FetcherUser user.
Add a configuration parameter to define which solution to use:
- default or not defined -> read oratab as already implemented yet
- xxxx -> new solution without access to oratab