Oracle Database Connection detection (Shell), oracle Database Connection

Source: Internet
Author: User

Oracle Database Connection detection (Shell), oracle Database Connection
Version 1

Oracle Database Version: Oracle Release 10.2.0.1.0

System Version: Red Hat guest iselinux 5.4

 

2 Check Step 2.1 write Shell scripts

Edit the check_oracle_connection.sh script for a user with SQLPLUS execution permission.

vi check_oracle_connection.sh
The Edit content is as follows:
#! /Bin/bash # functions: connect oracle server test # author: AresKris John # modify_date: 2014-11-18.mkdir-p/home/gapsv4/log/oracle # create a log storage path LOG_DIR =/home/gapsv4/log/oracle # log storage path rm-rf $ LOG_DIR/* # Delete the old one log USERNAME = bodcmp # Database username password = bodcmp # Database password sidname = ora10g # database instance name icount = 0 while ["$ icount"-lt 100] do {count = 0 while ["$ count"-lt 100] do LOG_FILE = $ LOG_DIR/check_oracle _ $ icount. $ count. log echo 'sqlplus $ USERNAME/$ PASSWORD @ $ SIDNAME <EOF set echo off set feedback off spool $ LOG_FILE 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 + 1 done

2.2 execute Shell scripts

Directly call bash to execute the check_oracle_connection.sh script.

bash check_oracle_connection.sh

2.3 script execution Result Analysis

After the script is executed, the Oracle database connection is analyzed based on the script execution results. The situation is as follows:

1. If some logs report connection or query failure errors during execution, the Oracle database connection is unstable and there is a problem.

2. If all logs report connection or query failure errors during execution, it indicates that the Oracle instance or listener process is not started.

3. If no log error is reported during execution, the Oracle database connection is normal and the instance runs normally.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.