Automatic generation of AWR reports
Hi,
How to schedule the automatic JOB to generate the AWR reports hourly basis. ( automatic comparing between 2 snapshots and then generate the text file).
Thanks in advance.
Hi,
If you want the report to be send to your mail through the ORACLE ENTERPRISE MANAGER than you have to write one perl script like below: Adjust statements and addresses as per your requirement.
The main views are:
dba_hist_snapshot & dba_hist_thread which are helping us in doing this.
Hope I answered your question
autoawr.pl :
# My perl script for automatically generating awr report
# By default, report is sent to DBA_EMAIL_LIST_RPT, unless
# it's overridden by ORA_SP_EMAIL_LIST_RPT
# 05/26/2006 - Changed snap level from 5 to 6
# exec statspack.snap(i_snap_level => 6, i_modify_parameter => 'true');
# NOTES
# FUTURE ENHANCEMENTS
# MODIFICATIONS
# $Log: spreport.pl,v $
# Revision 1.4 2003/09/02 21:33:14 oracle
# bugfix (instance_number)
# Revision 1.3 2003/08/26 19:13:22 oracle
# add ORA_SP_HACK1
# Revision 1.2 2003/08/26 18:54:09 oracle
# mod
# Revision 1.1 2003/08/26 17:19:58 oracle
# ic
# ----------------------- main processing -------------------------------------
# in case $0 is a full pathname, strip of the directory name
$progname = $0;
$progname =~ s/^.*\/// ;
$progdir=$0;
$progdir=~ s/\/[^\/]*$// ; if ($progdir eq $0) { $progdir='.'; }
# set prog to equal progname minus file extension and the "."
$prog=$progname;
$prog =~ s/(.*)\..*$/\1/;
$usage="Usage: $progname <dbname> [<report_begin_datetime in a format of '08/27/07 06:30'> <duration in minutes, at least 60>]\n" ;
if ( $#ARGV < 0 )
print $usage;
exit 1;
my @arglist=@ARGV;
$dbname=$ARGV[0];
shift;
if ( $#ARGV > -1) {
$report_user_specified_time="yes";
# $report_begin_datetime="$ARGV[0] $ARGV[1]";
$report_begin_date=$ARGV[0];
$report_begin_time=$ARGV[1];
$report_begin_datetime="$report_begin_date $report_begin_time";
$report_duration=$ARGV[2];
print "Boris: dbg> number of ARGV=$#ARGV, report_begin_datetime=$report_begin_datetime, report_duration=$report_duration\n";
# print "Boris: dbg> UserSpecifiedTime=$report_user_specified_time\n";
# ----------- PORTIBILITY: set envdir to the appropriate value
$envdir=$progdir;
$ENV{'ENV_FILE'}="$envdir/dba.env";
$ENV{'APP_NAME'}=$dbname;
# ----------- End of PORTIBILITY
# initialize execution environ.
require("$envdir/ld_env.pl");
require("$envdir/ora_common.pl");
$tm_start=`date`; chop $tm_start;
$tm_stamp=`date "+%Y%m%d"`; chop $tm_stamp;
$tm_stamp2=`date "+%Y%m%d_%H%M%S"`; chop $tm_stamp2;
# $ENV{'LD_ENV_DEBUG'}=1;
my $status=&ld_env;
# set up log file. If for some reason it's no good, set log file to /dev/null
$LOG_PREFIX="$ENV{'ORA_ADM_DIR'}/log/${prog}_${dbname}.log";
$LOGFILE="${LOG_PREFIX}.${tm_stamp}";
if (open(LOGFILE, ">>$LOGFILE") == 0)
print "Cannot open log $LOGFILE; discard log info \n";
open(LOGFILE, ">/dev/null");
if ( $status != 0 )
&abort($status, \*LOGFILE, "Failed to load environ: $LD_ENV_ERRMSG\n");
my $work_dir=$ENV{'DBA_WORK_DIR'};
if ($work_dir eq '') {
abort_auto(2, "Env var DBA_WORK_DIR not defined\n");
} else {
$status=`mkdir -p $work_dir`;
if ($status != 0) {
abort_auto($status, "mkdir -p $work_dir failed\n");
# ---- main processing
$RPT_PREFIX1="$ENV{'ORA_ADM_DIR'}/log/awr_ash/awr_${dbname}.rpt";
$RPTFILE1="${RPT_PREFIX1}.${tm_stamp2}";
$RPT_PREFIX2="$ENV{'ORA_ADM_DIR'}/log/awr_ash/ash_${dbname}.rpt";
$RPTFILE2="${RPT_PREFIX2}.${tm_stamp2}";
#### no need for a special/"perfstat" connection: $ENV{'ORA_CNCT_STR'}=get_env2('ORA_SP_CNCT_STR', 'perfstat/perfstat');
#### print "dbg> Connecting to the database as: $ENV{'ORA_CNCT_STR'}";
my $days_minus = get_env2('ORA_SP_DAYS_MINUS', 1);
### To avoid "ORA-20200: The instance was shutdown between snapshots x1 and x2", ensure that dba_hist_snapshot.startup_time is the same for min(snap_id) and max(snap_id)
### To avoid "ORA-20200: End Snapshot Id y1 must be greater than Begin Snapshot Id y1", take reporting time interval between 5am and 5pm
if ( $report_user_specified_time eq "yes") {
$awr_begin_date=$report_begin_date;
$awr_begin_time=$report_begin_time;
print "Boris: dbg> awr_begin_date=$awr_begin_date, awr_end_date=$awr_end_date, awr_begin_time=$awr_begin_time, awr_end_time=calculated...\n";
$fudge=5; # that's 5min
$sql="
select t.dbid, t.instance_number, min(s.snap_id), max(s.snap_id)
from dba_hist_snapshot s, dba_hist_thread t
where --
trunc(s.end_interval_time) = trunc(to_date('$awr_begin_date', 'MM/DD/YY'))
and to_char(s.end_interval_time+5/1440, 'HH24:MI') >= '$awr_begin_time'
and to_char(s.end_interval_time, 'SSSSS') <= (to_number(substr('$awr_begin_time', 1, 2))*60 + to_number(substr('$awr_begin_time', 4,2)) + $report_duration +$fudge)*60
and t.instance_number = sys_context('userenv', 'instance')
and t.instance_number = s.instance_number
and t.thread# = sys_context('userenv', 'instance')
and t.snap_id = s.snap_id
and t.dbid = s.dbid
group by t.dbid, t.instance_number, s.startup_time
order by t.dbid, t.instance_number, s.startup_time desc
else {
$awr_days_minus=$days_minus;
$awr_begin_time=4;
$awr_end_time=16;
print "Boris: dbg> awr_days_minus=$awr_days_minus, awr_begin_time=$awr_begin_time, awr_end_time=$awr_end_time\n";
$sql="
select t.dbid, t.instance_number, min(s.snap_id), max(s.snap_id)
from dba_hist_snapshot s, dba_hist_thread t
where trunc(s.begin_interval_time)= trunc(sysdate - $awr_days_minus )
and to_char(s.begin_interval_time, 'HH24') >= $awr_begin_time
and to_char(s.begin_interval_time, 'HH24') <= $awr_end_time
and t.instance_number = sys_context('userenv', 'instance')
and t.instance_number = s.instance_number
and t.thread# = sys_context('userenv', 'instance')
and t.snap_id = s.snap_id
and t.dbid = s.dbid
group by t.dbid, t.instance_number, s.startup_time
order by t.dbid, t.instance_number, s.startup_time desc
my @output ;
$status = run_query($sql, \@output);
if ( $status == 0 )
my $line = $output[0] ;
my ($id_dbid, $id_inst_num, $id_min, $id_max) = split(' ', $line);
print "Boris: dbg> Query output line=$line";
if ( $id_min eq '' || $id_max eq '' )
# not stats
&tee_auto("Error: can't determine min=$id_min and/or max=$id_max snap_id, days_minus=$days_minus, dbid=$id_dbid, inst#=$id_inst_num)\n");
exit;
else
&tee_auto("# generate sprpt for delta between snp_id '$id_min' and '$id_max' (days_minus='$days_minus')\n# f=$RPTFILE1\n");
if ( $report_user_specified_time eq "yes") {
$id_ash_begin_datetime="$report_begin_date $report_begin_time";
$id_ash_duration=$report_duration;
else {
$id_ash_begin_datetime=`date --date yesterday "+%D 05:00"`; chop $id_ash_begin_datetime;
$id_ash_duration=720; #mins: 12 hours (from 5am to 5pm)
# print "Boris: dbg> id_ash_begin_datetime=$id_ash_begin_datetime, id_ash_duraton=$id_ash_duraton\n";
$sql = "
spool $RPTFILE1
select systimestamp from dual;
spool off
run_sql("$sql");
$sql = "
define dbid=$id_dbid
define inst_num=$id_inst_num
define begin_snap=$id_min
define end_snap=$id_max
define report_type='text'
define report_name=$RPTFILE1
@?/rdbms/admin/awrrpti
run_sql("$sql");
$sql = "
define dbid=$id_dbid
define inst_num=$id_inst_num
define report_type='text'
define report_name=$RPTFILE2
define begin_time='$id_ash_begin_datetime'
-- define default_report_duration='$id_ash_duration'
define duration=$id_ash_duration
-- define duration=720
-- define end_time='$id_ash_date_begin_5pm'
define slot_width=''
define target_session_id=''
define target_sql_id=''
define target_wait_class=''
define target_service_hash=''
define target_module_name=''
define target_action_name=''
define target_client_id=''
define target_plsql_entry=''
@?/rdbms/admin/ashrpti
run_sql("$sql");
## Concantenate: cat $RPTFILE2 >> $RPTFILE1;
open ( awr_report, ">>", $RPTFILE1 ) or die "Could not open for writing file $RPTFILE1: $!";
open ( ash_report, "<", $RPTFILE2 ) or die "Could not open for reading file $RPTFILE2: $!";
while ( my $line = <ash_report> ) { print awr_report $line; }
# send report
my $if_notify = 1;
if ( $if_notify && -r $RPTFILE1 )
if ($ENV{'ORA_SP_HACK1'} eq '1') {
&tee_auto( "# detected ORA_SP_HACK1 -- hack the report a bit...\n");
# prefix each line of report with '# ' to hack around
# the problem with Exchange mail server interpreting
# certain patterns as email attachements...
my $ed = get_env2('ED', 'ed');
$cmd="$ed $RPTFILE1 <<eof
Best regards,
Rafi
http://rafioracledba.blogspot.com/
Similar Messages
-
Generate AWR Report automatically every day
Hi Friends,
I would like to generate AWR Report automatically every day. How do i do it.
The Start Time will be 00:00 of Previous day and the end Time will be : 00:00 of current day. The File format is html.
Currently i am using awrrpt.sql to generate report manually and i would like to achieve it automatically,I am not sure how to pass the values of start and end time (From which table i can get the values)?
Regards,
DBHi, DB.
You may use the below sql script , the sql script generates the AWR report for the duration of 2 days in HTML.
So you change
1) the where condition as per your requirement,
2) report name in sql script,
3) and convert it as shell or bat script based on your environment, and schedule it in your OS job scheduler / crontab.
=-=-=-=-
connect / as sysdba
REM set termout off
variable snap1 number
variable snap2 number
COLUMN starthr new_value bhr
COLUMN endhr new_value ehr
COLUMN crdate new_value cdt
begin
select
distinct min(s.snap_id)
into :snap1
from dba_hist_snapshot s
where to_char(trunc(end_interval_time,'HH24'),'HH24') = to_char(trunc(sysdate,'HH24'),'HH24')-2 and trunc(end_interval_time)=trunc(sysdate);
select
distinct max(s.snap_id)
into :snap2
from dba_hist_snapshot s
where to_char(trunc(end_interval_time,'HH24'),'HH24') =to_char(trunc(sysdate,'HH24'),'HH24') and trunc(end_interval_time)=trunc(sysdate);
end;
COLUMN starthr new_value bhr
COLUMN endhr new_value ehr
COLUMN crdate new_value cdt
select to_char(trunc(sysdate, 'HH24'),'HH24')-2 starthr,
to_char(trunc(sysdate, 'HH24'),'HH24') endhr,
to_char(trunc(sysdate),'DD-MON-YYYY') crdate
from dual;
define begin_snap=:snap1
define end_snap=:snap2
define report_name=/orashare1/reports/awrreport/AWRRPT_PROD_1_${1^^}_${EXDATE}_mor.html
define report_type = 'html';
@@?/rdbms/admin/awrrpt.sql
exit -
How to use batch file in window to send out Oracle AWR report automatically
Dear All
Please help me to write batch script as scheduler in windows to send out Oracle AWR report every 2 hours automatically
I have database 10.2.0.3 , its on windows platform .
Thanks in advance846671 wrote:
Dear All
Please help me to write batch script as scheduler in windows to send out Oracle AWR report every 2 hours automatically
I have database 10.2.0.3 , its on windows platform .
Thanks in advancewhat utility do you use to "send out" Oracle AWR report ? -
Shell script for Automatic Awr Report
Hi Good Morning,
I have a requirement to generate the AWR report daily between (10AM - 06PM , 10AM - 01PM , 01PM - 10PM) . I have the below script for this . But the issue is this script is working only when i run it two times and before running i have to delete snap_list.lst file. Please let me know what is the problem in this script and how to resolve it.
Script :
dt=`date +%d%m%Y`
cd /orabkp/awr_report
chmod 777 *
rm -rf snap_list.lst
touch snap_list.lst
#rm -rf snap_list.lst
#rm -rf snap_list.lst
sqlplus -s " /as sysdba " <<EOF > snap_list.lst
host sleep 10
@/oracle/scripts/cron_scripts/rpt1.sql;
@?/rdbms/admin/awrrpt.sql
HTML
1
`cat snap_list.lst | grep "10:0" | awk '{print $1}'`
`cat snap_list.lst | grep "13:0" | awk '{print $1}'`
awrrpt\_$dt\_10AM\-01PM.html
prompt 2
@?/rdbms/admin/awrrpt.sql
HTML
1
`cat snap_list.lst | grep "13:0" | awk '{print $1}'`
`cat snap_list.lst | grep "18:0" | awk '{print $1}'`
awrrpt\_$dt\_01PM\-06PM.html
@?/rdbms/admin/awrrpt.sql
HTML
1
`cat snap_list.lst | grep "10:0" | awk '{print $1}'`
`cat snap_list.lst | grep "18:0" | awk '{print $1}'`
awrrpt\_$dt\_10AM\-06PM.html
@?/rdbms/admin/addmrpt.sql
`cat snap_list.lst | grep "06:0" | awk '{print $1}'`
`cat snap_list.lst | grep "12:0" | awk '{print $1}'`
ADDM_REPORT\_$dt\_10AM\-06PM.txt
EOF
exit
cat /oracle/scripts/cron_scripts/rpt1.sql
host echo 1
host sleep 10
@?/rdbms/admin/awrrpt.sql
HTML
1
`cat snap_list.lst | grep "10:0" | awk '{print $1}'`
`cat snap_list.lst | grep "13:0" | awk '{print $1}'`
awrrpt\_$dt\_10AM\-01PM.html
Regards
RajasekarHi,
Modify & Try this script used for rac awr ..
#!/bin/ksh
set -x
ORACLE_SID=DBSID
ORACLE_HOME=/u01/app/ora11g/product/11.2.0/db_1
export ORACLE_HOME
TERM=vt100
export TERM
PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/local/bin:/usr/bin/X11:/bin:/sbin:.
PATH=$ORACLE_HOME/bin:$PATH
export DT=`date '+%d_%b_%Y_%HH_%MM'`
export ORACLE_BASE ORACLE_SID ORACLE_HOME PATH DT
echo $DT
MAIL="[email protected]"
CMAIL="[email protected]"
AWRR="/u01/DBA_Scripts/AWR_REPO"
sqlplus -s "/ as sysdba"<<EOFSQL
set head off
set feed off
spool /tmp/bsnap.lst
select max(SNAP_ID)- 3 from dba_hist_snapshot;
spool off
spool /tmp/esnap.lst
select max(SNAP_ID) from dba_hist_snapshot;
spool off
spool /tmp/iname.lst
select instance_name from v\$instance;
spool off
spool /tmp/dname.lst
select database_name from v\$database;
spool off
spool /tmp/inum.lst
select instance_number from v\$instance;
spool off
spool /tmp/dbid.lst
select dbid from v\$database;
spool off
EOFSQL
BSNAP=`cat /tmp/bsnap.lst | tail -1 | awk '{ print $1}'`;export BSNAP
ESNAP=`cat /tmp/esnap.lst | tail -1 | awk '{ print $1}'`;export ESNAP
INAME=`cat /tmp/iname.lst | tail -1 | awk '{ print $1}'`;export INAME
DNAME=`cat /tmp/dname.lst | tail -1 | awk '{ print $1}'`;export DNAME
INUM=`cat /tmp/inum.lst | tail -1 | awk '{ print $1}'`;export INUM
DID=`cat /tmp/dbid.lst| tail -1 | awk '{ print $1}'`;export DID
echo "Begin Snap : $BSNAP"
echo "End Snap : $ESNAP"
#echo "InstanceName: $INAME"
echo "DB Name : $DNAME"
#echo "InstanceId : $INUM"
echo "DB ID : $DID"
sqlplus -s "/ as sysdba"<<EOFSQL
define inst_num = $INUM;
define num_days = 12;
define inst_name = 'ALL';
define db_name = '$DNAME';
define dbid = $DID;
define begin_snap = $BSNAP;
define end_snap = $ESNAP;
define report_type = 'html';
define report_name = $AWRR/Awr_report_$DT.html
@@?/rdbms/admin/awrgrpti
EOFSQL
cat /u01/DBA_Scripts/mail_body.txt | mailx -a $AWRR/Awr_report_$DT.html -c $CMAIL -s "DB Report - DB " $MAILThanks,
Ajay More
http://www.moreajays.com -
How to do Detailed AWR Report Analysis
Hi,
Please let me Know how to do analysis AWR report and get it corrected.The best way to isolate the bottlenecks in Oracle is to analyze the top five wait events for the database and look for any external waits that might be associated with disk, CPU and network.
Oracle provide two scripts to produce workload repository reports (awrrpt.sql and awrrpti.sql). They are similar in format to the statspack reports and give the option of HTML or plain text formats. The two reports give essential the same output but the awrrpti.sql allows you to select a single instance. The reports can be generated as follows.
@$ORACLE_HOME/rdbms/admin/awrrpt.sql
@$ORACLE_HOME/rdbms/admin/awrrpti.sql
The scripts prompt you to enter the report format (html or text), the start snapshot id, the end snapshot id and the report filename. The resulting report can be opend in a browser or text editor accordingly.
http://www.oracle-base.com/articles/10g/automatic-workload-repository-10g.php -
Negative Values of Library Cache Hit Ratio in AWR Report
Hi all,
We are getting Negative values of Library cache hit ratio in AWR Report of 11g(11.2.0.3) with Solaris[tm] OE (64-bit).
Please suggest us why it shows negative value.
Instance Efficiency Percentages (Target 100%)
Buffer Nowait %: 99.87 Redo NoWait %: 99.99
Buffer Hit %: 92.17 In-memory Sort %: 100.00
Library Hit %: -3,321.23 Soft Parse %: 81.95
Execute to Parse %: 92.88 Latch Hit %: 95.11
Parse CPU to Parse Elapsd %: 87.25 % Non-Parse CPU: 81.39
Regards,
Madhan
Edited by: user12078989 on Jul 25, 2012 7:40 AMHi Aman,
DB not restarted during this time.. we don't have production access. we will get awr report automatically from customer daily. also i am getting issue in our local environment v$rowcache view gets values is negative for dc_users and dc_tablespaces parameter may be it's related production issue... -
Generation of ASH report very slow
Hello,
I'm in 11203, and generation of ASH report is very slow.
AWR and ADDM reports are generated quickly.
To understand what happen, I check the wait event on the session that is executing ASH report, and I found that this session is waiting 99% with "controlfile sequential read".
My question is :
Is there any way to make the generation of ASH report quick ?
Why the generation need to access to the controlfile ?
Thank you a lot.Hi, Keith.
I tried the pagination scheme "Row Ranges X to Y (with next and previous links)".
This caused the same problem - my page aborts with the error message:
"Internet Explorer cannot open the Intenet site https://oraweb.slac.stanford.edu/apex/slacprod/f?p=116:13:439623456781::NO:::
Operation aborted"
I even removed pagination altogether and still got the same error.
Futhermore, it is sporadic. At times I invoke the report with 500 rows and it
displays without problem. And then, 5 seconds later, I run the re-run the report (again asking to display 500 rows), and it aborts.
This report worked without error (it was "slow", but worked) two weeks ago. But now, it is failing. My gut feeling is that my problem lies with out Oracle
Application Server. I have the feeling that our DBA's have changed some
sort of configuration (a buffer, perhaps) that is causing my problem. Not sure
about this. I guess I'm reaching for straws at this point.
Thanks for your help. It is appreciated.
Elie -
Explain plan in AWR report?
Is there any way to generate the explain plan in AWR report?Is it possible to generate the explain plan in AWR?
PanduHi,
AWR: Automatic Workload Repository
oracle take every 60 minutes a snapshot of statistic in memory and after analysed by ADDM ( automatic database diagnostic monitor) default option, but you can change every 10 minutes or ...
http://www.oracle-base.com/articles/10g/AutomaticWorkloadRepository10g.php
http://www.datadisk.co.uk/html_docs/oracle/addm.htm
http://www.rampant-books.com/t_andert_38_addm_awr_db.htm
http://www.remote-dba.net/oracle_10g_new_features/db_management.htm
http://www.sc.ehu.es/siwebso/KZCC/Oracle_10g_Documentacion/server.101/b10752/diagnsis.htm -
How to monitor on disk i/o on healthcheck and awr report on biweekly health
can you explain how to monitor from disk i/o and awr report from old snap shot to new snap shot
how to check and analyze .,,,,,,,,,,,,,,,,,,,,,can any one tell few points which we can **regularly maintain for health check**
thanks in advance
SQL> SELECT group_number ,disk_number ,mount_status ,total_mb/1024 ,free_mb/1024
2 ,reads, (bytes_read / (1024*1024*1024)) mb_read ,read_errs ,read_time,writes
3 ,write_errs ,write_time FROM v$asm_disk;
GROUP_NUMBER DISK_NUMBER MOUNT_S TOTAL_MB/1024 FREE_MB/1024 READS
MB_READ READ_ERRS READ_TIME WRITES WRITE_ERRS WRITE_TIME
2 0 OPENED 199.989258 0 13697147
402.589765 0 44542.38 4358669 0 8883.86
2 1 OPENED 199.989258 0 13653653
405.503195 0 46014.33 4805783 0 11138.13
2 2 OPENED 199.989258 0 15272350
415.620874 0 45524.7 4571038 0 9806.01
GROUP_NUMBER DISK_NUMBER MOUNT_S TOTAL_MB/1024 FREE_MB/1024 READS
MB_READ READ_ERRS READ_TIME WRITES WRITE_ERRS WRITE_TIME
2 3 OPENED 199.989258 0 22713630
533.380945 0 48105.68 4692729 0 9994.31
2 4 OPENED 199.99707 0 23986390
547.804756 0 57601.79 5788565 0 11073.44
1 0 OPENED 199.989258 0 310810
47.4352741 0 9652.12 1877994 0 3490.5
GROUP_NUMBER DISK_NUMBER MOUNT_S TOTAL_MB/1024 FREE_MB/1024 READS
MB_READ READ_ERRS READ_TIME WRITES WRITE_ERRS WRITE_TIME
1 1 OPENED 199.99707 0 137665
44.7837362 0 9155.21 751099 0 3092.96
1 2 OPENED 199.99707 0 139561
44.7904587 0 9424.26 753116 0 2858.23
1 3 OPENED 199.99707 0 141139
44.7718539 0 9506.27 802414 0 2768.22
9 rows selected.
can you please tell me how to monitor on disk i/os which is as shown above and
please tell me AWR report to analyze some basic points for health check
please give some details for health check of database.
thanks in advanceHi;
What is DB version?
Please check below doc:
http://download.oracle.com/docs/cd/B28359_01/server.111/b28275/tdppt_degrade.htm#CACGCJDC
Also see:
What is AWR( Automatic workload repository ) and How to generate the AWR report? [ID 748642.1]
How To Understand AWR Report / Statspack Report [ID 842884.1]
Regard
Helios -
Automation of AWR report.
Hi All,
I want to automate for awr report generating for every 30 min. For this I am creating a script which is not working properly. Script given below.
1. Declaring an variable
2. Giving value to the variable by running sql query
3. Executing dbms_workload_repository procedure.
Please help me proper steps.
SET SERVEROUTPUT ON
Declare
DBID_NUM NUMBER;
INST_NUMBER NUMBER;
MAX_SNAP_ID NUMBER;
MIN_SNAP_ID NUMBER;
DBID_NUM := select DBID into DBID_NUM from dba_hist_snapshot WHERE ROWNUM=1;
INS_NUMBER := select INSTANCE_NUMBER into INST_NUMBER from dba_hist_snapshot WHERE ROWNUM=1;
MAX_SNAP_ID := select MAX(SNAP_ID) into MAX_SNAP_ID from dba_hist_snapshot;
MIN_SNAP_ID =: select MAX(SNAP_ID)-1 into MIN_SNAP_ID from dba_hist_snapshot;
Begin
SELECT output FROM TABLE (dbms_workload_repository.awr_report_html(DBID_NUM,INST_NUMBER,MAX_SNAP_ID,MIN_SNAP_ID));
End;
/Hi,
I am trying to help, however it's hard because you haven't clarified your end goal. What time period do you need to generate the AWR report for? Generating an AWR report from the entire range of available snap_id's is utterly useless. It's like measuring your average body temperature from the moment of birth up to now.
How are you planning to generate it -- into a database table, into a file, to terminal output? You didn't mention that and it's impossible to deduce it from your script.
Most importantly, why do you need to produce all these AWR reports for each 30 mins? Every 30 days, I would understand, but every 30 mins?! Do you realize that if you want to look at some trends, it much easier to do that using AWR views directly, rather than trying to extract data from html codes? And if you want your performance history just in case -- why don't you increase your SYSAUX tablespace and AWR retention, so that you can go back and generate a retrospective AWR report when needed?
I wrote an anonymous to autogenerate an AWR report for the last snapshot and dump it to the screen, hope this helps:
declare
l_dbid number;
l_inst_id number;
l_last_snap_id number;
l_output clob;
begin
select dbid into l_dbid from v$database;
select instance_number into l_inst_id from v$instance;
select max(snap_id) into l_last_snap_id from dba_hist_snapshot;
for rec in (select * from table(dbms_workload_repository.awr_report_text(l_dbid,l_inst_id, l_last_snap_id - 1, l_last_snap_id))) loop
dbms_output.put_line(rec.output);
end loop;
end;
/Best regards,
Nikolay
P.S. You have 17 out of 21 questions unresolved. Has the forum been really this unhelpful for you? -
Hello,
Can anybody guide me how to generate an AWR (automatic workload repository) report at schema level? Actually I have created one user name xyz and imported some 1000 objects (tables, views etc) .
I have little doubt here , when we create one user ,is schema for that user will it create automatically …..if its true then I need to generate one AWR report for that user or schemaI don't think this is possible: AWR only works at database/instance level and not at schema level.
-
Hi all
I have oracle 10.2.0.1.0 version installed on solaris machine
I have to get the AWR report of the database
How can i get the OEM on solaris machine to take the AWR ReportSelect [Administration] tab at database instance homepage.
Select Automatic Workload Repository under Statisctics Management.
Select the number next to Snapshots.
Select the beginning snapshot ID.
Select 'View Report' as Action and press [go].
Select the ending snapshot ID.
Press [OK]
Next the report will be created. -
Hello!
I use the Oracle EM GC 11 for monitoring of databases .
I need to form the AWR report for some of databases and send it once a day by e-mail automatically.
How to realize it?Hi,
I am trying to help, however it's hard because you haven't clarified your end goal. What time period do you need to generate the AWR report for? Generating an AWR report from the entire range of available snap_id's is utterly useless. It's like measuring your average body temperature from the moment of birth up to now.
How are you planning to generate it -- into a database table, into a file, to terminal output? You didn't mention that and it's impossible to deduce it from your script.
Most importantly, why do you need to produce all these AWR reports for each 30 mins? Every 30 days, I would understand, but every 30 mins?! Do you realize that if you want to look at some trends, it much easier to do that using AWR views directly, rather than trying to extract data from html codes? And if you want your performance history just in case -- why don't you increase your SYSAUX tablespace and AWR retention, so that you can go back and generate a retrospective AWR report when needed?
I wrote an anonymous to autogenerate an AWR report for the last snapshot and dump it to the screen, hope this helps:
declare
l_dbid number;
l_inst_id number;
l_last_snap_id number;
l_output clob;
begin
select dbid into l_dbid from v$database;
select instance_number into l_inst_id from v$instance;
select max(snap_id) into l_last_snap_id from dba_hist_snapshot;
for rec in (select * from table(dbms_workload_repository.awr_report_text(l_dbid,l_inst_id, l_last_snap_id - 1, l_last_snap_id))) loop
dbms_output.put_line(rec.output);
end loop;
end;
/Best regards,
Nikolay
P.S. You have 17 out of 21 questions unresolved. Has the forum been really this unhelpful for you? -
Analyzing AWR reports, how can i decide i need to increase my SGA
Hi,
I am analyzing my Production server AWR reports, how can i decide on which basis i can increase SGA.
Thanks,
MahiYou need to make sure that the corresponding memory areas are not having any waits associated with them. Changing the memory parameters is generally not an option to pick in 10g as the instance management is automatic( shouldbe) and this makes the allocations done in an optimal manner depending upon the workloads. Still the change in the parameters can be there when we see some specific wait event related to that memory area. For example, if you see lots of Shared Pool latch contention and you are assure that you have no duplicate sqls coming up in your system than may be you have an undersized shared pool so it can be increased.
You are using AWR.What about the recommendations from ADDM?Is there any advice coming up to change the memory components ? Did you elliminate all teh other areas which may be a problematic reason rather than a low memory value for parameters?
Aman.... -
I need to generate many AWR reports everyday with the same time period each time.
09h00 to 09h15
11h00 to 11h15
14h00 to 14h15
16h00 to 16h15
Is there a way to generate those reports automatically with parameters?783643 wrote:
I need to generate many AWR reports everyday with the same time period each time.
09h00 to 09h15
11h00 to 11h15
14h00 to 14h15
16h00 to 16h15
Is there a way to generate those reports automatically with parameters?
Rem If you want to use this script in an non-interactive fashion,
Rem see the 'customer-customizable report settings' section in
Rem awrrpti.sql
Maybe you are looking for
-
I used #004# to deactivate my iphone 4s voice mail. How do I get it back on?
I used #004# to deactivate my iphone 4s voice mail. How do I get it back on?
-
Hi We have two contents servers installed, one for live and one for test to store our documents in. We have done a client copy of live to test but now we want to copy the actual documents that are attached to the dirs from one contents server to anot
-
Hi, I want to enable swat on Solaris 10 11/06 using the version bundled with Solaris. As with all earlier versions I just installed the Samba packages and then imported the swat service via inetconv. In all previous versions this has worked fine but
-
Newest Firefox will not allow my Lotus Notes to fully load
Previous Firefox allowed me to easily access my work Lotus Notes at home. Installed newest Firefox: Lotus Notes partially loads (I get all of the tool bars, etc) but none of my email content loads (the portion of LN that shows emails is empty). Error
-
UTF-8 Regular Expression Whitelist
I'm trying to create a whitelist regular expression for form input. <cfset pattern_name = "^[\w]+[\w-\.,\s'""]*$"> works for Ascii, but I need to include characters 192-255 in the ISO 8859-1 character set. <cfset pattern_name = "^[\wÀ-ÿ]+[\wÀ-ÿ-\.,\s