检查Oracle数据库的最大连接

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

[root@hzvscmdb sql]# more check_connect_oracle.sh
#!/bin/bash
#functions: connect oracle server test
#author:Tony Wang
#modify_date: 2015-06-03.
mkdir -p /home/tony/shell/sql/log  #create the directory of log
LOG_DIR=/home/tony/shell/sql/log  #log path
rm -rf $LOG_DIR/*  #delete the expire log
USERNAME=hr  #user
PASSWORD=pass  #password
SIDNAME=tony1521  #TNS
icount=0
while [ "$icount" -lt 20 ]
do
  {
  count=0
  while [ "$count" -lt 10 ]
  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