每次调用awrrpt及awrsqrpt生成报告的交互很是郁闷,今天查看了下awrrpt.sql文件,把直接调用方式找出来了,不要交互方式感觉就是爽啊,特别是用awrsqrpt去分析大量sql的时候,挨个交互肯定是让人崩溃的,脚本看下文:
prompt----------list snap-----------
prompt 显示snap
prompt------------------------
col snap_id for 999999999;
col startup_time for a30;
col begin_interval_time for a30;
col end_interval_time for a30;
select snap_id,startup_time,begin_interval_time,end_interval_time from dba_hist_snapshot order by snap_id;
prompt----------awr-----------
prompt select output from table(dbms_workload_repository.awr_report_text(db_id,instance_number,begin_snap,end_snap,8));
prompt------------------------
column instance_number heading "instance_number" new_value instance_number format 99999;
column dbid heading "dbid" new_value dbid format 9999999999;
select dbid from v$database;
select instance_number from v$instance;
select output from table(dbms_workload_repository.awr_report_text(&&dbid,&&instance_number,1281,1282,8));
prompt---------awrsqrpt---------
prompt select output from table(dbms_workload_repository.awr_sql_report_text(db_id,instance_number,begin_snap,end_snap,sql_id,8));
prompt------------------------
column instance_number heading "instance_number" new_value instance_number format 99999;
column dbid heading "dbid" new_value dbid format 9999999999;
select dbid from v$database;
select instance_number from v$instance;
select output from table(dbms_workload_repository.awr_sql_report_text(&&dbid,&&instance_number,1281,1282,'687tkw3kgrybw',8));
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/11088128/viewspace-697296/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/11088128/viewspace-697296/