oracle11gr1使用教程,Oracle 11g r1入门教程:AWR使用

本文介绍了Oracle数据库的Automatic Workload Repository (AWR)的使用方法,包括如何通过SQL命令生成AWR报告,设置AWR的收集间隔和保留时间。在管理AWR时,展示了关闭和打开AWR的SQL语句,以及调整AWR快照保留策略的注意事项和解决方法。同时,提供了查询AWR快照记录的SQL查询语句。
摘要由CSDN通过智能技术生成

一、 AWR使用 SQLgt;@?/rdbms/admin/awrrpt.sql Specify the Report Type ~~~~~~~~~~~~~~~~~~~~~~~ Would you like an HTML re

一、 AWR使用

SQL>@?/rdbms/admin/awrrpt.sql

Specify the Report Type

~~~~~~~~~~~~~~~~~~~~~~~

Would you like an HTML report, or a plain text report?

Enter ‘html’ for an HTML report, or ‘text’ for plain text

Defaults to ‘html’

输入 report_type 的值:

Type Specified: htmlSpecify the number of days of snapshots to choose from

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Entering the number of days (n) will result in the most recent

(n) days of snapshots being listed. Pressing without

specifying a number lists all completed snapshots.

输入 num_days 的值: 1Listing the last day’s Completed Snapshots

Snap

Instance DB Name Snap Id Snap Started Level

———— ———— ——— —————— —–

orcl10g ORCL10G 142 03 7月 2009 08:11 1

143 03 7月 2009 09:00 1

144 03 7月 2009 10:00 1

145 03 7月 2009 11:00 1

146 03 7月 2009 12:01 1

Specify the Begin and End Snapshot Ids

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

输入 begin_snap 的值: 142Begin Snapshot Id specified: 142

输入 end_snap 的值: 146End Snapshot Id specified: 146

Specify the Report Name

~~~~~~~~~~~~~~~~~~~~~~~

The default report file name is awrrpt_1_142_146.html. To use this name,

press to continue, otherwise enter an alternative.

输入 report_name 的值:/home/Oracle/awrrpt_1_142_146.html

Report written to /home/oracle/awrrpt_1_142_146.html

二、AWR管理

(1)关闭awr:

SQL> exec dbms_workload_repository.modify_snapshot_settings(interval=>0);说明:把interval设为0则已经关闭awr功能。

验证:

SQL> select * from dba_hist_wr_control;

DBID SNAP_INTERVAL RETENTION TOPNSQL

———- ——————- ——————- ———-

450641661 +40150 00:00:00.0 +00008 00:00:00.0 DEFAULT

(2)打开awr:

SQL> exec dbms_workload_repository.modify_snapshot_settings(interval=>30, retention=>5*24*60);

说明:收集间隔时间为30分钟一次,并且保留5天时间(单位都是分钟)如果执行时报错:

SQL> exec dbms_workload_repository.modify_snapshot_settings(interval=>30, retention=>5*24*60);

BEGIN dbms_workload_repository.modify_snapshot_settings(interval=>30, retention=>5*24*60); END;

*

ERROR at line 1:

ORA-13541: system moving window baseline size (691200) greater than retention (432000)

ORA-06512: at “SYS.DBMS_WORKLOAD_REPOSITORY”, line 89

ORA-06512: at “SYS.DBMS_WORKLOAD_REPOSITORY”, line 137

ORA-06512: at line 1

原因是系统设置的baseline size值(691200)大于此时设置的retention(432000),,那么此时有两种方法解决:

方法1:增大retention值,也就是增大保存天数,比如修改为:

SQL> exec dbms_workload_repository.modify_snapshot_settings(interval=>30, retention=>9*24*60);

PL/SQL procedure successfully completed.

验证:

SQL> select * from dba_hist_wr_control;

DBID SNAP_INTERVAL RETENTION TOPNSQL

———- ——————- ——————- ———-

450641661 +00000 00:30:00.0 +00009 00:00:00.0 DEFAULT

(3)查看快照记录:

select * from sys.wrh$_active_session_history

ebcae436e7197eeb36cdba3a8a18242e.gif

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值