Using DBMS_XPLAN.DISPLAY_CURSOR to examine Execution Plans

In last week’s post I described how to use SQL Monitor to determine what is happening during the execution of long running SQL statements. Shortly after the post went up, I got some requests on both social media and via the blog comments asking, “If it is possible to get the same information from a traditional text based execution plan, as not everyone has access to SQL Monitor?”.

The answer is yes, it is possible to see a lot of the information showed in SQL Monitor by viewing the execution plan via the DBMS_XPLAN.DISPLAY_CURSOR function. In order to call this function you will need SELECT or READ privilege on the fixed views V$SQL_PLAN_STATISTICS_ALL, V$SQL and V$SQL_PLAN, otherwise you’ll get an error message.

The DBMS_XPLAN.DISPLAY_CURSOR function takes three parameters:

  1. SQL ID – default null, means the last SQL statement executed in this session
  2. CURSOR_CHILD_NO – default 0
  3. FORMAT – Controls the level of details that will be displayed in the execution plan, default TYPICAL.

The video below demonstrates how you can use the FORMAT parameter within the DBMS_XPLAN.DISPLAY_CURSOR function to show you information about a what’s happened during an execution plan including the bind variable values used, the actual number of rows returned by each step, and how much time was spent on each step.

Under the video you will find all of the commands used, so you can cut and paste them easily.

How do I see the actual number of rows and elapse time for each step in the plan?

Continue reading

Posted in Optimizer, Syntax | Tagged , , , | 6 Comments

Getting the most out of Oracle SQL Monitor

I’m often asked what is the best tool for viewing execution plans and for me the answer is always SQL Monitor (included in the Oracle Tuning Pack). It really is the most invaluable tool if you need to determine what is happening during the execution of any long running SQL statements.

In order to help you get the very most out of using SQL Monitor, I wanted to share with you some of the tips and tricks I‘ve learnt over the years from the original Database Manageability team, especially Cecilia Grant!

So, why do I love it so much?

There are so many reasons to love SQL Monitor; it’s hard for me to know where to begin. So, instead of giving you an exhaustive list I’ve put together a short video to demonstrate how I use SQL Monitor (be sure to set your resolution to 720p).

How do I control what statements are monitored?

Continue reading

Posted in Optimizer | Tagged , , , , | 3 Comments

Overriding DBMS_STATS Parameter Settings

Since it’s introduction in Oracle Database 8i, the DBMS_STATS package is Oracle’s preferred method for gathering statistics. With each new database release the DBMS_STATS package is extended to accommodate new approaches to gather statistics and new types of statistics.

Over the years, application developers and DBAs have written hundreds of scripts using the DBMS_STATS package to help gather and manage optimizer statistics effectively. However, once written these scripts are rarely modified to take advantage of the improvements in the DBMS_STATS package, which can result in suboptimal statistics.

Oracle Database 12 Release 2 makes it a lot easier to be able to manage this vast collection of scripts by includes a new DBMS_STATS preference called PREFERENCE_OVERRIDES_PARAMETER. When this preference is set to TRUE, it allows preference settings to override the parameter values specifically set in a DBMS_STATS command.

Continue reading

Posted in New Features, Optimizer, Oracle Database 12c New Features | Tagged , , | Leave a comment

Oracle Database 12c and DevOps

Over the last month or so I’ve been on the road presenting at different user group conferences and meeting with customers. I’ve gotten a number of requests via blog comments to share the slides for the sessions I presented.

One of the most requested sessions is actually one I delivered, as a joint session with @GeraldVenzl, called Oracle Database 12c and DevOps.

In this session Gerald takes on the role of the lead developer on a project to deploy a RESTful web-based application, while I play the role of the DBA. Through the course of the session, we learn to work together to find a solution that will allow our (fictitious) company  to embrace a more agile development approach, as well as the latest technology trends without exposing the business to painful availability or security vulnerabilities.

Although the slides don’t do our witty repartee justice , hopefully they will inspire you to try out some of the technologies we describe in the session!

Below is the other session that I got a lot of requests for was the keynote session I gave at this year’s Georgia Oracle Users Group Tech Days 2017 , “What to expect from Oracle Database 12c”.

Posted in Docker, Multitenant, New Features, Oracle Database 12c New Features | Tagged , , , , , | Leave a comment

