20070607 script to check on an oracle db - plembo/onemoretech GitHub Wiki

title: Script to check on an Oracle DB link: https://onemoretech.wordpress.com/2007/06/07/script-to-check-on-an-oracle-db/ author: lembobro description: post_id: 694 created: 2007/06/07 21:12:00 created_gmt: 2007/06/07 21:12:00 comment_status: open post_name: script-to-check-on-an-oracle-db status: publish post_type: post

Script to check on an Oracle DB

Just a simple shell script that uses tnsping to check if a remote db is listening.
$ORACLE_HOME and $ORACLE_SID are hardcoded (there are fancier scripts around that go out to parse oratab and tnsnames.ora, which is particularly useful when you want to ping more than one instance).
#!/bin/bash ORACLE_HOME=/u01/app/oracle/product/10.2.0/client ORACLE_SID=testdb RESULT=$ORACLE_HOME/bin/tnsping $ORACLE_SID|grep -q OK if [ $? -eq 0 ]; then echo “db is up” else echo “db is down” fi

Copyright 2004-2019 Phil Lembo