Posts Tagged 11g

Real Time SQL Monitoring, A Goodie Of 11g….

Oracle’s newest database release 11g is having lots of goodies stored in it. Since now even the release 2 of it, (11.2.0.1) is also out, the number of goodies has just gone more higher! There are some things which are really very nice and are worth checking at least for once. This post is just about one of those goodies. The idea of this post is not about a new invention but about the introduction a worth-to-know kind of feature introduced with the Oracle 11g. Interested, okay keep on reading then :-) .

Its always asked by the people who are involved in the query tuning that there should be something which should tell them the current statistics of the query, right at that time when the query is actually running! This kind of monitoring, if available, can help a lot in finding out that out of all the access paths, which one is taking more time  in addition to the time spent in the execution of various steps of the query. Also, there is one question which I am asked all the time that from where the query execution starts in the execution plan? The answer of that can be given looking at the execution plan though but if there can be something which can show us the same when the query is still “alive”, I guess that information can help in both understanding the execution pathway of the query and also can come handy in the troubleshooting part. I am not sure that is there is some tool which can do this kind of task ( if you know, please do post the name of it in the comments) but I believe, there is nothing which I should be worried about now since from 11g release 1, Oracle has given a solution for this with the Real Time SQL Monitoring!

Real-time sql monitoring does exactly what it says, it monitors a query when its actually running. The monitoring information gives a wide information about the query state that whether its over and some more general information about the query. It also brings out the information of the execution plan of the query and the statistics like that how much time is spent by each access path in the plan, also including the cost incurred at that step. This also shows with a nice arrow (->) marker that which step is executing at the moment when the query is still actually running!

Real time monitoring is enabled through the parameter CONTROL_MANAGEMENT_PACK_ACCESS which should be set to the value DIAGNOSTIC+TUNING( default) . In addition to it, the parameter STATISTICS_LEVEL is set to either ALL or TYPICAL(default) . If oracle finds out that the there is delay of more than 5 seconds happening for the query, it can monitor that query. The monitoring information is stored in two new views V$SQL_MONITOR and V$SQL_PLAN_MONITOR. V$SQL_MONITOR view would get populated when the monitoring of the query would start.

The monitoring is recorded through the package DBMS_SQLTUNE’s function, REPORT_SQL_MONITOR which does offer couple of switches that can help in getting the desired output needed to troubleshoot the query’s performance issues. The description of the entire number of options offered by the function is in the link given already. Let’s try to use this function to monitor a simple query. For this purpose, we would be using two sessions where one would be running the query which we want to monitor and the other would be executing the function which would capture the query’s information. First, we prepare the session that is supposed to monitor the running query,

Session-1>>

SQL> set long 10000000
SQL> set longchunksize 10000000
SQL> set linesize 200
SQL> select dbms_sqltune.report_sql_monitor from dual;

 

Now, we shall write a very simple query in the session 2 of ours which we would execute and than monitor it from the first session.

Session-2>>

SQL@AMAN>select count(*) from test;

  COUNT(*)
———-
   1101904

 

Since the query result set is not that much large, the query gets complete in a very less time but still it did take long enough so that Oracle could monitor it. After the query’s execution got over, this is what was reported for it through the monitoring.

Session-1>>

SQL@SYS>select dbms_sqltune.report_sql_monitor from dual;

REPORT_SQL_MONITOR
———————————————————————————————————————————-
———————————————————————-
SQL Monitoring Report

SQL Text
———————————————————————————————————————————-
————————————————-
select count(*) from test
———————————————————————————————————————————-
————————————————-

Global Information
Status              :  DONE (ALL ROWS)
Instance ID         :  1
Session ID          :  131
SQL ID              :  7b2twsn8vgfsc
SQL Execution ID    :  16777216
Plan Hash Value     :  1950795681
Execution Started   :  03/04/2010 23:03:28
First Refresh Time  :  03/04/2010 23:03:31
Last Refresh Time   :  03/04/2010 23:03:35

——————————————————————–
| Elapsed |   Cpu   |    IO    |  Other   | Fetch | Buffer | Reads |
| Time(s) | Time(s) | Waits(s) | Waits(s) | Calls |  Gets  |       |
——————————————————————–
|    6.56 |    0.13 |     6.38 |     0.06 |     1 |  23976 | 16112 |
——————————————————————–

SQL Plan Monitoring Details

