导出oracle数据库报告,Oracle数据库AWR报告导出

切换用户

使用oralce用户登陆操作系统,如果不知道oracle用户密码,可从root用户 su - oracle:

server01:root:/>whoami

root

server01:root:/>su - oracle

server01:oracle:/home/oracle>whoami

oracle

server01:oracle:/home/oracle>

sqlplus连接数据库

在oracle用户下执行 sqlplus / as sysdba 命令,连接到oracle数据库:

server01:oracle:/home/oracle>sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Thu Dec 12 00:01:02 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>

导出当前实例的AWR报告

在sqlplus中执行 @?/rdbms/admin/awrrpt.sql :

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

Current Instance

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

DB Id DB Name Inst Num Instance

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

919662622 DEVDB 1 devdb

Specify the Report Type

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

输入导出报告的格式

在执行@?/rdbms/admin/awrrpt.sql命令后,会提示输入导出报告的格式,默认格式为html,如果想导出html格式,直接Enter即可:

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:

输入导出天数

根据需要,输入导出的报告的具体天数,即当前时间N天之内的所有信息:

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:

输入要导出的snap的开始ID

在输入要导出的天数之后,oracle会列出所有满足预期天数的snap的信息,根据需要,输入snap的开始ID:

Listing the last 2 days of Completed Snapshots

Instance DB Name Snap Id Snap Started Snap Level

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

devdb DEVDB 3151 11 Dec 2019 00:00 1

3152 11 Dec 2019 01:00 1

3153 11 Dec 2019 02:00 1

3154 11 Dec 2019 03:00 1

3155 11 Dec 2019 04:00 1

3156 11 Dec 2019 05:00 1

3157 11 Dec 2019 06:00 1

3158 11 Dec 2019 07:00 1

3159 11 Dec 2019 08:00 1

3160 11 Dec 2019 09:00 1

3161 11 Dec 2019 10:00 1

3162 11 Dec 2019 11:00 1

3163 11 Dec 2019 12:00 1

3164 11 Dec 2019 13:00 1

3165 11 Dec 2019 14:00 1

3166 11 Dec 2019 15:00 1

3167 11 Dec 2019 16:00 1

3168 11 Dec 2019 17:00 1

3169 11 Dec 2019 18:00 1

3170 11 Dec 2019 19:00 1

3171 11 Dec 2019 20:00 1

3172 11 Dec 2019 21:00 1

3173 11 Dec 2019 22:00 1

3174 11 Dec 2019 23:00 1

3175 12 Dec 2019 00:00 1

Specify the Begin and End Snapshot Ids

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

Enter value for begin_snap:

输入要导出的snap的截止ID

输入开始ID之后,会提示输入截止ID,根据需要输入截止ID:

Enter value for end_snap:

设置导出的报告名称

导出报告时,如果需要设置导出的报告名称,可根据提示进行修改:

Specify the Report Name

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

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

press to continue, otherwise enter an alternative.

Enter value for report_name:

查看报告

输入报告名称之后并敲击回车之后,oracle会自动生成AWR报告,可退出sqlplus进行查看:

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

server01:oracle:/home/oracle>ls -lrt

total 12544

drwxr-xr-x 4 root system 256 Jul 02 1972 app

-rw-r--r-- 1 oracle dba 25178 Jul 02 1972 db.rsp

-rw-r--r-- 1 oracle dba 8 Jul 03 1972 #UNTITLED#

-rw-r----- 1 oracle dba 4950061 Jul 06 1972 core

-rw-r----- 1 oracle dba 289692 Jul 29 22:31 install2019-07-29_22-17-53.log

drwxr-xr-x 2 oracle dba 256 Aug 01 00:40 scripts

-rw-r--r-- 1 oracle dba 594527 Dec 11 22:37 test.html

-rw-r--r-- 1 oracle dba 545490 Dec 12 00:51 awr.html

本文仅供日常学习交流使用,如有错误之处,欢迎指正。

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值