From 2096425277beabe72b8bbac839049bead67f2eba Mon Sep 17 00:00:00 2001 From: amreo Date: Mon, 30 Sep 2019 09:34:11 +0200 Subject: [PATCH] Added pmon presence check --- fetch/dbstatus | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fetch/dbstatus b/fetch/dbstatus index 04201d4..1fac91d 100755 --- a/fetch/dbstatus +++ b/fetch/dbstatus @@ -32,6 +32,13 @@ export ORACLE_SID=$SID export ORACLE_HOME=$HOME export PATH=$HOME/bin:$PATH +RUNNING=$(ps -ef | grep pmon_$SID | grep -v grep | wc -l) +if [ "$RUNNING" -eq "0" ]; then + echo "unreachable!" + exit 0 +fi + + DB_STATUS=$(sqlplus -S / as sysdba << EOF set pages 0 feedback off select status from v\$instance;