Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Less12 Proactive

1,399 views

Published on

  • Thank you. Really it's helpful ,, i wish good things for you..
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Less12 Proactive

  1. 1. Database Maintenance
  2. 2. Objectives <ul><li>After completing this lesson, you should be able to: </li></ul><ul><ul><li>Manage optimizer statistics </li></ul></ul><ul><ul><li>Manage the Automatic Workload Repository (AWR) </li></ul></ul><ul><ul><li>Use the Automatic Database Diagnostic Monitor (ADDM) </li></ul></ul><ul><ul><li>Use advisors and checkers </li></ul></ul><ul><ul><li>Set alert thresholds </li></ul></ul><ul><ul><li>Use server-generated alerts </li></ul></ul><ul><ul><li>Use automated tasks </li></ul></ul>
  3. 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 Automatic Proactive Efficient Automatic Diagnostic Repository Reactive Critical errors
  4. 4. Terminology <ul><ul><li>Automatic Workload Repository (AWR): Infrastructure for data gathering, analysis, and solutions recommendations </li></ul></ul><ul><ul><li>Baseline: A set of AWR snapshots for performance comparison </li></ul></ul><ul><ul><li>Metric: Rate of change in a cumulative statistic </li></ul></ul><ul><ul><li>Statistics: Data collections used for performance monitoring or SQL optimization </li></ul></ul><ul><ul><li>Threshold: A boundary value against which metric values are compared </li></ul></ul>
  5. 5. Oracle Optimizer: Overview <ul><li>The Oracle optimizer determines the most efficient execution plan and is the most important step in the processing of any SQL statement. </li></ul><ul><li>The optimizer: </li></ul><ul><ul><li>Evaluates expressions and conditions </li></ul></ul><ul><ul><li>Uses object and system statistics </li></ul></ul><ul><ul><li>Decides how to access the data </li></ul></ul><ul><ul><li>Decides how to join tables </li></ul></ul><ul><ul><li>Determines the most efficient path </li></ul></ul>
  6. 6. Optimizer Statistics <ul><li>Optimizer statistics are: </li></ul><ul><ul><li>A snapshot at a point in time </li></ul></ul><ul><ul><li>Persistent across instance restarts </li></ul></ul><ul><ul><li>Collected automatically </li></ul></ul>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. 7. Using the Manage Optimizer Statistics Page
  8. 8. Gathering Optimizer Statistics Manually
  9. 9. Gathering Optimizer Statistics Manually Full Notes Page
  10. 10. Statistic Levels STATISTICS_LEVEL BASIC TYPICAL ALL Recommended default value Additional statistics for manual SQL diagnostics Self-tuning capabilities disabled
  11. 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. 12. Notes Only
  13. 13. Automatic Workload Repository (AWR) <ul><ul><li>Built-in repository of performance information </li></ul></ul><ul><ul><li>Snapshots of database metrics taken every 60 minutes and retained for eight days </li></ul></ul><ul><ul><li>Foundation for all self-management functions </li></ul></ul>MMON In-memory statistics Snapshots AWR SGA 60 minutes
  14. 14. AWR Infrastructure SGA V$ DBA_* ADDM Self-tuning component Self-tuning component … Internal clients External clients EM SQL*Plus … Efficient in-memory statistics collection AWR snapshots MMON
  15. 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. 16. Enterprise Manager and the AWR
  17. 17. Managing the AWR <ul><ul><li>Retention period </li></ul></ul><ul><ul><ul><li>Default: Eight days </li></ul></ul></ul><ul><ul><ul><li>Consider storage needs </li></ul></ul></ul><ul><ul><li>Collection interval </li></ul></ul><ul><ul><ul><li>Default: 60 minutes </li></ul></ul></ul><ul><ul><ul><li>Consider storage needs and performance impact </li></ul></ul></ul><ul><ul><li>Collection level </li></ul></ul><ul><ul><ul><li>Basic (disables most ADDM functionality) </li></ul></ul></ul><ul><ul><ul><li>Typical (recommended) </li></ul></ul></ul><ul><ul><ul><li>All (adds additional SQL tuning information to snapshots) </li></ul></ul></ul>
  18. 18. Automatic Database Diagnostic Monitor (ADDM) <ul><ul><li>Runs after each AWR snapshot </li></ul></ul><ul><ul><li>Monitors the instance; detects bottlenecks </li></ul></ul><ul><ul><li>Stores results in the AWR </li></ul></ul>ADDM AWR EM ADDM results Snapshots
  19. 19. ADDM Findings 1 2 3
  20. 20. ADDM Recommendations
  21. 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. 22. Advisors Full Notes Page
  23. 23. Enterprise Manager and Advisors
  24. 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 Description Procedure
  25. 25. Automated Maintenance Tasks <ul><li>Autotask maintenance process: </li></ul><ul><ul><li>Maintenance Window opens. </li></ul></ul><ul><ul><li>Autotask background process schedules jobs. </li></ul></ul><ul><ul><li>Scheduler initiates jobs. </li></ul></ul><ul><ul><li>Resource Manager limits impact of Autotask jobs. </li></ul></ul><ul><li>Default Autotask maintenance jobs: </li></ul><ul><ul><li>Gathering optimizer statistics </li></ul></ul><ul><ul><li>Automatic Segment Advisor </li></ul></ul><ul><ul><li>Automatic SQL Advisor </li></ul></ul>
  26. 26. Automated Maintenance Tasks
  27. 27. Automated Maintenance Tasks Configuration
  28. 28. Server-Generated Alerts Server alerts queue. Metric exceeds threshold. AWR Enterprise Manager Oracle instance
  29. 29. Setting Thresholds
  30. 30. Creating and Testing an Alert <ul><ul><li>Specify a threshold. </li></ul></ul><ul><ul><li>Create a test case. </li></ul></ul><ul><ul><li>Check for an alert. </li></ul></ul>2 1 3
  31. 31. Alerts Notification
  32. 32. Alerts Notification Full Notes Page
  33. 33. Reacting to Alerts <ul><ul><li>If necessary, you should gather more input (for example, by running ADDM or another advisor). </li></ul></ul><ul><ul><li>Investigate critical errors. </li></ul></ul><ul><ul><li>Take corrective measures. </li></ul></ul><ul><ul><li>Acknowledge alerts that are not automatically cleared. </li></ul></ul>
  34. 34. Alert Types and Clearing Alerts MMON 85% Warning 97% Critical Cleared 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_ALERTS DBA_ALERT_HISTORY
  35. 35. Summary <ul><li>In this lesson, you should have learned how to: </li></ul><ul><ul><li>Use statistics </li></ul></ul><ul><ul><li>Manage the Automatic Workload Repository </li></ul></ul><ul><ul><li>Use the Automatic Database Diagnostic Monitor </li></ul></ul><ul><ul><li>Describe the advisory framework </li></ul></ul><ul><ul><li>Set alert thresholds </li></ul></ul><ul><ul><li>Use server-generated alerts </li></ul></ul><ul><ul><li>Use automated tasks </li></ul></ul>
  36. 36. Practice 12 Overview: Proactive Maintenance <ul><li>This practice covers proactively managing your database with ADDM, including: </li></ul><ul><ul><li>Setting up an issue for analysis </li></ul></ul><ul><ul><li>Reviewing your database performance </li></ul></ul><ul><ul><li>Implementing a solution </li></ul></ul>

×