当前位置:网站首页>collect awr
collect awr
2022-08-11 09:22:00 【Two small oriole】
查看最大的snap_id
select max(snap_id) from dba_hist_snapshot;
手工生成awr快照
Before stress testing begins,手工生成awr快照,压测结束后,Manually generate againawr快照
begin
dbms_workload_repository.create_snapshot();
end;
/
创建awr报告
Two snapshots generated by hand,Generated separately at all nodesawr报告
@?/rdbms/admin/awrrpt.sql
批量生成awr报告
创建文件awrrpt_batch.sql
set serveroutput on;
set feedback off;
set linesize 300;
prompt ***************************************************************;
prompt usage:
prompt 1.noninteractive : SQL>@awrrpt_batch.sql dbid instance_num start_snap end_snap;
prompt 2.interactive : SQL>@awrrpt_batch.sql;
prompt author : Darren_Guo
prompt ***************************************************************;
pause press enter to continue or ctrl-c to exit.;
col snap_id for 999999999;
col snap dbid 9999999999;
col startup_time for a30;
col begin_interval_time for a30;
col end_interval_time for a30;
select dbid,snap_id,instance_number,startup_time,begin_interval_time,end_interval_time from dba_hist_snapshot order by dbid,instance_number,snap_id;
exec dbms_output.put_line(chr(13)||chr(10)||'please enter dbid,inst_number,start and end snap_id:');
declare
v_dbid number;
v_instance number;
v_b_id number;
v_e_id number;
v_code number;
v_errm varchar2(300);
v_sql varchar2(300);
v_html varchar2(20000);
cur_awrrpt_html SYS_REFCURSOR;
cur_snapshot SYS_REFCURSOR;
fileID utl_file.file_type;
v_filename varchar2(30);
v_snap_id number;
v_startup_time timestamp(3);
v_begin_snap_time timestamp(3);
v_end_snap_time timestamp(3);
v_dpath varchar2(60);
begin
v_dbid:=&1;
v_instance:=&2;
v_b_id:=&3;
v_e_id:=&4;
dbms_output.put_line(chr(13)||chr(10)||'awrrpt report files:');
for k in v_b_id..v_e_id-1 loop
v_filename:='pmdb_'||k||'_'||(k+1)||'.html';
fileID:=utl_file.fopen('DATA_PUMP_DIR',v_filename,'a',32767);
v_sql:='select output from table(dbms_workload_repository.awr_report_html('||v_dbid||','||v_instance||','||k||','||(k+1)||',8))';
open cur_awrrpt_html for v_sql;
loop
exit when cur_awrrpt_html%notfound;
fetch cur_awrrpt_html into v_html;
utl_file.put_line(fileID,v_html);
end loop;
utl_file.fclose(fileID);
execute immediate 'select directory_path from dba_directories where directory_name=:dname' into v_dpath using 'DATA_PUMP_DIR';
dbms_output.put_line(v_dpath||v_filename);
end loop;
exception
when others then
v_code:=SQLCODE;
v_errm:=SQLERRM;
dbms_output.put_line('ERROR CODE'||v_code||':'||v_errm);
end;
/
Prompted in the usage script
usage:
1.noninteractive : SQL>@awrrpt_batch.sql dbid instance_num start_snap end_snap;
2.interactive : SQL>@awrrpt_batch.sql;
author : Darren_Guo
***************************************************************;
pause press enter to continue or ctrl-c to exit.;
边栏推荐
- Halcon算子解释
- Initial use of IDEA
- 利用mindspore下面mindzoo里面的yolov3-darknet53进行目标识别,模型训练不收敛
- UNITY gameobject代码中setacvtive(false)与面板中直接去掉勾 效果不一样
- Lightweight network (1): MobileNet V1, V2, V3 series
- 中移链EOSJS实战使用
- Unity3D - modification of the Inspector panel of the custom class
- ES6:数值的扩展
- Typescript基本类型---下篇
- 工业检测深度学习方法综述
猜你喜欢
随机推荐
Unity3D - modification of the Inspector panel of the custom class
canvas图形操作(缩放、旋转、位移)
pycharm 取消msyql表达式高亮
halcon实例
大佬们,我有一个MySQL source 通过旁路分流分了两个流,然后转表,现在想sink到两个hb
idea插件自动填充setter
盘点四个入门级SSL证书
深度学习100例 —— 卷积神经网络(CNN)识别验证码
pycharm cancel msyql expression highlighting
WordpressCMS主题开发01-首页制作
A few days ago, Xiaohui went to Guizhou
ASP.NET Core 6框架揭秘实例演示[32]:错误页面的集中呈现方式
Primavera Unifier -AEM 表单设计器要点
基于hydra库实现yaml配置文件的读取(支持命令行参数)
专题讲座8 字符串(一) 学习心得
【系统梳理】微服务的注册和发现中心
For the first time, I suspect that there is a bug in selenium4 because the iframe element is not found?
redis模拟面试
QTableWidget 使用方法
js将table生成excel文件并去除表格中的多余tr(js去除表格中空的tr标签)









