oracle数据文件的存放位置(oracle常用命令)


前言:

 在生产环境中,当运行中的Oracle数据库出现性能问题的时候,DBA通常都需要我们生成Oracle数据库出现性能问题时间段的AWR或者ASH等报告来判断原因,所以维护人员学会收集AWR、ADDM、ASH报告是必须的。

环境:

 CentOS 7.5

 Docker 20.10.2

 Oracle_11g

AWR报告收集:

 AWR(Automatic Workload Repository)自动工作负载库是Oracle公司提供的一个工具。AWR来可以自动收集、处理、并保存性能统计结果,这种统计数据存放在内存中并随后存储在数据库中,这些数据既能在报告中显示也可以通过视图查询。可以协助我们找出Oracle的性能瓶颈。

 @?/rdbms/admin/awrrpt

Oracle 11G常见性能诊断报告(AWR/ADDM/ASH)收集
Oracle 11G常见性能诊断报告(AWR/ADDM/ASH)收集
Oracle 11G常见性能诊断报告(AWR/ADDM/ASH)收集
[root@localhost ~]# docker ps
CONTAINER ID   IMAGE                                      COMMAND                  CREATED        STATUS         PORTS                    NAMES
3edfba76f476   registry.aliyuncs.com/helowin/oracle_11g   "/bin/sh -c '/home/o…"   6 months ago   Up 2 seconds   0.0.0.0:1521->1521/tcp   oracle_11g

[root@localhost ~]# docker exec -it oracle_11g /bin/bash

[oracle@3edfba76f476 /]$ su - root  //切换为root用户
Password:      # 密码默认为 helowin

[oracle@3edfba76f476 /]$ su - oracle   //再切换oracle用户,并且以SYS登录数据库

