Script – Top SQL (Buffer Gets)
This script will list the top 5 SQL statements sorted by the most number of buffer gets or logical reads set serverout on size 1000000 declare top5 number; text1 varchar2(4000); x number; len1 number;...
View ArticleScript – Top SQL (Physical Reads)
This script will list the top 5 SQL statements sorted by the most number of physical reads set serverout on size 1000000 set feedback off declare top5 number; text1 varchar2(4000); x number; len1...
View ArticleScript – Latch Contention (top 5 latches)
This script will display the top 5 latches with the most sleeps. Script can be changed to even sort the display on misses instead. set linesize 120 col name format a30 select * from (select name,...
View ArticleScript – Sessions with high physical reads
set linesize 120 col os_user format a10 col username format a15 col pid format 9999999999 PROMPT SESSIONS SORTED BY PHYSICAL READS PROMPT select OSUSER os_user,username, PROCESS pid, ses.SID sid,...
View ArticlePerformance Tuning Tips and Techniques
Checks to be performed at the machine level (note the example is Red Hat Linux specific) run queue should be ideally not more than the number of CPU’s on the machine At the maximum it should never be...
View ArticleExporting and Importing AWR snapshot data
The AWR tables contains a wealth of important performance data which can be very useful in performance tuning trend analysis and also when comparing performance between two seperate periods of time....
View Article11g Optimizer Plan Stabilty using SQL Plan Baselines
In Oracle 11g, we can ensure that the same proven execution plans are used by the Optimizer regardless of any change which can effect the optimizer like a version change, index drop or recreate,...
View Article11g Optimizer Plan Stability
One of the critical aspects of any database upgrade is to ensure optimizer plan stability where tried and tested execution plans are not altered in any way by the Oracle optimizer after a database...
View ArticleUsing the AWR History Tables to compare performance – Part 1
Using the DBA_HIST AWR history tables, we can compare the top wait events between different days or different time periods. Let us assume that we find that batch jobs which are executed at night...
View ArticleUsing the AWR History Tables to compare performance – Part 2
In the Part 1 of this post, we saw how we can use the AWR history tables to compare the top wait events between two different time periods. We will now use the history tables to track and identify...
View ArticleUsing DBMS_XPLAN.DISPLAY_AWR to obtain the EXPLAIN PLAN of a SQL Statement
Very often we run AWR, ASH and ADDM reports which does highlight the Top SQL statements by disk reads, CPU usage and elapsed time. But an important piece of information is missing which is the Explain...
View ArticleSolving a 10g Bind Variable Peeking problem by granting and revoking privileges
The Cost Based optimizer peeks at the values of user-defined bind variables on the first invocation of a cursor. Based on this, the optimizer determines the selectivity of the WHERE clause condition as...
View ArticleUpgrade to 11g and ensure Optimizer Plan Stability using SQL Plan Baselines
One of the major concerns a DBA has related to performing a database upgrade to Oracle 11g is ‘Are Execution Plans Going To Change Post-Upgrade?’ I am quite sure we would have experienced some queries...
View ArticleUsing TUNE_MVIEW and EXPLAIN_REWRITE to enable us to tune MV Fast Refreshes...
We can use the DBMS_MVIEW.EXPLAIN_REWRITE package (which was first introduced in Oracle 9i if memory serves me right) to diagnose why Query redirection to a materialized view is not happening. We can...
View ArticleRestoring Optimizer Statistics
In some cases we may find that gathering fresh statistics has led to the optimizer executing sub-optimal execution plans and we would like to restore the statistics as of a date when we had good...
View ArticleUsing DBMS_ADVANCED_REWRITE with an HINT to change the execution plan
In one of my earlier posts, I had illustrated a use case of DBMS_ADVANCED_REWRITE and its use in cases where we cannot change the code, but can still influence and change the way the optimizer executes...
View ArticleA look at Parsing and Sharing of Cursors
Parsing is the first stage in processing a SQL statement – the other two being Execute and Fetch stages. Parse once – execute many is a very important performance tuning goal. What does parsing involve...
View ArticleCURSOR_SHARING=SIMILAR and FORCE – some examples
The CURSOR_SHARING parameter basically influences the extent to which SQL statements (or cursors) can be shared. The possible values are EXACT which is the default value and SIMILAR and FORCE. The...
View ArticleWhy do my execution plans not change after gathering statistics? – A look at...
In releases prior to Oracle 10g, the gathering of statistics using DBMS_STATS resulted in immediate invalidations of dependent cached cursors. This was true unless NO_INVALIDATE parameter of the...
View ArticleASH and AWR Performance Tuning Scripts
Listed below are some SQL queries which I find particularly useful for performance tuning. These are based on the Active Session History V$ View to get a current perspective of performance and the...
View Article
More Pages to Explore .....