Oracle生成AWR报告方法

用xshell 登陆:

[[email protected] /]$ su - oracle

[[email protected] ~]$ sqlplus system/[email protected]/orcl

SQL*Plus: Release 11.2.0.4.0 Production on Sun Oct 9 14:16:59 2016

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, Real Application Clusters, Automatic Storage Management, OLAP,

Data Mining and Real Application Testing options

SQL> exec dbms_workload_repository.create_snapshot(); (loadrunner 开始跑压力测试脚本后,通过这句话手动创建Snapshots ,此时生产一个id ,大致记住当前时间,在后面会用到)

PL/SQL procedure successfully completed.

SQL> exec dbms_workload_repository.create_snapshot(); (loadrunner 结束跑压力测试脚本后,通过这句话再手动创建Snapshots ,此时生产一个id ,大致记住当前时间,在后面会用到)

(后面会取这两个id之间的值,作为html报告生成。)

PL/SQL procedure successfully completed.

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

Current Instance


   DB Id    DB Name   Inst Num Instance

----------- ------------ -------- ------------

  787750339 LTDB          1 ltdb1

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‘

Enter value for report_type: (回车)

Type Specified: html

Instances in this Workload Repository schema


   DB Id     Inst Num DB Name            Instance     Host

------------ -------- ------------ ------------ ------------

* 787750339        1 LTDB         ltdb1  node1

  787750339      2 LTDB         ltdb2  node2

Using  787750339 for database Id

Using               1 for instance number

Specify 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 <return> without

specifying a number lists all completed snapshots.

Enter value for num_days: (回车)

Listing all Completed Snapshots

Instance DB Name Snap Id Snap Started Level



ltdb1 LTDB 1412 08 Oct 2016 11:00 1

                               1429 09 Oct 2016 13:04       1

                               1430 09 Oct 2016 13:35       1

                               1431 09 Oct 2016 13:35       1

                               1432 09 Oct 2016 13:51       1

                               1433 09 Oct 2016 14:07       1

                               1434 09 Oct 2016 14:17       1

Specify the Begin and End Snapshot Ids


Enter value for begin_snap: (1433 从上面的列表选出来的。 )(基本上是取最后两个id , 因为上面也是手动创建过两次Snapshots)

Enter value for end_snap: 1434(1434 从上面的列表选出来的。 )

End   Snapshot Id specified: 1434

Specify the Report Name

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

press <return> to continue, otherwise enter an alternative.

Enter value for report_name: (默认报告的名字。路径是/home/orace/ awrrpt_1_1431_1434.html) 回车后就生产报告了。

/export/home/oracle

报告里需要关注的点:主要就是sql脚本执行时间, 这里需要开发调优。

第三列:表示执行该sql所用的时间,如果时间长了需要优化。

简单介绍:

--如果需要的话DBA可以通过DBMS_WORKLOAD_REPOSITORY过程手动创建、删除或修改snapshots.

--提示调用DBMS_WORKLOAD_REPOSITORY包需要拥有DBA权限。

--1.手动创建Snapshots 手动创建Snapshots通过DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT过程

--例如

exec dbms_workload_repository.create_snapshot();

-- 然后可以通过 DBA_HIST_SNAPSHOT 视图查看刚刚创建的Snapshots信息。

SELECT * FROM DBA_HIST_SNAPSHOT;

-- 2手动删除Snapshots

--删除Snapshots是使用DBMS_WORKLOAD_REPOSITORY包的另一个过程DROP_SNAPSHOT_RANGE 该过程在执行时可以通过指定snap_id的范围的方式一次删除多个Snapshot

--例如

select count(0) from dba_hist_snapshot where snap_id between 6770 and 6774;

select max(snap_id) from dba_hist_snapshot;

select dbid from v$database;

exec dbms_workload_repository.drop_snapshot_range(low_snap_id => 6770,high_snap_id => 6774,dbid => 4059638244);

--或者

begin

dbms_workload_repository.drop_snapshot_range(

low_snap_id => 6770,

high_snap_id => 6774,

dbid => 4059638244);

end;

select count(0) from dba_hist_snapshot where snap_id between 6770 and 6774;

原文地址:https://blog.51cto.com/4085457/2392399

时间: 2024-08-29 12:58:21

Oracle生成AWR报告方法的相关文章

oracle手工生成AWR报告方法记录

