oracle 03-16 数据库维护 SQL> @addmrpt ADDM报告

database maintenance

Objectives
After completing this lesson, you should be able to:
• Manage the Automatic Workload Repository (AWR)
• Use the Automatic Database Diagnostic Monitor (ADDM)
• Describe and use the advisory framework
• Set alert thresholds
• Use server-generated alerts
• Use automated tasks

目标

完成本课程后,您应该能够:

•管理自动工作负载存储库(AWR)

•使用自动数据库诊断监视器(ADDM)

•描述和使用咨询框架

•设置警报阈值

•使用服务器生成的警报

•使用自动化任务

Automatic Workload Repository

自动工作负载存储库

Automatic Diagnostic Repository

自动诊断库

Advisory framework

Automated tasks

Server alerts

咨询框架

自动化任务

服务器警报

Viewing the Alert History

查看警报历史记录

Terminology
• Statistics: Data collections providing database and object detail
– Optimizer statistics: Used by query optimizer
– Database statistics: Used for performance
• Metric: Rate of change in a cumulative statistic
• Threshold: A boundary value against which metric values are compared
• Automatic Workload Repository (AWR): Infrastructure for data gathering, analysis, and solutions recommendations
• AWR Baseline: A set of AWR snapshots for performance comparison

术语

•统计:提供数据库和对象详细信息的数据收集

–优化器统计信息:由查询优化器使用

–数据库统计:用于性能

•指标:累积统计的变化率

•阈值:与度量值进行比较的边界值

•自动工作负载存储库(AWR):用于数据收集、分析和解决方案建议的基础设施

•AWR基线:一组用于性能比较的AWR快照

Automatic Workload Repository (AWR): Overview
• Built-in repository of performance information
• Snapshots of database metrics taken every 60 minutes and retained for eight days
• Foundation for all self-management functions

自动工作负载存储库(AWR):概述

•内置性能信息存储库

•每60分钟拍摄一次并保留8天的数据库指标快照

•所有自我管理功能的基础

 [root@yf ~]# find / -name awrrpt.sql   此文件发生在两个快照之间

SQL> @awrrpt     生成报告命令

Specify the Report Type
~~~~~~~~~~~~~~~~~~~~~~~
AWR reports can be generated in the following formats. Please enter the
name of the format at the prompt. Default value is 'html'.

'html' HTML format (default)
'text' Text format
'active-html' Includes Performance Hub active report

Enter value for report_type:html              此处询问生成awrrpt文件的时候是什么格式

Enter value for num_days: 5                    查询几天之内的快照值

Listing the last 5 days of Completed Snapshots
Instance DB Name Snap Id Snap Started Snap Level
------------ ------------ ---------- ------------------ ----------

orcl ORCL 320 28 Jun 2020 19:56 1
321 28 Jun 2020 21:00 1
322 28 Jun 2020 22:00 1
323 28 Jun 2020 23:00 1
324 29 Jun 2020 00:00 1
325 29 Jun 2020 01:00 1
326 29 Jun 2020 02:00 1
327 29 Jun 2020 03:00 1
328 29 Jun 2020 04:00 1
329 29 Jun 2020 05:00 1
330 29 Jun 2020 06:00 1
331 29 Jun 2020 07:00 1
332 29 Jun 2020 08:00 1
333 29 Jun 2020 09:00 1
334 29 Jun 2020 10:00 1
335 29 Jun 2020 11:00 1
336 29 Jun 2020 12:00 1
337 29 Jun 2020 13:00 1
338 29 Jun 2020 14:00 1
339 29 Jun 2020 15:00 1
340 29 Jun 2020 16:00 1
341 30 Jun 2020 20:18 1
342 30 Jun 2020 21:00 1


Specify the Begin and End Snapshot Ids
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Enter value for begin_snap: 320        询问快照报告开始时间             

Begin Snapshot Id specified: 330

Enter value for end_snap:330          询问快照报告结束时间

declare
*
ERROR at line 1:
ORA-20200: The instance was shutdown between snapshots 320 and 330     在320与330之间产生过shutdown,不连续了,所以报告无法生成
ORA-06512: at line 46


Disconnected from Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.3.0.0.0

Specify the Begin and End Snapshot Ids     将开始时间ID与结束时间ID改成321与322(中间没shutdown过的两个点)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 321
Begin Snapshot Id specified: 321

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

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

Enter value for report_name:today_awr.html          输入报告名称

SQL> exit
Disconnected from Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.3.0.0.0
[oracle@yf admin]$ ls *.html
today_awr.html       此处为新生成的文件
[oracle@yf admin]$ pwd
/u01/app/oracle/product/18c/rdbms/admin    可在浏览器中按此路径打开这个文件,最后要加上文件名 /today_awr.html

AWR Infrastructure  AWR基础设施

Automatic Workload Repository  自动工作负载存储库

AWR Baselines  AWR基线

DBMS_WORKLOAD_REPOSITORY.CREATE_BASELINE ( -
start_snap_id IN NUMBER,
end_snap_id IN NUMBER,
baseline_name IN VARCHAR2);

Accessing the AWR Page  访问AWR页面

