Skip to content

Instantly share code, notes, and snippets.

@mmaha
Last active September 30, 2015 03:27
Show Gist options
  • Save mmaha/1713411 to your computer and use it in GitHub Desktop.
Save mmaha/1713411 to your computer and use it in GitHub Desktop.
Oracle Database Status script
#!/bin/sh
# Reference: http://docs.oracle.com/cd/B28359_01/server.111/b32009/strt_stp.htm
#
if [[ $EUID -ne 0 ]]; then
echo "This script needs to be run as root (or oracle)"
exit 1
fi
export ORACLE_HOME=`cat /etc/oratab | grep -v "^#" | grep -v "^$" | cut -d':' -f 2`
export ORACLE_SID=`cat /etc/oratab | grep -v "^#" | grep -v "^$" | cut -d':' -f 1`
export PATH=$ORACLE_HOME/bin:$PATH
echo --- --- ---
service iptables status
echo --- --- ---
tnsping idmdb
echo --- --- ---
cat /etc/oratab
echo --- --- ---
env | grep -i oracle
echo --- --- ---
emctl status agent
emctl status dbconsole
echo --- --- ---
lsnrctl status
echo --- --- ---
lsnrctl service
echo --- --- ---
ps -ef | grep tnslsnr
echo --- --- ---
sqlplus '/ AS SYSDBA' << ENDOFSQL
select sysdate from dual;
show parameter instance_name;
exit;
ENDOFSQL
echo # # END # #
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment