Health Check your Database


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Health Check your Database

  1. 1. Azeem Mohamed Product Marketing Manager Health Check your Database A Performance tuning Methodology with Quest Central
  2. 2. WHAT IS PERFORMANCE TUNING? <ul><li>A combination of identifying and reacting to performance problems </li></ul><ul><ul><li>Proactively preventing such problems from occurring </li></ul></ul><ul><li>Key responsibility for Oracle DBAs </li></ul><ul><ul><li>Ensures that service levels are being met </li></ul></ul><ul><ul><li>Avoids costly hardware upgrades </li></ul></ul>
  3. 3. Why is performance tuning important? <ul><li>‘ At the core of business logic, and at the core of business data for most production applications, is a relational database management system ” </li></ul><ul><ul><li>– Ray Paquet of Gartner, July, 2002 </li></ul></ul><ul><li>No access = no data = no business </li></ul><ul><ul><li>Includes poor performance, missed SLA’s </li></ul></ul>
  4. 4. MAJOR CAUSES OF PROBLEMS <ul><li>Poorly tuned application code: SQL & PL/SQL </li></ul><ul><li>Contention for internal Oracle Resources: locks, latches buffers </li></ul><ul><li>IO bottlenecks </li></ul><ul><li>Inadequate hardware resources </li></ul>Gartner, July 2002
  5. 5. Procrastination? <ul><li>Only when the application and RDBMS is tuned can the possibility of adding hardware be considered </li></ul><ul><ul><ul><ul><li>Don Burleson </li></ul></ul></ul></ul><ul><ul><li>Number one resolution to performance issues in past three years was to upgrade hardware, add memory and add disk. </li></ul></ul><ul><ul><li>Problems still persist! </li></ul></ul>
  6. 6. Health Check - Best Practices? <ul><li>Where are the most common problems past and present? </li></ul><ul><li>How do I resolve those problems? </li></ul><ul><li>How much benefit can I get from fixing the problems identified? </li></ul><ul><li>How much effort is involved in resolution? </li></ul><ul><li>What can I do to prevent future issues? </li></ul>
  7. 7. ‘Tuning Methodology’ Best Practices <ul><li>Identify issues happening now </li></ul><ul><ul><li>Resolve quickly </li></ul></ul><ul><li>Find problems in the past </li></ul><ul><ul><li>Resolve methodically </li></ul></ul><ul><li>How to prevent future occurrences </li></ul><ul><ul><li>Set Goals </li></ul></ul><ul><ul><li>‘What and How to tune’ </li></ul></ul>
  8. 8. Using the Health Check…
  9. 9. Database Tuning—Step by Step <ul><li>Check for resource-intensive SQL </li></ul><ul><li>Check for contention </li></ul><ul><li>Optimise IO </li></ul><ul><li>Apply best practices </li></ul>
  10. 10. Looking for Problem SQL <ul><li>Best place to start is in the V$SQL view – showing all cached SQL statements </li></ul><ul><li>Look for statements that: </li></ul><ul><ul><li>Consume a large proportion of the buffer gets </li></ul></ul><ul><ul><li>Have a relatively high buffer_get/executions ratio </li></ul></ul>
  11. 11. Tuning the SQL <ul><li>Using tkprof or Quest Central SQL tuning, identify operations that have a particularly high rowcount—these steps may be tuning opportunities </li></ul><ul><li>If the rowcount exceeds the number of rows in the table or index you know you have problems </li></ul>
  12. 12. Examining Contention <ul><li>Look at the values in the table “V$SYSTEM_EVENT” </li></ul><ul><li>Eliminate any idle events (SQL*Net waiting for client, etc) </li></ul><ul><li>Calculate the amount of time spent waiting for the remaining events. </li></ul>
  13. 13. Abnormal Events <ul><li>The following events should not contribute significantly to the total wait time: </li></ul><ul><ul><li>Latch free </li></ul></ul><ul><ul><li>Buffer busy </li></ul></ul><ul><ul><li>Free buffer </li></ul></ul><ul><ul><li>Write complete </li></ul></ul><ul><ul><li>Enqueue </li></ul></ul><ul><ul><li>Parse time (from v$sysstat) </li></ul></ul><ul><ul><li>Log switch </li></ul></ul><ul><ul><li>Log buffer </li></ul></ul>
  14. 14. Buffer Busy Waits <ul><li>Most typically occur when a table has too few freelists and is subject to concurrent inserts </li></ul><ul><li>This shows up as “data block” waits in v$sysstat – not “Freelist” waits </li></ul><ul><li>Solution is simply to add more freelists </li></ul>
  15. 15. Free Buffer and Write Complete Waits <ul><li>Free buffer waits occur when a session wants to bring a block from disk into the cache, but has to wait for an unmodified buffer to become available </li></ul><ul><li>Write complete waits occur when a session wants to update a block that is currently in the process of being written to disk </li></ul><ul><li>In both cases, database writer configuration is probably responsible </li></ul>
  16. 16. Configuring Database Writers <ul><li>Only the database writer is allowed to write to database files </li></ul><ul><li>If you have too few database writers, then the DBWR cannot write as fast as user sessions can make changes </li></ul><ul><li>Implement asynchronous IO (preferably) or configure multiple database writers—at least one per disk </li></ul>
  17. 17. Log Switch <ul><li>When a redo log fills, Oracle switches to the next log </li></ul><ul><li>The switch cannot occur if the new log has not yet been archived or checkpointed </li></ul><ul><li>Following best practice for redo log layout can avoid this </li></ul>
  18. 18. Best Practices for Redo Logs <ul><li>Size the redo logs so that log switches do not occur too frequently (5 minutes)? </li></ul><ul><li>Put redo logs on dedicated devices </li></ul><ul><li>Alternate redo logs between two devices (so that while one is being written, the archiver can be reading the other) </li></ul><ul><li>Create enough redo logs so that even if the archiver falls behind during peak processing, users are not affected </li></ul>
  19. 19. Log Buffer waits <ul><li>These occur when a session wants to make a redo log entry, but no space is available in the buffer </li></ul><ul><li>Could be caused by a too-small log buffer, but is usually the result of un-optimised redo layout </li></ul><ul><li>Don’t make the redo buffer too large </li></ul><ul><ul><li>Get waits for same reason </li></ul></ul>
  20. 20. Reduce physical IO <ul><li>After tuning SQL and eliminating contention, the logical IO rate of your database will be nominal </li></ul><ul><li>Try to minimize the percentage of this IO that requires a disk read </li></ul><ul><li>Key techniques are: </li></ul><ul><ul><li>Optimise your buffer cache size </li></ul></ul><ul><ul><li>Deploy keep and recycle pools </li></ul></ul><ul><ul><li>Keep scanned tables as small as possible </li></ul></ul>
  21. 21. Optimise IO <ul><li>Basic principle is to allocate sufficient disks to support your workload and spread IO evenly across these disks </li></ul><ul><li>Typical disk devices can do about 50 IO/second </li></ul><ul><ul><li>If you divide your physical IO rate by 50, you have a first cut estimate of the number of disks you will need </li></ul></ul><ul><li>Your disk devices need to support the IO rate as much as the physical storage requirements </li></ul><ul><ul><li>It’s OK to have sparsely populated disks! </li></ul></ul>
  22. 22. Adopt Best Practices <ul><li>Adopting best practices for database configuration may reduce your current overhead, and also reduce the risk of future performance problems </li></ul><ul><li>The database health check will recommend many of these: </li></ul><ul><ul><li>Using true temporary tables </li></ul></ul><ul><ul><li>Setting appropriate values for sequence caches </li></ul></ul><ul><ul><li>Indexing foreign keys </li></ul></ul>
  23. 23. Introducing…
  24. 24. Quest Central Health Check <ul><li>A free service from Quest in which our consultants use Quest Central Performance management to diagnose the health of your database. </li></ul><ul><li>In this presentation we will show how to do your own database health check. </li></ul>
  25. 25. What does it do? <ul><li>Software collects metrics using PL/SQL packages at a user defined interval </li></ul><ul><li>Stores that information in a repository </li></ul><ul><li>Allows you to run a packaged analysis against any number of those stored collections </li></ul><ul><li>Produces outline of problems, recommendations, solutions, reports, and goals for tuning </li></ul>
  26. 26. How does it work – technically? <ul><li>Begins with a profiling process to understand your specific database environment </li></ul><ul><li>Runs collected stats through a rules engine to produce advice about where to tune and how to tune </li></ul>
  27. 27. Results <ul><li>A series of Reports, both technical and managerial </li></ul><ul><ul><li>Ranking of problems </li></ul></ul><ul><ul><li>Recommendations </li></ul></ul><ul><ul><li>Solutions </li></ul></ul><ul><ul><li>Advice </li></ul></ul><ul><ul><li>Goals </li></ul></ul><ul><ul><li>An Iterative Tuning outline </li></ul></ul>
  28. 28. Quest Central Detect, Diagnose & Resolve Database Application problems
  29. 29. Quest Central™ for Oracle <ul><li>An integrated database management tool that provides all the functionality that Oracle DBAs need to proactively manage their database environments all day, every day </li></ul><ul><ul><li>Database Administration </li></ul></ul><ul><ul><li>Performance Diagnostics (Spotlight® on Oracle) </li></ul></ul><ul><ul><li>SQL Tuning </li></ul></ul><ul><ul><li>Live Space Management </li></ul></ul>
  30. 30. Quest Central™ for Oracle: All THE SOLUTIONS YOU NEED <ul><li>Detect </li></ul><ul><ul><li>Alert notification and reporting </li></ul></ul><ul><li>Diagnose </li></ul><ul><ul><li>Alert drill-downs </li></ul></ul><ul><ul><li>Advice </li></ul></ul><ul><ul><li>Analysis </li></ul></ul><ul><li>Resolve </li></ul><ul><ul><li>SQL Tuning </li></ul></ul><ul><ul><li>Live Space Management </li></ul></ul><ul><ul><li>Database Administration </li></ul></ul>
  31. 31. SUMMARY – Quest Central <ul><li>Improves productivity </li></ul><ul><ul><li>Single console solution for Oracle and DB2 database environments </li></ul></ul><ul><ul><li>Cross train staff for heterogeneous application support </li></ul></ul><ul><li>Speeds application response time </li></ul><ul><ul><li>Detect, Diagnose and resolve issues seamlessly from a single console </li></ul></ul><ul><li>Heightens availability </li></ul><ul><ul><li>Proactive management of performance related issues </li></ul></ul><ul><ul><li>Resolve issues without users knowing there was an issue </li></ul></ul>
  32. 32. THANK YOU FOR LISTENING Azeem Mohamed Product Marketing Manager Register for a Free Database Health Check