BC remote Oracle DBA - Call (800) 766-1884  
Oracle Consulting Oracle Training Development

Remote DBA

Remote DBA Plans  

Remote DBA Service

Remote DBA RAC

   
Remote DBA Oracle Home
Remote DBA Oracle Training
Remote DBA SQL Tuning Consulting
Remote DBA Oracle Tuning Consulting
Remote DBA Data Warehouse Consulting
Remote DBA Oracle Project Management
Remote DBA Oracle Security Assessment
Remote DBA Unix Consulting
Burleson Books
Burleson Articles
Burleson Web Courses
Burleson Qualifications
Oracle Links
Remote DBA Oracle Monitoring
Remote DBA Support Benefits
Remote DBA Plans & Prices
Our Automation Strategy
What We Monitor
Oracle Apps Support
Print Our Brochure
Contact Us (e-mail)
Oracle Job Opportunities
Oracle Consulting Prices





   

 

 

 

Remote DBA services

Remote DBA Support

Remote DBA RAC

Remote DBA Reasons

Remote Oracle Tuning

Remote DBA Links

Oracle DBA Support

Oracle DBA Forum

Oracle Disaster

Oracle Training

Oracle Tuning

Oracle Training

 Remote DBA SQL Server

Remote MSSQL Consulting

Oracle DBA Hosting

Oracle License Negotiation

 

 


 

 

 

 

 
 

Distributing the Table Reports via Email

Oracle Tips by Burleson Consulting

Now that we see the value of these reports, we can look at how we can easily automate the e-mail distribution of the statistics reports. As we noted, the summary of size and growth statistics are of interest to top MIS management, and we can automate the distribution by sending them e-mail each week showing the total change in database sizes. Here is the report generation script:

run_object_report.ksh

#!/bin/ksh

# Validate the Oracle database name with
# lookup in /var/opt/oracle/oratab
TEMP=`cat /var/opt/oracle/oratab|grep \^$1:|\
cut -f1 -d':'|wc -l`
tmp=`expr TEMP`     # Convert string to number
if [ $tmp -ne 1 ]
then
   echo "Your input $1 is not a valid ORACLE_SID."
   exit 99
fi

 
# Here we must set the environment . . . .
ORACLE_SID=$1
export ORACLE_SID
ORACLE_HOME=`cat /var/opt/oracle/oratab|grep $ORACLE_SID:|cut -f2 -d':'`
export ORACLE_HOME
PATH=$ORACLE_HOME/bin:$PATH
export PATH
MON=`echo /export/home/oracle/obj_stat`
export MON


sqlplus perfstat/perfstat<<!
spool ${MON}/stats_rpt.lst
@${MON}/rpt_object_stats
spool off;
exit;
!

#************************************
# Mail the Object Statistics Reports
#************************************
cat $MON/stats_rpt.lst|mailx -s "Weekly Statistics Summary" \
   donald@remote-Remote DBA.net \
   jim@us.oracle.com \
   larry@oracle.com

Note that you will need to make several changes to customize this report for your environment:

1.      The preceding listing uses the Solaris location of the oratab file in /var/opt/oracle. If you are using AIX or HP/UX, you will want to change this to the /etc directory.

2.      Make sure you change the e-mail addresses to match the distribution list at your organization.

3.      Set the $MON UNIX variable to the location of your object statistics scripts.

Here is an example of the UNIX crontab file that you would use to execute this report generation script:

#**********************************************************
# These are the statspack extension reports for tables & indexes
#**********************************************************
30 07 1 * * /home/obj_stat/get_object_stats.ksh PRODEDI > /dev/null

Note from the crontab listing that you must pass your ORACLE_SID as an argument to this script. The crontab entry says to run the report at 7:30 a.m. each Monday, and passes the ORACLE_SID name of PRODEDI to the script.


This is an excerpt from "Oracle9i High Performance tuning with STATSPACK" by Oracle Press.


If you like Oracle tuning, you may enjoy the new book "Oracle Tuning: The Definitive Reference", over 900 pages of BC's favorite tuning tips & scripts. 

You can buy it direct from the publisher for 30%-off and get instant access to the code depot of Oracle tuning scripts.


Expert Remote DBA

BC is America's oldest and largest Remote DBA Oracle support provider.  Get real Remote DBA experts, call
BC Remote DBA today.

 

   

 

Remote DBA Service
 

Oracle Tuning Book

 

Advance SQL Tuning Book 

BC Oracle support

Oracle books by Rampant

Oracle monitoring software

 

 

 

 

 

 

BC Remote Oracle Support

Remote DBA

Remote DBA Services

Copyright © 1996 -  2013 by Burleson. All rights reserved.

Oracle® is the registered trademark of Oracle Corporation.



Hit Counter