前言
我们安装完数据库以后想看看数据库的运行状态,则可以通过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