Pavan DBA's Blog

The DBA Knowledge Store

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 4,848 other followers

  • Follow Pavan DBA's Blog on
  • Visitor Count

  • Categories

  • Vote your opinion…

  • Advertisements

script to check db status in a server

Posted by Pavan DBA on May 24, 2012

script to check db status in a server


setenv ORATAB /var/opt/oracle/oratab
foreach x (`cat ${ORATAB} | grep -v “^#”| grep “^[a-z]” | grep -v “demo” | grep -v “test”| grep -v “*” | awk -F:

‘{print $1}’`)
        setenv ORAENV_ASK 1
        setenv ORACLE_SID “$x”
        source /usr/local/default/oracle_sid.csh
            sqlplus -s <<EOF
        / as sysdba
        set lines 132 pages 200 hea off feedback off trims on
        col host_name for a20
                spool chk_dbstatus.log
        select instance_name, host_name, logins, version, status from v\$instance;
                spool off

Note: The above script is written using “C” shell, so if you are using any other shell, make necessary changes. Also as always first test it in lower environments


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: