小白入门(四):Oracle生成AWR报告,且修改AWR报告默认间隔时间


前言

我们安装完数据库以后想看看数据库的运行状态,则可以通过AWR报告来分析下我们数据库的运行状况,包括存在的问题,sql语句存在的问题等等。


提示:以下是本篇文章正文内容,下面案例可供参考

一、报告生成路径:

默认生成在启动sqlplus时的路径(也可单独创建)

[root@tdcxl ~]# cd /data/
[root@tdcxl data]# ls
database  oracle  oraInventory  patch
[root@tdcxl data]# mkdir awrlog
[root@tdcxl data]# chown -R oracle:oinstall /data/awrlog/

二、执行:

[oracle@tdcxl ~]$ cd /data/awrlog/
[oracle@tdcxl awrlog]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Wed Oct 16 17:11:54 2019

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> @?/rdbms/admin/awrrpt

在这里插入图片描述
Report_type:
为html报告输入“html”,为纯文本输入“text” 直接回车默认为“html”
在这里插入图片描述
Num_days:
输入生成快照的天数
在这里插入图片描述
Begin_snap:
输入起始快照编号
在这里插入图片描述
End_snap:
输入结束快照编号
注:起始与结束期间不可以出现关闭实例的情况!
在这里插入图片描述
Report_name:
输入生成的文件名称,直接回车默认为截图所示。
在这里插入图片描述
以此结尾。

三、查看验证:

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@tdcxl awrlog]$ ls
awrrpt_1_3_5.html

四、修改awr快照生成间隔(默认为1小时)

SQL> col SNAP_INTERVAL for a30                                                                        
SQL> col RETENTION for a30 
SQL> set lines 120
SQL> select * from dba_hist_wr_control; 

      DBID SNAP_INTERVAL		  RETENTION			 TOPNSQL
---------- ------------------------------ ------------------------------ ----------
1549435079 +00000 01:00:00.0		  +00008 00:00:00.0		 DEFAULT

在这里插入图片描述

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

PL/SQL procedure successfully completed.

在这里插入图片描述

select SNAP_ID,BEGIN_INTERVAL_TIME,END_INTERVAL_TIME from DBA_HIST_SNAPSHOT order by BEGIN_INTERVAL_TIME;

在这里插入图片描述

附:启用EM管理器

[oracle@tdcxl ~]$ emctl start dbconsole

在这里插入图片描述
其实产生的这样的情况,可能是em资料库配置不正确或者是dbcotrol没有配置好

①重建EM资料

[oracle@tdcxl ~]$  emca -repos recreate

在这里插入图片描述

②配置dbcontrol

[oracle@tdcxl ~]$  emca -config dbcontrol db

在这里插入图片描述
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

DBA狗剩儿

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值