Managing the AWR
• Retention period
– Default: Eight days
– Consider storage needs
• Collection interval
– Default: 60 minutes
– Consider storage needs
and performance impact
• Collection level
– Basic (disables most ADDM functionality)
– Typical (recommended)
– All (adds additional SQL tuning information to snapshots)

管理AWR

•保留期

–默认值:8天

–考虑存储需求

•收集间隔

–默认值:60分钟

–考虑存储需求

和性能影响

•收集级别

–基本(禁用大多数ADDM功能)

–典型(推荐)

–All(向快照添加其他SQL优化信息)

Statistic Levels   统计水平

SQL> conn / as sysdba
Connected.
SQL> show parameter level 

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
audit_syslog_level string
inmemory_automatic_level string OFF
plsql_optimize_level integer 2
statistics_level string TYPICAL       此参数限定是否使用awr框架

Automatic Database Diagnostic Monitor (ADDM)
• Runs after each AWR snapshot
• Monitors the instance; detects bottlenecks
• Stores results in the AWR

自动数据库诊断监视器(ADDM)

•在每个AWR快照后运行

•监控实例;检测瓶颈

•在AWR中存储结果

ADDM Findings in Enterprise Manager Cloud Control  企业管理器云控制中的ADDM发现

[root@yf ~]# find / -name addmrpt.sql

[oracle@yf admin]$ sqlplus / as sysdba

SQL> @addmrpt

与SQL> @awrrpt     生成报告命令序基本同

比如,最后生成报告命名为 today_addm.txt

SQL> exit

oracle@yf admin]$ more today_addm.txt    查看是否存在瓶颈

ADDM Findings in Enterprise Manager Database Express  在Enterprise Manager Database Express中的ADDM发现

Advisory Framework  咨询框架

Viewing the Advisor Central Page in Enterprise Manager Cloud Control  在Enterprise Manager云控制中查看Advisor中心页面

Using Packages to Invoke the Advisors
Package Name
DBMS_ADDM
(DBMS_ADDM)
DBMS_ADVISOR
DBMS_COMPRESSION
DBMS_SQLDIAG
DBMS_SQLPA
DBMS_SQLTUNE

Advisor Name
Automatic Database Diagnostic Monitor
SQL Access Advisor and Segment Advisor
Compression Advisor
SQL Repair Advisor
SQL Performance Analyzer
SQL Tuning Advisor

使用包调用顾问

程序包名称

数据库管理系统

(数据库管理系统)

数据库管理系统顾问

DBMS U压缩

数据库管理系统

数据库管理系统

数据库管理系统

顾问姓名

自动数据库诊断监视器

SQL访问顾问和段顾问

压缩顾问

SQL修复顾问

SQL性能分析

SQL优化顾问

Automated Maintenance Tasks
Autotask maintenance process:
1. Maintenance Window opens.
2. Autotask background process schedules jobs.
3. Scheduler initiates jobs.
4. Resource Manager limits impact of Autotask jobs.
Default Autotask maintenance jobs:
• Gathering optimizer statistics
• Automatic Segment Advisor
• Automatic SQL Advisor

自动化维护任务

自动任务维护过程:

1维护窗口打开。

2自动任务后台进程调度作业。

三。调度程序启动作业。

4资源管理器限制自动任务作业的影响。

默认自动任务维护作业:

•收集优化器统计信息

•自动分部顾问

•自动SQL顾问

Automated Maintenance Tasks  自动化维护任务

Automated Maintenance Tasks Configuration  自动维护任务配置

Server-Generated Alerts  服务器生成的警报

Setting Metrics Thresholds  设置指标阈值

Reacting to Alerts
• If necessary, you should gather more input (for example, by running ADDM or another advisor).
• Investigate critical errors.
• Take corrective measures.
• Acknowledge alerts that are not automatically cleared.

对警报作出反应

•如有必要,您应该收集更多的输入(例如,通过运行ADDM或其他advisor)。

•调查关键错误。

•采取纠正措施。

•确认未自动清除的警报。

Alert Types and Clearing Alerts  警报类型和清除警报

Quiz
Stateless alerts, such as SNAPSHOT TOO OLD can be found in the dictionary view DBA_OUTSTANDING_ALERTS.

测验

无状态警报,如SNAPSHOT TOO OLD,可以在字典视图DBA_untillet_alerts中找到。 

错误:无状态预警会放在DBA_ALERT_HISTORY中。 阈值(有状态)警报Threshold (stateful) alerts 才放在DBA_OUTSTANDING_ALERTS中

Summary
In this lesson, you should have learned how to:
• Manage the Automatic Workload Repository (AWR)
• Use the Automatic Database Diagnostic Monitor (ADDM)
• Describe and use the advisory framework
• Set alert thresholds
• Use server-generated alerts
• Use automated tasks

摘要

在本课中,您应该学习如何:

•管理自动工作负载存储库(AWR)

•使用自动数据库诊断监视器(ADDM)

•描述和使用咨询框架

•设置警报阈值

•使用服务器生成的警报

•使用自动化任务

Practice: Overview
This practice covers proactively managing your database with ADDM, including:
• Setting up an issue for analysis
• Reviewing your database performance
• Implementing a solution

实践:概述

此实践包括使用ADDM主动管理数据库,包括:

•设置问题进行分析

•检查数据库性能

•实施解决方案

原文地址:https://www.cnblogs.com/cloud7777/p/13215759.html