Monitor the Performance of Oracle Parallel
Server
The following is a handy script for capturing DLM performance in
an OPS environment. It then places the output inside an Oracle
table for tracking. This script includes a sophisticated use
of the UNIX date function.
This script checks the OPS values for locks, resources and
processes using the UNIX Oracle lkdump command. Once these
values have been collected, they are directed to the $RPT_FILE UNIX
directory. They are also written to the STATSPACK extension
table stats$dlm_stats.
DAY_OF_WEEK=`date
+"%A"`
MACHINE_NAME=`hostname`
RPT_FILE=/u01/MYSID/reports/dlm_monitor.${MACHINE_NAME}.${DAY_OF_WEEK}.log
# \
#
Set up the file to log the lock to:
# /
TIMESTAMP=`date
+"%C%y.%m.%d-%H:%M:%S"`
DLM_RESOURCES=`/oracle/MYSID/bin/lkdump
-a res | head -2 | awk 'getline'`
DLM_LOCKS=`/oracle/MYSID/bin/lkdump -a lock | head -2 | awk
'getline' `
DLM_PROCESS=`/oracle/MYSID/bin/lkdump -a proc | head
-2 | awk 'getline'`
printf "$TIMESTAMP $DLM_RESOURCES
$DLM_LOCKS $DLM_PROCESS \n" >>
RPT_FILE
RES=`echo
$DLM_RESOURCES|cut -f2 -d '='`
LOC=`echo $DLM_LOCKS|cut -f2 -d
'='`
PRO=`echo $DLM_PROCESS|cut -f2 -d '='`
ORACLE_SID=MYSID;
export ORACLE_SID;
PATH=$PATH:/oracle/MYSID/bin; export PATH;
ORACLE_HOME=/oracle/MYSID; export ORACLE_HOME;
$ORACLE_HOME/bin/sqlplus
<<! >> /dev/null
connect system/manager;
insert into
perfstat.stats$dlm_stats
values (
SYSDATE,
$PRO,
$RES,
$LOC );
exit;
!
|
|
Get the Complete
Oracle SQL Tuning Information
The landmark book
"Advanced Oracle
SQL Tuning The Definitive Reference" is
filled with valuable information on Oracle SQL Tuning.
This book includes scripts and tools to hypercharge Oracle 11g
performance and you can
buy it
for 30% off directly from the publisher.
|