| Id |      Operation       | Name |  Rows   | Cost |   Time    | Start  | Starts |   Rows   | Activity  |   Activity Detail    |
|    |                      |      | (Estim) |      | Active(s) | Active |        | (Actual) | (percent) |      (sample #)      |
================================================================|  0 | SELECT STATEMENT     |      |         | 4655 |         1 |     +7 |      1 |        1 |        |                 |
|  1 |   SORT AGGREGATE     |      |       1 |      |         1 |     +7 |      1 |        1 |        |                 |
|  2 |    TABLE ACCESS FULL | TEST |   1097K | 4655 |         6 |     +2 |      1 |    1102K |    100.00 | direct path read (6) |
==================================================================

We can see that a lot of information is captured through the monitoring for us! The sections which presents the interesting outputs are Activity(percent) and Activity Detail(sample#) . The Acitivity percent shows that in terms of DB time, how much time was spent by each access path of the query and the Activity Details shows the detailed information about that activity. For our case, the biggest (and the only active) activity was table access full and this did happen through the Direct Path Read! Furthermore, you can even control the monitoring through two hints as well, MONITOR and NO_MONITOR! And last but certainly not the least, the real time monitoring is also a part of EM which means all of this can be done through nice and shiny colorful EM screens as well. Now that’s cool!

I believe that its a really useful feature! Once again, the idea of this post was not post something “internal” but just to bring this feature in front of you. If you already knew about it, cool, feel free to add more information about this feature over here via the comments. If you didn’t know about it before, well, now you know so enjoy it to the fullest :-D . Oh and BTW, you can read about this feature in detail from here.

, ,

2 Comments

11g New Features Exam, A Roadmap….

I am always in the favour of certifications. The reason for this is that  certifications give one a confidence, a trust that he/she has done somethign good, some thing which really does prove that he/she is serious enough to be current with the ever changing technology. I don’t think that we should take the certification as a way to show that we are more superior than those who don’t have it or don’t like it. All have  different opinions about things and at some point or the other, all are correct. I take certifications for my own satisfaction and that’s the main reason, I don’t post any logos or mention which certifications I hold. 

11g is the most latest offering from the Oracle corp for its flagship product, database.  As the version 11g is around from some time now, the certification track of it also is out. At the moment, the Oracle Certified Associate(OCA) track of the fresh OCP is out. The next level, OCP of 11g is yet to be out. But the exam for the already certified professionals , for example, 10g is already out with the exam code, 11g New Features for DBAs(1z0-050) is already out. This post is basically is a collection of the references that I did use when I was preparing for it. I found the exam quite exhaustive so I guess, if this post can help someone , he/she atleast won’t be feeling the same exhaustiveness.

The exam contents are mentioned here For the starting of the preparation, there is a must requirement for the material. The best material is from Oracle University only as OU offers official course for the topic. But , some may not be able to avail the course due to various constraints. I must mention that its not a must for the already certified people to attend a course for the exam as the Hands-on-Course requirement(HOC) is only for the fresh candidates. In case, you are not able to attend the course from OU, still the exam preparation can be done from these following books, 

http://www.amazon.ca/OCP-Oracle-Database-11g-Administrators/dp/0071496823″> OCP-11g New Features, Sam Alapati

http://www.amazon.ca/Expert-Oracle-Database-11g-Administration/dp/143021015X”>Expert Oracle Administration 11g, Sam Alapati

These two books cover almost all the topics which are both for the exam and for the actual working environments. Combining this with the official docs from oracle at http://tahiti.oracle.com wil be enough to cover the topics of the exam.

The exam is focussed essentially about the new features which are offered in 11g. Surely enough, if you are well verse with the 10g , you will find some link between the 11g features with them. Though, this is not true for all the new features , for example, Real Application Testing but having a good knowledge about 10g will surely help. 

For the practical demos, I used, Tim Hall’s articles and Oracle by Example series very heavily. Here is the link for both, 

http://www.oracle-base.com/articles/11g/Articles11g.php#ocp

http://www.oracle.com/technology/obe/11gr1_db/index.htm

I would really suggest to use Tim’s articles as using them will give you an immediate idea about how things look in action.  I won’t say that the same is not true for the OBE series, but it is not solely mentioned for the exam, so you may find some things in the articles which you won’t need atleast while just starting. But combining both, will be a good mix to start with the practical hands-on. 

In addition to the above mentioned sources, Arup Nanda’s , Top Features of 11g  series is also a must read for those who are looking for a quick know-how about the features. I used it very heavily for my preparation as the language used is very simple and Arup’s style to present the topic in the form of an actual business problem makes it easier to understand and also with that note, its easy to remember the topic as well. The series is also having good demos of all the mentioned features which again is a big help when you yourself don’t know how to make a demo/presentation. 

For some topics, I had to look around for that “little extra” as I was not very clear how to go for them. So in that process, I used various links. Here are those links which I used. In case , you also will get struck at the same point, I hope these links will help you.

Partioning in 11g

http://www.orafaq.com/node/1912

http://www.rittmanmead.com/2008/09/13/investigating-oracle-11g-interval-partitioning/

http://asanga-pradeep.blogspot.com/2008/08/11g-partitioning-enhancements.html

Automatic Memory Management in 11g

http://kevinclosson.wordpress.com/2007/08/23/oracle11g-automatic-memory-management-and-linux-hugepages-support/ 

http://blog.tanelpoder.com/2007/08/21/oracle-11g-internals-part-1-automatic-memory-management/

So that’s all about the technical stuff I guess. Now, the last but certainly not the least part, find someone who can prepare it with you. I got lucky and had my friend Neeraj working with me for the same exam. It helped a lot to prepare as like a team as I like to discuss, share the stuff. When I discuss something, it sticks in my mind with all the essentials of it and also, if there are any doubts , they get cleared as well. So, besides the technical topics and their know-hows, try finding someone who is going to study for the same. I can gurantee that you will find the preparation much easier. 

So that’s all! Hope you get some help from this not-so-technical post for your exam preparation and clear with flying colors. Good luck!

, ,

6 Comments