当前位置:网站首页>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.;
边栏推荐
猜你喜欢

框架外的PHP读取.env文件(php5.6、7.3可用版)

wordpress插件开发03-简单的all in one seo 插件开发

flex布局回顾
MySQL select count(*) count is very slow, is there any optimization solution?

mysql数据查询因为查询的时间跨度过大导致cup爆满应该怎么办

新一代开源免费的轻量级 SSH 终端,非常炫酷好用!

零基础创作专业wordpress网站12-设置标签栏图标(favicon)

无代码平台助力中山医院搭建“智慧化管理体系”,实现智慧医疗

MySQL性能调优,必须掌握这一个工具!!!(1分钟系列)

Software custom development - the advantages of enterprise custom development of app software
随机推荐
wordpress插件开发03-简单的all in one seo 插件开发
For the first time, I suspect that there is a bug in selenium4 because the iframe element is not found?
谁能解答?从mysql的binlog读取数据到kafka,但是数据类型有Insert,updata,
验证拦截器的执行流程
picker选择器出现object解决办法
力扣题解8/10
mysql数据查询因为查询的时间跨度过大导致cup爆满应该怎么办
Quickly submit a PR (Web) for OpenHarmony in 5 minutes
CreateJS加速地址
在软件工程领域,搞科研的这十年!
深度学习100例 —— 卷积神经网络(CNN)识别眼睛状态
关于ts中的指针问题call,bind, apply
The no-code platform helps Zhongshan Hospital build an "intelligent management system" to realize smart medical care
观察表情和面部,会发现他有焦虑和失眠的痕迹
《价值》读书与投资
jenkins 流水线脚本详细解析Pipeline
golang string manipulation
大佬们,我有一个MySQL source 通过旁路分流分了两个流,然后转表,现在想sink到两个hb
Primavera Unifier -AEM 表单设计器要点
[wxGlade learning] wxGlade environment configuration