[oracle@3edfba76f476 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Fri Aug 20 16:13:26 2021

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


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

SQL> @?/rdbms/admin/awrrpt     //执行这个SQL就可以开始AWR报告收集
Current Instance
~~~~~~~~~~~~~~~~

   DB Id    DB Name      Inst Num Instance
----------- ------------ -------- ------------
 1384114315 HELOWIN             1 helowin


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:   //提示你输入生成报告类型,默认为HTML,回车即可

Type Specified:  html


Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   DB Id     Inst Num DB Name      Instance     Host
------------ -------- ------------ ------------ ------------
  1384114315        1 ORCL         orcl         32e47e645a97
  1384114315        1 ORCL         helowin      a444e690ce3e
  1384114315        1 ORCL         orcl         a444e690ce3e
  1384114315        1 ORCL         helowin      85e4a929d0f8
* 1384114315        1 HELOWIN      helowin      3edfba76f476
  1384114315        1 HELOWIN      helowin      85e4a929d0f8

Using 1384114315 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: 1     //输入快照查看的间隔,一般一天的就行,实际根据DBA的要求来做

Listing the last day's Completed Snapshots

                                                        Snap
Instance     DB Name        Snap Id    Snap Started    Level
------------ ------------ --------- ------------------ -----
helowin      HELOWIN            253 21 Apr 2021 18:12      1
                                254 21 Apr 2021 19:00      1
                                255 21 Apr 2021 20:00      1



Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 253      //首先输入开始的快照ID,此处为253
Begin Snapshot Id specified: 253

Enter value for end_snap: 255       //输入快照结束ID,可以根据要求的时间确定,此处为255
End   Snapshot Id specified: 255



Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is awrrpt_1_253_255.html.  To use this name,
press <return> to continue, otherwise enter an alternative.

Enter value for report_name:    //输入报告的名字,默认的就可以,例如:awrrpt_1_167_169.html. 实例1 快照167-169的AWR报告,此处回车就行,报告生成在当前目录下

Using the report name awrrpt_1_253_255.html

<html><head><title>AWR Report for DB: HELOWIN, Inst: helowin, Snaps: 253-255</title>
<style type="text/css">
body.awr {font:bold 10pt Arial,Helvetica,Geneva,sans-serif;color:black; background:White;}
pre.awr  {font:8pt Courier;color:black; background:White;}
h1.awr   {font:bold 20pt Arial,Helvetica,Geneva,sans-serif;color:#336699;background-color:White;border-bottom:1px solid #cccc99;margin-top:0pt; margin-bottom:0pt;padding:0px 0px 0px 0px;}
h2.awr   {font:bold 18pt Arial,Helvetica,Geneva,sans-serif;color:#336699;background-color:White;margin-top:4pt; margin-bottom:0pt;}
h3.awr {font:bold 16pt Arial,Helvetica,Geneva,sans-serif;color:#336699;background-color:White;margin-top:4pt; margin-bottom:0pt;}
li.awr {font: 8pt Arial,Helvetica,Geneva,sans-serif; color:black; background:White;}
th.awrnobg {font:bold 8pt Arial,Helvetica,Geneva,sans-serif; color:black; background:White;padding-left:4px; padding-right:4px;padding-bottom:2px}
th.awrbg {font:bold 8pt Arial,Helvetica,Geneva,sans-serif; color:White; background:#0066CC;padding-left:4px; padding-right:4px;padding-bottom:2px}
td.awrnc {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:White;vertical-align:top;}
td.awrc    {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:#FFFFCC; vertical-align:top;}
td.awrnclb {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:White;vertical-align:top;border-left: thin solid black;}
td.awrncbb {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:White;vertical-align:top;border-left: thin solid black;border-right: thin solid black;}
......
<p />
End of Report
</body></html>
Report written to awrrpt_1_253_255.html
SQL> !pwd
/home/oracle

1.1 查看oracle容器内生成的AWR报告

[root@test ~]# docker ps
CONTAINER ID   IMAGE                                      COMMAND                  CREATED        STATUS       PORTS                      NAMES
3edfba76f476   registry.aliyuncs.com/helowin/oracle_11g   "/bin/sh -c '/home/o…"   2 months ago   Up 3 hours   0.0.0.0:1521->1521/tcp     oracle_11g

[root@test ~]# docker exec -it oracle_11g bash

[oracle@3edfba76f476 /]$ su - root
Password:  helowin

[root@3edfba76f476 ~]# su - oracle

[oracle@3edfba76f476 ~]$ ls /home/oracle/
app  awrrpt_1_253_255.html

1.2 导出oracle容器内部的AWR报告至之宿主机

—》docker cp 容器ID:容器内文件路径 ./(宿主机路径)

[root@test ~]# docker cp 3edfba76f476:/home/oracle/awrrpt_1_253_255.html ./

其他(RAC):

 因为有的系统一般都是RAC,所以需要在各个节点下的AWR报告,如果你愿意登录各个节点,可以使用一下SQL

SQL> @?/rdbms/admin/awrrpti.sql  //和上边的区别就在这于,输入报告类型后的部分
Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  DB Id    Inst Num DB Name     Instance    Host
------------ -------- ------------ ------------ ------------
  3704746844       2 HS08      HS082       hp102
* 3704746844       1 HS08      HS081       hp101
Enter value for dbid: 3704746844                      (会要求你输入数据库的DBID)
Using 3704746844 for database Id
Enter value for inst_num: 1                                (输入数据库实例NUM,一般就是2节点,所以一般就是输入1 或者2)剩下的部分没啥区别
Using 1 for instance number

ADDM报告收集:

 ADDM(Automatic Database Diagnostic Monitor) 是植入Oracle数据库的一个自诊断引擎.ADDM 通过检查和分析AWR获取的数据来判断Oracle数据库中可能的问题.

 @?/rdbms/admin/addmrpt

Oracle 11G常见性能诊断报告(AWR/ADDM/ASH)收集
Oracle 11G常见性能诊断报告(AWR/ADDM/ASH)收集
...
SQL> @?/rdbms/admin/addmrpt     //执行这个SQL就可以开始AWR报告收集

Current Instance
~~~~~~~~~~~~~~~~

   DB Id    DB Name      Inst Num Instance
----------- ------------ -------- ------------
 1384114315 HELOWIN             1 helowin


Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   DB Id     Inst Num DB Name      Instance     Host
------------ -------- ------------ ------------ ------------
  1384114315        1 ORCL         orcl         32e47e645a97
  1384114315        1 ORCL         helowin      a444e690ce3e
  1384114315        1 ORCL         orcl         a444e690ce3e
  1384114315        1 ORCL         helowin      85e4a929d0f8
* 1384114315        1 HELOWIN      helowin      3edfba76f476
  1384114315        1 HELOWIN      helowin      85e4a929d0f8

Using 1384114315 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.



Listing the last 3 days of Completed Snapshots

                                                        Snap
Instance     DB Name        Snap Id    Snap Started    Level
------------ ------------ --------- ------------------ -----
helowin      HELOWIN            253 21 Apr 2021 18:12      1
                                254 21 Apr 2021 19:00      1
                                255 21 Apr 2021 20:00      1
                                256 21 Apr 2021 21:00      1



Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 254
Begin Snapshot Id specified: 254

Enter value for end_snap: 256
End   Snapshot Id specified: 256



Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is addmrpt_1_254_256.txt.  To use this name,
press <return> to continue, otherwise enter an alternative.

Enter value for report_name:

Using the report name addmrpt_1_254_256.txt


Running the ADDM analysis on the specified pair of snapshots ...


Generating the ADDM report for this analysis ...


          ADDM Report for Task 'TASK_295'
          -------------------------------

Analysis Period
---------------
AWR snapshot range from 254 to 256.
Time period starts at 21-APR-21 07.00.07 PM
Time period ends at 21-APR-21 09.00.21 PM

Analysis Target
---------------
Database 'HELOWIN' with DB ID 1384114315.
Database version 11.2.0.1.0.
ADDM performed an analysis of instance helowin, numbered 1 and hosted at
3edfba76f476.

Activity During the Analysis Period
-----------------------------------
Total database time was 263 seconds.
The average number of active sessions was .04.


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

There are no findings to report.

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

          Additional Information
          ----------------------

Miscellaneous Information
-------------------------
There was no significant database activity to run the ADDM.


End of Report
Report written to addmrpt_1_254_256.txt
Oracle 11G常见性能诊断报告(AWR/ADDM/ASH)收集


2.1 查看oracle容器内生成的ADDM报告

[root@test ~]# docker ps
CONTAINER ID   IMAGE                                      COMMAND                  CREATED        STATUS       PORTS                      NAMES
3edfba76f476   registry.aliyuncs.com/helowin/oracle_11g   "/bin/sh -c '/home/o…"   2 months ago   Up 3 hours   0.0.0.0:1521->1521/tcp     oracle_11g

[root@test ~]# docker exec -it oracle_11g bash

[oracle@3edfba76f476 /]$ su - root
Password:  helowin

[root@3edfba76f476 ~]# su - oracle

[oracle@3edfba76f476 ~]$ pwd
/home/oracle

[oracle@3edfba76f476 ~]$ ls
addmrpt_1_254_256.txt  app  awrrpt_1_253_255.html

2.2 导出oracle容器内部的ADDM报告至之宿主机

—》docker cp 容器ID:容器内文件路径 ./(宿主机路径)

[root@test ~]# docker cp 3edfba76f476:/home/oracle/addmrpt_1_254_256.txt ./

其他(RAC):

 因为有的系统一般都是RAC,所以需要在各个节点下的AWR报告,如果你愿意登录各个节点,可以使用一下SQL

使用addmrpti.sql脚本:@?/rdbms/admin/addmrpt.sql

ASH报告收集:

 ASH即活动会话历史,Active Session History,ASH以VSESSION为基础,每秒采样一次,记录活动会话等待的事件。不活动的会话不会采样, 采样工作由新引入的后台进程MMNL完成。

 Oracle v$active_session_history视图提供了实例中的活动会话采样。通过该视图提供的最详细最完整性能数据,可作为定位性能故障的一手证据。任一连接到数据库时,那些不属于空闲等待类的事件的会话被认为是活动会话。这包括在采样时在CPU上的任何会话。

 @?/rdbms/admin/ashrpt

Oracle 11G常见性能诊断报告(AWR/ADDM/ASH)收集
Oracle 11G常见性能诊断报告(AWR/ADDM/ASH)收集
Oracle 11G常见性能诊断报告(AWR/ADDM/ASH)收集
Oracle 11G常见性能诊断报告(AWR/ADDM/ASH)收集
Oracle 11G常见性能诊断报告(AWR/ADDM/ASH)收集
...
SQL> @?/rdbms/admin/ashrpt    //执行这个SQL就可以开始ASH报告收集

Current Instance
~~~~~~~~~~~~~~~~

   DB Id    DB Name      Inst Num Instance
----------- ------------ -------- ------------
 1384114315 HELOWIN             1 helowin


Specify the Report Type
~~~~~~~~~~~~~~~~~~~~~~~
Enter 'html' for an HTML report, or 'text' for plain text
Defaults to 'html'
Enter value for report_type:       //提示你输入生成报告类型,默认为HTML,回车即可

Type Specified:  html


Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   DB Id     Inst Num DB Name      Instance     Host
------------ -------- ------------ ------------ ------------
  1384114315        1 ORCL         orcl         32e47e645a97
  1384114315        1 ORCL         helowin      a444e690ce3e
  1384114315        1 ORCL         orcl         a444e690ce3e
  1384114315        1 ORCL         helowin      85e4a929d0f8
* 1384114315        1 HELOWIN      helowin      85e4a929d0f8
* 1384114315        1 HELOWIN      helowin      3edfba76f476

Defaults to current database

Using database id: 1384114315

Enter instance numbers. Enter 'ALL' for all instances in a
RAC cluster or explicitly specify list of instances (e.g., 1,2,3).
Defaults to current instance.

Using instance number(s): 1

ASH Samples in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Oldest ASH sample available:  21-Apr-21 18:00:56   [    236 mins in the past]
Latest ASH sample available:  21-Apr-21 21:57:14   [      0 mins in the past]


Specify the timeframe to generate the ASH report
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter begin time for report:       

--    Valid input formats:
--      To specify absolute begin time:
--        [MM/DD[/YY]] HH24:MI[:SS]
--        Examples: 02/23/03 14:30:15
--                  02/23 14:30:15
--                  14:30:15
--                  14:30
--      To specify relative begin time: (start with '-' sign)
--        -[HH24:]MI
--        Examples: -1:15  (SYSDATE - 1 Hr 15 Mins)
--                  -25    (SYSDATE - 25 Mins)

Defaults to -15 mins
Enter value for begin_time: 18:00   //输入开始的时间,格式为: 年/月/日 小时/分钟/秒
Report begin time specified: 18:00   

Enter duration in minutes starting from begin time:
Defaults to SYSDATE - begin_time
Press Enter to analyze till current time
Enter value for duration: 60
Report duration specified:   60

Using 21-Apr-21 18:00:00 as report begin time
Using 21-Apr-21 19:00:00 as report end time


Specify Slot Width (using ashrpti.sql) for 'Activity Over Time' section
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-- Explanation:
--   In the 'Activity Over Time' section of the ASH report,
--   the analysis period is divided into smaller slots
--   and top wait events are reported in each of those slots.

-- Default:
--   The analysis period will be automatically split upto 10 slots
--   complying to a minimum slot width of
--     1 minute,  if the source is V$ACTIVE_SESSION_HISTORY or
--     5 minutes, if the source is DBA_HIST_ACTIVE_SESS_HISTORY.


Specify Slot Width in seconds to use in the 'Activity Over Time' section:
Defaults to a value as explained above:
Slot Width specified:


Specify Report Targets (using ashrpti.sql) to generate the ASH report
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-- Explanation:
--   ASH Report can accept "Report Targets",
--   like a particular SQL statement, or a particular SESSION,
--   to generate the report on. If one or more report targets are
--   specified, then the data used to generate the report will only be
--   the ASH samples that pertain to ALL the specified report targets.

-- Default:
--   If none of the report targets are specified,
--   then the target defaults to all activity in the database instance.


Specify SESSION_ID (eg: from V$SESSION.SID) report target:
Defaults to NULL:
SESSION report target specified:


Specify SQL_ID (eg: from V$SQL.SQL_ID) report target:
Defaults to NULL: (% and _ wildcards allowed)
SQL report target specified:


Specify WAIT_CLASS name (eg: from V$EVENT_NAME.WAIT_CLASS) report target:
[Enter 'CPU' to investigate CPU usage]
Defaults to NULL: (% and _ wildcards allowed)
WAIT_CLASS report target specified:


Specify SERVICE_HASH (eg: from V$ACTIVE_SERVICES.NAME_HASH) report target:
Defaults to NULL:
SERVICE report target specified:


Specify MODULE name (eg: from V$SESSION.MODULE) report target:
Defaults to NULL: (% and _ wildcards allowed)
MODULE report target specified:


Specify ACTION name (eg: from V$SESSION.ACTION) report target:
Defaults to NULL: (% and _ wildcards allowed)
ACTION report target specified:


Specify CLIENT_ID (eg: from V$SESSION.CLIENT_IDENTIFIER) report target:
Defaults to NULL: (% and _ wildcards allowed)
CLIENT_ID report target specified:


Specify PLSQL_ENTRY name (eg: "SYS.DBMS_LOB.*") report target:
Defaults to NULL: (% and _ wildcards allowed)
PLSQL_ENTRY report target specified:

Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is ashrpt_1_0421_1900.html.  To use this name,
press <return> to continue, otherwise enter an alternative.
Enter value for report_name:

Using the report name ashrpt_1_0421_1900.html

Summary of All User Input
-------------------------
Format         : HTML
DB Id          : 1384114315
Inst num       : 1
Begin time     : 21-Apr-21 18:00:00
End time       : 21-Apr-21 19:00:00
Slot width     : Default
Report targets : 0
Report name    : ashrpt_1_0421_1900.html


<html><head><title>ASH Report - From 21-Apr-21 18:00:00 To 21-Apr-21 19:00:00</title>
<style type="text/css">
body.awr {font:bold 10pt Arial,Helvetica,Geneva,sans-serif;color:black; background:White;}
pre.awr  {font:8pt Courier;color:black; background:White;}
h1.awr   {font:bold 20pt Arial,Helvetica,Geneva,sans-serif;color:#336699;background-color:White;border-bottom:1px solid #cccc99;margin-top:0pt; margin-bottom:0pt;padding:0px 0px 0px 0px;}
h2.awr   {font:bold 18pt Arial,Helvetica,Geneva,sans-serif;color:#336699;background-color:White;margin-top:4pt; margin-bottom:0pt;}
h3.awr {font:bold 16pt Arial,Helvetica,Geneva,sans-serif;color:#336699;background-color:White;margin-top:4pt; margin-bottom:0pt;}
li.awr {font: 8pt Arial,Helvetica,Geneva,sans-serif; color:black; background:White;}
th.awrnobg {font:bold 8pt Arial,Helvetica,Geneva,sans-serif; color:black; background:White;padding-left:4px; padding-right:4px;padding-bottom:2px}
th.awrbg {font:bold 8pt Arial,Helvetica,Geneva,sans-serif; color:White; background:#0066CC;padding-left:4px; padding-right:4px;padding-bottom:2px}
td.awrnc {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:White;vertical-align:top;}
td.awrc    {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:#FFFFCC; vertical-align:top;}
td.awrnclb {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:White;vertical-align:top;border-left: thin solid black;}
td.awrncbb {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:White;vertical-align:top;border-left: thin solid black;border-right: thin solid black;}
td.awrncrb {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:White;vertical-align:top;border-right: thin solid black;}
td.awrcrb    {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:#FFFFCC; vertical-align:top;border-right: thin solid black;}
td.awrclb    {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:#FFFFCC; vertical-align:top;border-left: thin solid black;}
td.awrcbb    {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:#FFFFCC; vertical-align:top;border-left: thin solid black;border-right: thin solid black;}
a.awr {font:bold 8pt Arial,Helvetica,sans-serif;color:#663300; vertical-align:top;margin-top:0pt; margin-bottom:0pt;}
td.awrnct {font:8pt Arial,Helvetica,Geneva,sans-serif;border-top: thin solid black;color:black;background:White;vertical-align:top;}
td.awrct   {font:8pt Arial,Helvetica,Geneva,sans-serif;border-top: thin solid black;color:black;background:#FFFFCC; vertical-align:top;}
td.awrnclbt  {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:White;vertical-align:top;border-top: thin solid black;border-left: thin solid black;}
td.awrncbbt  {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:White;vertical-align:top;border-left: thin solid black;border-right: thin solid black;border-top: thin solid black;}
td.awrncrbt {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:White;vertical-align:top;border-top: thin solid black;border-right: thin solid black;}
td.awrcrbt     {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:#FFFFCC; vertical-align:top;border-top: thin solid black;border-right: thin solid black;}
td.awrclbt     {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:#FFFFCC; vertical-align:top;border-top: thin solid black;border-left: thin solid black;}
td.awrcbbt   {font:8pt Arial,Helvetica,Geneva,sans-serif;color:black;background:#FFFFCC; vertical-align:top;border-top: thin solid black;border-left: thin solid black;border-right: thin solid black;}
table.tdiff {  border_collapse: collapse; }
</style></head><body class="awr">
<h1 class="awr">
ASH Report For HELOWIN/helowin

</h1>
<p />
<table border="1" width="500">
<tr><th class="awrbg">DB Name</th><th class="awrbg">DB Id</th><th class="awrbg">Instance</th><th class="awrbg">Inst num</th><th class="awrbg">Release</th><th class="awrbg">RAC</th><th class="awrbg">Host</th></tr>
<tr><td class='awrnc'>HELOWIN</td><td align="right" class='awrnc'>1384114315</td><td class='awrnc'>helowin</td><td align="right" class='awrnc'>1</td><td class='awrnc'>11.2.0.1.0</td><td 
......
class='awrc'> </td><td class='awrc'>db file sequential read</td><td align="right" class='awrc'>1</td><td align="right" class='awrc'>2.17</td></tr>
</table><p />
<br /><a class="awr" href="#top">Back to Top</a><p />
<p />
End of Report
</body></html>
Report written to ashrpt_1_0421_1900.html     //输入报告的名字,默认回车即可

3.1 查看oracle容器内生成的ADDM报告

[root@test ~]# docker ps
CONTAINER ID   IMAGE                                      COMMAND                  CREATED        STATUS       PORTS                      NAMES
3edfba76f476   registry.aliyuncs.com/helowin/oracle_11g   "/bin/sh -c '/home/o…"   2 months ago   Up 3 hours   0.0.0.0:1521->1521/tcp     oracle_11g

[root@test ~]# docker exec -it oracle_11g bash

[oracle@3edfba76f476 /]$ su - root
Password:  helowin

[root@3edfba76f476 ~]# su - oracle

[oracle@3edfba76f476 ~]$ pwd
/home/oracle

[oracle@3edfba76f476 ~]$ ls
addmrpt_1_254_256.txt  app  ashrpt_1_0421_1900.html  awrrpt_1_253_255.html

3.2 导出oracle容器内部的ADDM报告至之宿主机

—》docker cp 容器ID:容器内文件路径 ./(宿主机路径)

[root@test ~]# docker cp 3edfba76f476:/home/oracle/ashrpt_1_0421_1900.html ./

其他(RAC):

 因为有的系统一般都是RAC,所以需要在各个节点下的AWR报告,如果你愿意登录各个节点,可以使用一下SQL

@?/rdbms/admin/ashrpti.sql与上边的不同也就是需要输入DBID和实例NUMBER,明白提示的意思就行。

—注意— :

 在生成报告期间,不能有数据库重启的操作,如果有会有报错。

查看生成的各项报告:

Oracle 11G常见性能诊断报告(AWR/ADDM/ASH)收集


AWR报告

Oracle 11G常见性能诊断报告(AWR/ADDM/ASH)收集

ADDM报告

Oracle 11G常见性能诊断报告(AWR/ADDM/ASH)收集


ASH报告

Oracle 11G常见性能诊断报告(AWR/ADDM/ASH)收集

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发表评论

登录后才能评论