如何生成Oracle AWR报告

如何生成Oracle AWR报告,第1张

Oracle性能分析入门学习中,遇到Oracle数据库的性能问题,一般首要的步骤就是导出AWR的分析报告,AWR是10g中新引入的一个工具,在这之前一般是利用statspack。要导出AWR报告,只要利用Oracle的一个脚本即可以完成,下面是我利用script录制的一段导出AWR report的过程。

首先进入$ORACLE_HOME/rdbms/admin目录,在sqlplus下运行@awrrpt脚本,按照提示一步一步就可以达成,导出的格式有两种,txt格式和html格式。

在OTN上,有一个DBA新feature系列,第六周就是专门讲的这个feature,大家可以去那里了解一下(中文的)

Script started on Sun 27 Jan 2008 08:47:15 PM PST

[ractest@sun880-1 /u01/app/oracle/orahome/rdbms/admin]$ cd $ORACLE_HOME/rdbms/admin

[ractest@sun880-1 /u01/app/oracle/orahome/rdbms/admin]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Sun Jan 27 20:47:38 2008

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production

With the Partitioning, Real Application Clusters, OLAP, Data Mining

and Real Application Testing options

SQL>@awrrpt

Current Instance

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

DB Id DB Name Inst Num Instance

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

2080780909 ORCLDB 1 orcldb1

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: text

Type Specified: text

Instances in this Workload Repository schema

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

DB Id Inst Num DB Name Instance Host

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

* 2080780909 1 ORCLDB orcldb1 sun880-1

2080780909 4 ORCLDB orcldb4 sun880-4

2080780909 2 ORCLDB orcldb2 sun880-2

2080780909 3 ORCLDB orcldb3 sun880-3

Using 2080780909 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 without

specifying a number lists all completed snapshots.

Enter value for num_days: 1

Listing the last day’s Completed Snapshots

Snap

Instance DB Name Snap Id Snap Started Level

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

orcldb1 ORCLDB 66 27 Jan 2008 00:55 1

67 27 Jan 2008 01:55 1

68 27 Jan 2008 02:55 1

69 27 Jan 2008 03:55 1

70 27 Jan 2008 04:55 1

71 27 Jan 2008 05:55 1

72 27 Jan 2008 06:55 1

73 27 Jan 2008 07:55 1

74 27 Jan 2008 08:55 1

75 27 Jan 2008 09:55 1

76 27 Jan 2008 10:55 1

77 27 Jan 2008 11:55 1

78 27 Jan 2008 12:55 1

83 27 Jan 2008 17:54 1

84 27 Jan 2008 18:55 1

85 27 Jan 2008 19:55 1

Specify the Begin and End Snapshot Ids

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

Enter value for begin_snap: 70

Begin Snapshot Id specified: 70

Enter value for end_snap: 71

End Snapshot Id specified: 71

Specify the Report Name

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

The default report file name is awrrpt_1_70_71.txt. To use this name,

press to continue, otherwise enter an alternative.

Enter value for report_name:

Using the report name awrrpt_1_70_71.txt

WORKLOAD REPOSITORY report for

DB Name DB Id Instance Inst Num Release RAC Host

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

ORCLDB 2080780909 orcldb1 1 10.2.0.4.0 YES sun880-1

Snap Id Snap Time Sessions Curs/Sess

——— ——————- ——– ———

Begin Snap: 70 27-Jan-08 04:55:07 136 16.2

End Snap: 71 27-Jan-08 05:55:21 141 16.5

Elapsed: 60.23 (mins)

DB Time: 5,814.07 (mins)

Cache Sizes

~~~~~~~~~~~ Begin End

//此处有删减

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

End of Report

Report written to awrrpt_1_70_71.txt

SQL>quit

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production

With the Partitioning, Real Application Clusters, OLAP, Data Mining

and Real Application Testing options

[ractest@sun880-1 /u01/app/oracle/orahome/rdbms/admin]$ exit

script done on Sun 27 Jan 2008 08:48:16 PM PST

我用FineReport报表、JasperReport等报表开发工具连oracle时都出现过类似问题,主要原因是由于监听器不识别java应用程序中定义的数据库名称导致的,需要修改设计器中数据连接所定义的数据库名。ORACLE是通过外界提供的服务名来判断是否建立连接的,所以要保证设计器端跟数据库端的数据库名称匹配。

ORACLE数据库的安装目录中通常包含这2个文件:tnsname.ora跟listener.ora。Tnsname.ora是客户端的配置文件,listener.org是监听程序的配置文件。在tnsname.org里面可以找到对应的数据库名。

最近一直在弄db2数据库,以至于oracle放松了很多,今天测试部门过来问了个关于oracle的问题,解决的不是很完美.

问题是这样.测试从客户的生产库expdb回来的数据,要在实验机器上导入,结果报错,让我过去看看。

我过去看了看,报了6550错误。于是上google搜索了下6550错误的成因,有很多帖子说是导入的用户没有足够权限,于是我grant sysdba to user,可是这样后,仍然报6550错误,很是诧异。仔细看了看测试给的错误截图,有2条命令 一个是 impdp user/password file="/dev" 报file不存在,还有一个命令是imp user/password file="/dev" 报的是6550错误。再上google查了一下,还有说6550错误需要用impdp导入。于是觉得应该用第一条命令。仔细看了看语法,把 impdp user/password file= 改成了impdp user/password dumpfile= .到了测试部门一看,果然用这个命令可以,可是。同时出现了新的问题。说数据泵和数据库版本不一致,这个问题我还不知道怎么解决。只好让测试重新装了一次oracle,才解决的。

文章出处:http://www.diybl.com/course/7_databases/oracle/oraclejs/200873/130043.html


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/sjk/9605493.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-30
下一篇 2023-04-30

发表评论

登录后才能评论

评论列表(0条)

保存