Proactive Maintenance

Copyright © 2005, Oracle. All rights reserved.

Objectives

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

Copyright © 2005, Oracle. All rights reserved.

Proactive Maintenance
Automatic Automated tasks Proactive

Server alerts

Advisory framework

Automatic Workload Repository

Efficient

Data warehouse of the database

Automatic collection of important statistics
Copyright © 2005, Oracle. All rights reserved.

Direct memory access

Introducing Terminology

• • •

Automatic Workload Repository (AWR): Infrastructure for data gathering, analysis, and solutions recommendations Baseline: Data gathered of a “normal running database” for performance comparison Metric: Rate of change in a cumulative statistic Statistics: Data collections used for optimizing internal operations, such as execution of a SQL statement Threshold: A boundary value against which metric values are compared

Copyright © 2005, Oracle. All rights reserved.

Optimizer Statistics
Optimizer statistics are: • Not real time • Persistent across instance restarts • Collected automatically

> Statistics AWR ADDM Advisors Alerts AutoTasks

SQL> SELECT COUNT(*) FROM hr.employees; COUNT(*) ---------214 SQL> SELECT num_rows FROM dba_tables 2 WHERE owner='HR' AND table_name = 'EMPLOYEES'; NUM_ROWS ---------107

Copyright © 2005, Oracle. All rights reserved.

Using the Manage Optimizer Statistics Page

Copyright © 2005, Oracle. All rights reserved.

Statistic Levels

STATISTICS_LEVEL

BASIC

TYPICAL

ALL

Self-tuning capabilities disabled

Recommended default value

Additional statistics for manual SQL diagnostics

Copyright © 2005, Oracle. All rights reserved.

Automatic Workload Repository (AWR)
• • • Built-in repository of performance information Snapshots of database metrics taken every 60 minutes and retained for 7 days Foundation for all self-management functions
In-memory statistics
SGA

Statistics > AWR . ADDM Advisors Alerts AutoTasks

60 minutes MMON
Snapshots

AWR

Copyright © 2005, Oracle. All rights reserved.

AWR Infrastructure
External clients EM SQL*Plus …

SGA Efficient in-memory statistics collection V$ DBA_* AWR snapshots

MMON

Internal clients

ADDM

Self-tuning … Self-tuning component component

Copyright © 2005, Oracle. All rights reserved.

AWR Snapshot Sets
Relevant period in the past

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

Copyright © 2005, Oracle. All rights reserved.

Enterprise Manager and AWR

Copyright © 2005, Oracle. All rights reserved.

Managing the AWR

Retention period
– The default is 7 days – Consider storage needs

Collection interval
– The default is 60 minutes – Consider storage needs and performance impact

Collection level
– Basic (disables most of ADDM functionality) – Typical (recommended) – All (adds additional SQL tuning information to snapshots)
Copyright © 2005, Oracle. All rights reserved.

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

Statistics AWR . > ADDM Advisors Alerts AutoTasks

Snapshots

EM

ADDM ADDM results AWR

Copyright © 2005, Oracle. All rights reserved.

ADDM Findings

1

2

3

Copyright © 2005, Oracle. All rights reserved.

ADDM Recommendations

Copyright © 2005, Oracle. All rights reserved.

Advisory Framework

Statistics AWR ADDM > Advisors Alerts AutoTasks

SQL Tuning Advisor Memory ADDM

PGA

PGA Advisor Buffer Cache Advisor

SGA SQL Access Advisor Library Cache Advisor Segment Advisor Space Undo Advisor Backup
Copyright © 2005, Oracle. All rights reserved.

MTTR Advisor

Enterprise Manager and Advisors

Copyright © 2005, Oracle. All rights reserved.

The DBMS_ADVISOR Package
Procedure
CREATE_TASK DELETE_TASK EXECUTE_TASK INTERRUPT_TASK GET_TASK_REPORT RESUME_TASK SET_TASK_PARAMETER MARK_RECOMMENDATION GET_TASK_SCRIPT

Description
Creates a new task in the repository Deletes a task from the repository Initiates execution of the task Suspends a task that is currently executing Creates and returns a text report for the specified task Causes a suspended task to resume

UPDATE_TASK_ATTRIBUTES Updates task attributes
Modifies a task parameter Marks one or more recommendations as accepted, rejected, or ignored Creates a script of all the recommendations that are accepted

Copyright © 2005, Oracle. All rights reserved.

Server-Generated Alerts

Statistics AWR ADDM Advisors > Alerts AutoTasks

Enterprise Manager

Oracle instance Metric exceeds threshold.

Server alerts queue.

AWR

Copyright © 2005, Oracle. All rights reserved.

Default Server-Generated Alerts
97% Critical 85% Warning
Tablespace

Database Control: SYSTEM metrics

Tablespace Space Usage

Resumable Session Suspended

Recovery Area Low On Free Space

Snapshot Too Old

Copyright © 2005, Oracle. All rights reserved.

Setting Thresholds

Copyright © 2005, Oracle. All rights reserved.

Creating and Testing an Alert

1. Specify a threshold. 2. Create a test case. 3. Check for an alert.
1 2

3

Copyright © 2005, Oracle. All rights reserved.

Alerts Notification

Copyright © 2005, Oracle. All rights reserved.

Reacting to Alerts

• • •

If needed, gather more input, for example, by running ADDM or another advisor. Take corrective measures. Acknowledge alerts, which are not automatically cleared.

Copyright © 2005, Oracle. All rights reserved.

Alert Types and Clearing Alerts
Metric based Threshold (stateful) alerts 97% Critical 85% Warning
Cleared Cleared

MMON

DBA_OUTSTANDING_ALERTS Snapshot Too Old Resumable Session Suspended

DBA_ALERT_HISTORY Recovery Area Low On Free Space

Nonthreshold (stateless) alerts

Alert

Event based

Copyright © 2005, Oracle. All rights reserved.

Automated Maintenance Tasks

Statistics . AWR ADDM Advisors Alerts > AutoTasks

Scheduler initiates jobs Jobs run in the default maintenance window • Limit maintenance impact on normal operation by using Resource Manager Examples of maintenance: • Gathering optimizer statistics • Gathering segment information • Backing up database

• •

Copyright © 2005, Oracle. All rights reserved.

Summary

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

Copyright © 2005, Oracle. All rights reserved.

Practice Overview: Proactive Maintenance
This practice covers the following topics: • Proactively managing your database by using ADDM
– Setting up an issue for analysis – Reviewing your database performance – Implementing a solution

Copyright © 2005, Oracle. All rights reserved.

Sign up to vote on this title
UsefulNot useful