Presentation is loading. Please wait.

Presentation is loading. Please wait.

12 Copyright © 2007, Oracle. All rights reserved. Database Maintenance.

Similar presentations


Presentation on theme: "12 Copyright © 2007, Oracle. All rights reserved. Database Maintenance."— Presentation transcript:

1 12 Copyright © 2007, Oracle. All rights reserved. Database Maintenance

2 Copyright © 2007, Oracle. All rights reserved. 12 - 2 Objectives After completing this lesson, you should be able to: Manage optimizer statistics Manage the Automatic Workload Repository (AWR) Use the Automatic Database Diagnostic Monitor (ADDM) Use advisors and checkers Set alert thresholds Use server-generated alerts Use automated tasks

3 Copyright © 2007, Oracle. All rights reserved. 12 - 3 Database Maintenance Automatic Workload Repository Advisory framework Automated tasks Server alerts Data warehouse of the database Automatic collection of important statistics Direct memory access AutomaticProactive Efficient Automatic Diagnostic Repository Reactive Critical errors

4 Copyright © 2007, Oracle. All rights reserved. 12 - 4 Terminology Automatic Workload Repository (AWR): Infrastructure for data gathering, analysis, and solutions recommendations Baseline: A set of AWR snapshots for performance comparison Metric: Rate of change in a cumulative statistic Statistics: Data collections used for performance monitoring or SQL optimization Threshold: A boundary value against which metric values are compared

5 Copyright © 2007, Oracle. All rights reserved. 12 - 5 Oracle Optimizer: Overview The Oracle optimizer determines the most efficient execution plan and is the most important step in the processing of any SQL statement. The optimizer: Evaluates expressions and conditions Uses object and system statistics Decides how to access the data Decides how to join tables Determines the most efficient path

6 Copyright © 2007, Oracle. All rights reserved. 12 - 6 Optimizer Statistics Optimizer statistics are: A snapshot at a point in time Persistent across instance restarts Collected automatically 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

7 Copyright © 2007, Oracle. All rights reserved. 12 - 7 Using the Manage Optimizer Statistics Page

8 Copyright © 2007, Oracle. All rights reserved. 12 - 8 Gathering Optimizer Statistics Manually

9 Copyright © 2007, Oracle. All rights reserved. 12 - 9 Gathering Optimizer Statistics Manually Full Notes Page

10 Copyright © 2007, Oracle. All rights reserved. 12 - 10 Statistic Levels STATISTICS_LEVEL BASICTYPICALALL Recommended default value Additional statistics for manual SQL diagnostics Self-tuning capabilities disabled

11 Copyright © 2007, Oracle. All rights reserved. 12 - 11 Preferences for Gathering Statistics CASCADE DEGREE ESTIMATE_PERCENT NO_INVALIDATE METHOD_OPT GRANULARITY INCREMENTAL PUBLISH STALE_PERCENT DATABASE LEVEL SCHEMA LEVEL TABLE LEVEL STATEMENT LEVEL GLOBAL LEVEL PREFERENCES SCOPE exec dbms_stats.set_table_prefs('SH','SALES','STALE_PERCENT','13'); DBA DBMS_STATS set | get | delete | export | import Optimizer statistics gathering task

12 Copyright © 2007, Oracle. All rights reserved. 12 - 12 Notes Only

13 Copyright © 2007, Oracle. All rights reserved. 12 - 13 Automatic Workload Repository (AWR) 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 MMON In-memory statistics Snapshots AWR SGA 60 minutes

14 Copyright © 2007, Oracle. All rights reserved. 12 - 14 AWR Infrastructure SGA V$DBA_* ADDM Self-tuning component … Internal clients External clients EMSQL*Plus … Efficient in-memory statistics collection AWR snapshots MMON

15 Copyright © 2007, Oracle. All rights reserved. 12 - 15 Baselines DBMS_WORKLOAD_REPOSITORY.CREATE_BASELINE ( - start_snap_id IN NUMBER, end_snap_id IN NUMBER, baseline_name IN VARCHAR2); Relevant period in the past