AWR(Automatic Workload Repository)报告是我们进行日常数据库性能评定.问题SQL发现的重要手段.熟练掌握AWR报告,是做好开发.运维DBA工作的重要基本功. AWR报告的原理是基于Oracle数据库的定时镜像功能.默认情况下,Oracle数据库后台进程会以一定间隔(一小时)收集系统当前状态镜像,并且保存在数据库中.生成AWR报告时,只需要指定进行分析的时间段(开始镜像编号和结束镜像编号),就可以生成该时间段的性能分析情况.AWR镜像保存在数据库中的时间为一个月左右

oracle生成AWR报告

原创作品,出自 "深蓝的blog" 博客,欢迎转载,转载时请务必注明以下出处,否则追究版权法律责任. 深蓝的blog:http://blog.csdn.net/huangyanlong/article/details/43971547 实验环境: 操作系统:win7 旗舰版 64bit 数据库:oracle 11G R2 64bit 第1步:登陆sqlplus C:\Users\Administrator>sqlplus / as sysdba 第2步:跑脚本 SQL> @

oracle11g生成awr报告

Oracle 11g RAC生成 AWR 报告方法  1.生成单实例 AWR 报告:@$ORACLE_HOME/rdbms/admin/awrrpt.sql 2.生成 Oracle RAC AWR 报告:@$ORACLE_HOME/rdbms/admin/awrgrpt.sql 3.生成 RAC 环境中特定数据库实例的 AWR 报告:@$ORACLE_HOME/rdbms/admin/awrrpti.sql 4.生成 Oracle RAC 环境中多个数据库实例的 AWR 报告的方法:@$ORAC

Oracle 11g AWR 系列五:如何生成 AWR 报告?

1.生成单实例 AWR 报告:@$ORACLE_HOME/rdbms/admin/awrrpt.sql2.生成 Oracle RAC AWR 报告:@$ORACLE_HOME/rdbms/admin/awrgrpt.sql3.生成 RAC 环境中特定数据库实例的 AWR 报告:@$ORACLE_HOME/rdbms/admin/awrrpti.sql4.生成 Oracle RAC 环境中多个数据库实例的 AWR 报告的方法:@$ORACLE_HOME/rdbms/admin/awrgrpti.s

ORACLE AWR概述及生成AWR报告

1.Overview of the Automatic Workload Repository The Automatic Workload Repository (AWR) collects, processes, and maintains performance statistics for problem detection and self-tuning purposes. This data is both in memory and stored in the database.

Oracle 每天自动生成AWR报告

经验丰富的老员工希望能够每天为数据库生成1个AWR报告,以便于后期分析数据库的性能变化,手动生成太麻烦,查了一下资料,发现可以自动生成,过程如下. 数据库环境:11gR2 RAC(双节点) AWR报告:由于是RAC数据库,希望生成每个节点的报告及全局报告,时间段为:第一天的0点~第二天的0点. (1)在oracle服务器上创建路径 server2$[/home/oracle]mkdir awrreport (2)创建directory并授权(使用sys账户执行) create or replac

Oracle无法生成awr报告 ORA-20200错误

生成awr报告的过程中,发生awr报告没有快照,并返回ORA-20200错误. 查看dba_hist_active_session_history发现有数据,判断mmon和mmnl后台进程的问题,故需要重新启动mmon和mmnl后台进程 方法一: 重启数据库 方法二: 启用restricted模式,再立马禁用: alter system enable restricted session; alter system disable restricted session; alter日志 Stop

【干货】ORACLE-AWR报告分析

1.什么是AWR? AWR (Automatic Workload Repository) 是自动负载信息库的英文缩写,AWR报告是Oracle 10g以后版本提供的一种性能收集和分析工具,能提供一个时间段内整个系统资源使用情况的报告,通过报告可以了解一个系统的整个运行情况,生成的报告包括多个部分. AWR每小时对v$active_session_history视图(内存中的ASH采集信息,理论为1小时)进行采样一次,并将信息保存到磁盘中,并且保留7天,7天后旧的记录才会被覆盖.这些采样信息被保

手动生成AWR报告

有时候数据库中为安装EM,无法图形化生成AWR报告,此时需要手工生成AWR报告,ORACLE提供了以个sql,可以手工生成AWR报告,首先创建生成报告的目录,这里为/home/oracle/AWR $ mkdir AWR $ cd AWR $ pwd /home/oracle/AWR 进入sqlplus [[email protected] ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Wed Dec 30