Skip to content

Instantly share code, notes, and snippets.

@CedricL46
Last active June 20, 2018 09:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CedricL46/3196aec505caae7373a4791a5e62d24a to your computer and use it in GitHub Desktop.
Save CedricL46/3196aec505caae7373a4791a5e62d24a to your computer and use it in GitHub Desktop.
/**** Run this query to get the boundary time or your AWR report ****/
select snap_id,
snap_level,
to_char(begin_interval_time, 'dd/mm/yy hh24:mi:ss') begin
from
dba_hist_snapshot
order by 1
desc;
/***
Result look like this :
1696 1 20/06/18 11:00:12
1695 1 20/06/18 10:30:11
1694 1 20/06/18 10:00:09
1693 1 20/06/18 09:30:08
1692 1 20/06/18 09:00:06
1691 1 20/06/18 08:30:05
1690 1 20/06/18 08:00:04
***/
/**** Get your Database Id ****/
select DBID from v$database;
/**** Get your AWR Report in HTML or text format ****/
/**** If you're not sure what to put as a second parameter set 1 ****/
SELECT
output
FROM
TABLE
(dbms_workload_repository.awr_report_html
(YOURDATABASEID,YOURDATABASEINSTANCE,FIRSTSNAPSHOT,SECONDSNAPSHOT )
);
/**
Example to get the report as text :
SELECT
output
FROM
TABLE
(dbms_workload_repository.awr_report_text
(3518879357,1,1693,1694 )
);
Example to export result as html (way easier to read) :
SELECT
output
FROM
TABLE
(dbms_workload_repository.awr_report_html
(3518879357,1,1693,1694 )
);
-> Export result to file AWR.html
**/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment