#* * * * * /data/app/oracle/product/10.2.0/db_1/kill/monitor.sh > /dev/null 2>&1
-----------------------------------monitor.sh----------------------------------
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
TMP=/tmp; export TMP
ORACLE_HOME_LISTENER=$ORACLE_BASE ;export ORACLE_HOME_LISTENER
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/data/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=${PATH}:$ORACLE_HOME/bin/ export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
sqlplus system/fopsdb2008@fopsfat1 @/data/app/oracle/product/10.2.0/db_1/kill/monitor.sql
-----------------monitor.sql-----------------------------
set linesize 120
set echo off
set heading off
spool on
spool /data/app/oracle/product/10.2.0/db_1/kill/monitor_lock.spool
select s1.username,s1.osuser || '@' || s1.machine
|| ' ( SID=' || s1.sid || ' ) is blocking '
|| s2.username || '@' || s2.machine || ' ( SID=' || s2.sid || ' ) ' AS blocking_status
from v$lock l1, v$session s1, v$lock l2, v$session s2
where s1.sid=l1.sid and s2.sid=l2.sid
and l1.BLOCK=1 and l2.request > 0
and l1.id1 = l2.id1
and l2.id2 = l2.id2 ;
select sysdate from dual;
spool off
!cat /data/app/oracle/product/10.2.0/db_1/kill/monitor_lock.spool >> /data/app/oracle/product/10.2.0/db_1/kill/monitor.txt
exit
No comments:
Post a Comment