16 Copyright © 2007, Oracle. All rights reserved. 12 - 16 Enterprise Manager and the AWR

17 Copyright © 2007, Oracle. All rights reserved. 12 - 17 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)

18 Copyright © 2007, Oracle. All rights reserved. 12 - 18 Automatic Database Diagnostic Monitor (ADDM) Runs after each AWR snapshot Monitors the instance; detects bottlenecks Stores results in the AWR Snapshots ADDM AWR EM ADDM results

19 Copyright © 2007, Oracle. All rights reserved. 12 - 19 ADDM Findings 1 2 3

20 Copyright © 2007, Oracle. All rights reserved. 12 - 20 ADDM Recommendations

21 Copyright © 2007, Oracle. All rights reserved. 12 - 21 Advisory Framework ADDM SQL Tuning Advisor SQL Access Advisor Memory Advisor Space SGA Advisor Segment Advisor Undo Advisor Buffer Cache Advisor Shared Pool Advisor Backup MTTR Advisor Java Pool Advisor Streams Pool Advisor PGA Advisor

22 Copyright © 2007, Oracle. All rights reserved. 12 - 22 Advisors Full Notes Page

23 Copyright © 2007, Oracle. All rights reserved. 12 - 23 Enterprise Manager and Advisors

24 Copyright © 2007, Oracle. All rights reserved. 12 - 24 DBMS_ADVISOR Package Creates a script of all the recommendations that are accepted GET_TASK_SCRIPT Marks one or more recommendations as accepted, rejected, or ignored MARK_RECOMMENDATION Modifies a task parameter SET_TASK_PARAMETER Updates task attributes UPDATE_TASK_ATTRIBUTES Causes a suspended task to resume RESUME_TASK Creates and returns a text report for the specified task GET_TASK_REPORT Suspends a task that is currently executing INTERRUPT_TASK Initiates execution of the task EXECUTE_TASK Deletes a task from the repository DELETE_TASK Creates a new task in the repository CREATE_TASK DescriptionProcedure

25 Copyright © 2007, Oracle. All rights reserved. 12 - 25 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

26 Copyright © 2007, Oracle. All rights reserved. 12 - 26 Automated Maintenance Tasks

27 Copyright © 2007, Oracle. All rights reserved. 12 - 27 Automated Maintenance Tasks Configuration

28 Copyright © 2007, Oracle. All rights reserved. 12 - 28 Server-Generated Alerts Server alerts queue. Metric exceeds threshold. AWR Enterprise Manager Oracle instance

29 Copyright © 2007, Oracle. All rights reserved. 12 - 29 Setting Thresholds

30 Copyright © 2007, Oracle. All rights reserved. 12 - 30 Creating and Testing an Alert 1.Specify a threshold. 2.Create a test case. 3.Check for an alert. 2 1 3

31 Copyright © 2007, Oracle. All rights reserved. 12 - 31 Alerts Notification

32 Copyright © 2007, Oracle. All rights reserved. 12 - 32 Alerts Notification Full Notes Page

33 Copyright © 2007, Oracle. All rights reserved. 12 - 33 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.

34 Copyright © 2007, Oracle. All rights reserved. 12 - 34 Alert Types and Clearing Alerts MMON 85% Warning 97% Critical Cleared Alert Snapshot Too Old Resumable Session Suspended Recovery Area Low On Free Space Metric based Event based Threshold (stateful) alerts Nonthreshold (stateless) alerts DBA_OUTSTANDING_ALERTSDBA_ALERT_HISTORY

35 Copyright © 2007, Oracle. All rights reserved. 12 - 35 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

36 Copyright © 2007, Oracle. All rights reserved. 12 - 36 Practice 12 Overview: Proactive Maintenance This practice covers proactively managing your database with ADDM, including: Setting up an issue for analysis Reviewing your database performance Implementing a solution


Download ppt "12 Copyright © 2007, Oracle. All rights reserved. Database Maintenance."

Similar presentations


Ads by Google