1 Version Information
Oracle Database version: Oracle release 10.2.0.1.0
System version: Red Hat enterpriselinux 5.4
2 Detection Step 2.1 writing a shell script
Under users who have Sqlplus Execute permissions, edit the check_oracle_connection.sh script.
VI check_oracle_connection.sh
Edit the contents as follows:
#!/bin/bash#functions:connect Oracle Server Test#author:areskris john#modify_date:2014-11-18.mkdir-p/home/gapsv4/ Log/oracle #创建日志存放路径LOG_DIR =/home/gapsv4/log/oracle #日志存放路径rm-rf $LOG _dir/* #删除旧日志USERNAME =bodcmp #数据库用户名PASSWORD =bodcmp #数据库密码SIDNAME =ora10g #数据库实例名icount =0while ["$icount"-lt]do { count=0 while ["$count"-lt] do log_file= $LOG _dir/check_oracle_$icount. $count. LOG Echo ' Sqlplus $USERNAME/[email protected] $SIDNAME << EOF set echo off set feedback off spool $LOG _file< C15/>alter session Set nls_date_format= ' Yyyy-mm-dd:hh24:mi:ss '; Select Sysdate from dual; Spool off set echo on set feedback on exit EOF ' >> $LOG _file let count= $count +1 Done } & let icount= $icount +1done
2.2 Executing shell scripts
Call bash directly to execute the check_oracle_connection.sh script.
Bash check_oracle_connection.sh
2.3 Script Execution Results analysis
After the script is executed, the Oracle database connection is analyzed based on the results of the script execution. The situation is as follows:
1, if there are individual log reports during the execution of the connection or failure of the query, then prove that the Oracle database connection is not stable, there is a problem.
2, if in the execution process all log the connection or the query failure error, then proves that the Oracle instance or the listener process did not start.
3, if there is no log error during the execution, then it proves that the Oracle database connection is normal and the instance is running correctly.
Oracle Database Connection detection (Shell)