awr保留10天,每小時(shí)收集一次:
begin DBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS(14400,60); end;
手動(dòng)收集awr一次:
exec DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT();
創(chuàng)新互聯(lián)專注于企業(yè)成都全網(wǎng)營銷推廣、網(wǎng)站重做改版、梅河口網(wǎng)站定制設(shè)計(jì)、自適應(yīng)品牌網(wǎng)站建設(shè)、H5網(wǎng)站設(shè)計(jì)、成都商城網(wǎng)站開發(fā)、集團(tuán)公司官網(wǎng)建設(shè)、外貿(mào)網(wǎng)站制作、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁設(shè)計(jì)等建站業(yè)務(wù),價(jià)格優(yōu)惠性價(jià)比高,為梅河口等各大城市提供網(wǎng)站開發(fā)制作服務(wù)。
手動(dòng)執(zhí)行一個(gè)快照:
Exec dbms_workload_repository.create_snapshot; (這個(gè)要背出來哦,用的時(shí)候去翻手冊,丟臉哦)
創(chuàng)建一個(gè)AWR基線
Exec DBMS_WORKLOAD_REPOSITORY.CREATE_BASELINE(start_snap_id,end_snap_id ,baseline_name);
@?/rdbms/admin/awrrpt 生成AWR報(bào)告
@?/rdbms/admin/awrddrpt AWR比對報(bào)告
@?/rdbms/admin/awrgrpt RAC 全局AWR
dbms_workload_repository手工管理AWR
1、修改快照設(shè)置
[sql] view plaincopyprint?
查看awr保留的天數(shù)和采集頻率:
sys@ORCL> select * from dba_hist_wr_control;
DBID SNAP_INTERVAL RETENTION TOPNSQL
---------- ------------------------- ------------------------------ ----------
1301772781 +00000 01:00:00.0 +00008 00:00:00.0 DEFAULT
修改awr保留的天數(shù)和采集頻率:
sys@ORCL> exec dbms_workload_repository.modify_snapshot_settings(retention => 15*1440,interval => 30);
PL/SQL 過程已成功完成。
sys@ORCL> select * from dba_hist_wr_control;
DBID SNAP_INTERVAL RETENTION TOPNSQL
---------- ------------------------- ------------------------------ ----------
1301772781 +00000 00:30:00.0 +00015 00:00:00.0 DEFAULT
interval:將間隔設(shè)置為0時(shí),oracle將禁止采用自動(dòng)和手工快照的機(jī)制。
retention:當(dāng)保存時(shí)間設(shè)置為0時(shí),oracle將永久地保存這個(gè)快照。
2、創(chuàng)建和刪除快照
[sql] view plaincopyprint?
手動(dòng)執(zhí)行一個(gè)awr快照:
sys@ORCL> exec dbms_workload_repository.create_snapshot();
PL/SQL 過程已成功完成。
刪除awr報(bào)告(指定刪除范圍):
sys@ORCL> exec dbms_workload_repository.drop_snapshot_range(low_snap_id => 10,high_snap_id => 12);
PL/SQL 過程已成功完成。
sys@ORCL> exec dbms_workload_repository.drop_snapshot_range(low_snap_id => 628,high_snap_id => 629);
PL/SQL 過程已成功完成。
dba_hist_snapshot視圖將列出有關(guān)可用快照的信息。
SELECT * FROM dba_hist_snapshot
3、創(chuàng)建和刪除基線
[sql] view plaincopyprint?
sys@ORCL> exec dbms_workload_repository.create_baseline(start_snap_id => 630,end_snap_id => 635,baseline_name => 'base line');
PL/SQL 過程已成功完成。
sys@ORCL> select baseline_name,start_snap_id,end_snap_id from dba_hist_baseline;
BASELINE_NAME START_SNAP_ID END_SNAP_ID
---------------------------------------------------------------- ------------- -----------
base line 630 635
SYSTEM_MOVING_WINDOW 636 637
sys@ORCL> exec dbms_workload_repository.drop_baseline(baseline_name => 'base line',cascade => true);
PL/SQL 過程已成功完成。
sys@ORCL> select baseline_name,start_snap_id,end_snap_id from dba_hist_baseline;
BASELINE_NAME START_SNAP_ID END_SNAP_ID
---------------------------------------------------------------- ------------- -----------
SYSTEM_MOVING_WINDOW 636 637
sys@ORCL> exec dbms_workload_repository.create_baseline(to_date('2013-11-03 00:00:00','yyyy-mm-dd hh34:mi:ss'),to_date('2013-11-03 06:00:00','yyyy-mm-dd hh34:mi:ss'),'base line2');
PL/SQL 過程已成功完成。
sys@ORCL> select baseline_name,start_snap_id,end_snap_id from dba_hist_baseline;
BASELINE_NAME START_SNAP_ID END_SNAP_ID
---------------------------------------------------------------- ------------- -----------
base line 685 686
base line2 685 686
SYSTEM_MOVING_WINDOW 640 696
4、自動(dòng)創(chuàng)建AWR基線
[sql] view plaincopyprint?
sys@ORCL> alter session set NLS_DATE_FORMAT= 'yyyy-mm-dd hh34:mi:ss';
會(huì)話已更改。
sys@ORCL> exec DBMS_WORKLOAD_REPOSITORY.create_baseline_template( -
> day_of_week => 'WEDNESDAY', -
> hour_in_day => 0, -
> duration => 6, -
> start_time => '2013-11-01:00:00:00', -
> end_time => '2013-12-31:06:00:00', -
> baseline_name_prefix => 'Batch Baseline ', -
> template_name => 'Batch Template', -
> expiration => 365);
PL/SQL 過程已成功完成。
sys@ORCL> select t.template_name,
2 t.template_type,
3 t.start_time,
4 t.end_time,
5 t.day_of_week,
6 t.hour_in_day,
7 t.duration
8 from dba_hist_baseline_template t;
TEMPLATE_NAME TEMPLATE_ START_TIME END_TIME DAY_OF_WE HOUR_IN_DAY DURATION
------------------------------ --------- ------------------- ------------------- --------- ----------- ----------
Batch Template REPEATING 2013-11-01 00:00:00 2013-12-31 06:00:00 WEDNESDAY 0 6
sys@ORCL> exec DBMS_WORKLOAD_REPOSITORY.drop_baseline_template('Batch Template');
PL/SQL 過程已成功完成。
day_of_week:天或者星期,基線在這個(gè)時(shí)間上重復(fù)。Specify one of the following values:('SUNDAY', 'MONDAY', 'TUESDAY', 'WEDNESDAY','THURSDAY', 'FRIDAY', 'SATURDAY', 'ALL')
hour_in_day:0-23,執(zhí)行基線在這個(gè)小時(shí)開始。
duration:持續(xù)時(shí)間(小時(shí)數(shù))。
start_time:創(chuàng)建基線的開始時(shí)間。
end_time:創(chuàng)建基線的結(jié)束時(shí)間。
expiration :基線過期的天數(shù)。
對于上面這個(gè)模板,將會(huì)在每周三根據(jù)0:00到上午6:00的時(shí)間窗口創(chuàng)建固定基線。
當(dāng)前題目:awr常用技巧
文章起源:http://aaarwkj.com/article42/pjcoec.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站收錄、網(wǎng)頁設(shè)計(jì)公司、關(guān)鍵詞優(yōu)化、靜態(tài)網(wǎng)站、外貿(mào)網(wǎng)站建設(shè)、用戶體驗(yàn)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)