40 years of Database innovations

June 16th 2017 marks the 40th anniversary of the founding of Oracle, which actually began life as Software Development Laboratories.

Larry Ellison, Bob Miner, and Ed Oates set out to build the worlds best relational database and what an amazing 40 years of Database innovations it has been. From availability to security, Oracle Database has got you covered and we have only just begun!

To mark this great occasion, we’ve put together a short video highlighting all of the amazing features and functionality that has been added to the database over the last 40 years.

Feel free to leave you birthday wishes or comments for the Oracle Database Engineering Team in the comments section below.

Posted in Events | Tagged , | Leave a comment

Upcoming Events

The month of June is shaping up to be jam packed with great Oracle conference all across the global and I’m fortunate enough to have the opportunity participate in 3 of them  and hope to catch up with a lot of folks in person.

So where can you find me?

Oracle Gebruikersclub Holland Tech Experience 2017
On June 15th and 16th some of the best and brightest members of the Oracle community in the Netherlands will gather for a two day conference that will include sessions on the Oracle Database, SQL, Fusion Middleware and much more. I’m fortunate enough to be delivering 3 sessions at this event:

Continue reading

Posted in Events | Tagged | 2 Comments

Oracle Database Audio White Papers

Back in April, I shared with you a new white paper that described a set of best practices or management techniques to facilitate IoT workloads with the Oracle Database. Since then there have been a number of updates in this space that I thought were worthy of a follow up post.

Just in case you haven’t found the time to read the white paper yet, don’t panic because you can now listen to it! Continue reading

Posted in IoT, technical_papers, Whitepapers | Tagged , | Leave a comment

Extremely useful Partitioning enhancements in Oracle Database 12c

Back in January, I promised I would write a series of blogs on some of my favorite new 12c enhancements, designed to make your life easier. I’m finally getting around to keeping that promise with this weeks blog post on my favorite partitioning enhancements.

Imagine you have a large SALES table that contains information on all of the sales we have had in our chain of department stores.

DESC sales
 Name	          NULL?    TYPE
 ----------     -------- ------------------------
 PROD_ID        NOT NULL NUMBER(6)
 CUST_ID        NOT NULL NUMBER
 TIME_ID        NOT NULL DATE
 CHANNEL_ID     NOT NULL CHAR(1)
 PROMO_ID	NOT NULL NUMBER(6)
 QUANTITY_SOLD	NOT NULL NUMBER(3)
 AMOUNT_SOLD	NOT NULL NUMBER(10,2)
 REGION 	NOT NULL CHAR(3)

There are also 4 indexes on our SALES table to help with our analytic queries.

Continue reading

Posted in Oracle Database 12c New Features, Partititoning, Syntax | Tagged , | 2 Comments

Optimizer Histograms

At the recent OUG Ireland conference I had the privilege of participating in a panel discussion on the Oracle Database. During the course of the session the topic of Optimizer histograms came up. As always, a heated discussion ensued among the members of the panel, as we each had very different views on the subject.

Why so many different opinions when it comes to histograms?

The problem arises from the fact that some folks have been burnt by histograms in the past. In Oracle Database 9i and 10g, histograms in combination with bind-peeking lead to some unpredictable performance problems, which is explained in detail in this post on the  Optimizer blog.  This has resulted in a number of folks becoming histogram shy. In fact, I reckon if you were to put 3 Oracle experts on a panel, you would get at least 5 different opinions on when and how you should gather histograms!

So I thought it would be a good idea to explain some of the common misconceptions that surround histograms and the impact of adopting them.

This is a long post, so you might want to grab a coffee before you get into it!

Continue reading

Posted in Optimizer, Statistics, Syntax | Tagged , , | 9 Comments

Upcoming Event: Georgia Oracle Users Group Tech Days 2017

I’m delighted to have been given an opportunity to deliver the keynote session  at this year’s Georgia Oracle Users Group Tech Days 2017.

The conference takes place on  May 9-10, 2017, at the Loudermilk Conference Center in Atlanta, Georgia and is shaping up to be two great days of technical sessions delivered by some of  the best Oracle speakers I know.

Continue reading

Posted in Events, Oracle Database 12c New Features | Tagged , | Leave a comment