Finding Top SQLs from Package Execution

Package calls are very common. It will be helpful if we can find out the top SQLs from such a call
The following script is written for that purpose. It basically looks into the AWR and pulls all SQLs that were run as part of a package call.

Please note: The script assumes a package procedure here. In order for it to work for a regular procedure, slight modification is necessary
Please also note that the script looks in to all all executions the package procedure for the given period.

The Script

--
-- proc_top_sqls.sql
-- Parameters
--    1. Number of days to look back in AWR
--    2. Package Name
--    3. Package Procedure Name
-- Purpose: To find Top SQLs from a Package Procedure
--
set verify on
set echo on
set lines 250
set head on
set tab off
--set MARKUP HTML ON
 
WITH snaps
     AS (SELECT /*+ materialize*/
               snap_id, dbid
           FROM dba_hist_snapshot
          WHERE begin_interval_time > SYSDATE - &days),
     obj
     AS (SELECT /*+ materialize*/
               object_id, subprogram_id
           FROM DBA_PROCEDURES
          WHERE     object_name = UPPER ('&package_name')
                AND procedure_name = UPPER('&procedure_name'))
  SELECT /*+  push_subq(snp) opt_param('_optimizer_use_feedback' 'false') */
        t.*, ROUND (mins / DECODE (calls, 0, 1, calls) * 60) secs_per_exec
    FROM (  SELECT sql_id, COUNT (DISTINCT sql_exec_id || sql_exec_start) calls, 
                   ROUND ( (COUNT (*) * 10) / 60) mins, 
                   COUNT (DISTINCT SESSION_ID || SESSION_SERIAL#) sessions, 
                   ROUND (SUM ( (COUNT (*) * 10) / 60) OVER ()) tot_mins
              FROM dba_hist_active_sess_history
             WHERE     (PLSQL_ENTRY_OBJECT_ID,PLSQL_ENTRY_SUBPROGRAM_ID) IN (SELECT object_id, subprogram_id FROM obj)
                   AND (dbid, SNAP_ID) IN (SELECT /*+qb_name(snp)*/
                                                 dbid, SNAP_ID FROM snaps)
          GROUP BY sql_id) t
ORDER BY mins DESC
/

CLEAR COLUMNS

A brief explanation of the columns is given below:

SQL_ID  – SQL ID
CALLS – Total executions
MINS – Total time in minutes
SESSIONS – How many sessions were running
TOT_MINS – Total time spent from all sessions
SECS_PER_EXEC – Average elapsed time in seconds for the SQL

Sample Run

Enter value for days: 1
old   5:           WHERE begin_interval_time > SYSDATE - &days),
new   5:           WHERE begin_interval_time > SYSDATE - 1),
Enter value for package_name: BI_MDQ2_AGG_TABLE_LOAD
old  10:           WHERE     object_name = UPPER ('&package_name')
new  10:           WHERE     object_name = UPPER ('DAILY_ETL')
Enter value for procedure_name: BI_LOAD_SASP_AGG_DRIVER_P
old  11:                 AND procedure_name = UPPER('&procedure_name'))
new  11:                 AND procedure_name = UPPER('AGG_PROCESS'))

SQL_ID           CALLS       MINS   SESSIONS   TOT_MINS SECS_PER_EXEC
------------- -------- ---------- ---------- ---------- -------------
mbdzcwbqs4sbf        1        210          1        476         12600
6a0afxyywbxa8      702        118          1        476            10
mtqkuq6ytrmaz        1         44          1        476          2640
b8gajjr1x81cc        1         13          1        476           780
t2pm5y2jf6j5t        1         12          1        476           720
jfyufwx1gkq05       32          8          1        476            15
pfazqhyzsu1ag        1          6          1        476           360
43sf2hhj1xh6g        1          5          1        476           300
wxd02h9c79990        1          5          1        476           300
pcctn7n667938       25          4          1        476            10
dfwjg8uf2j71d        1          4          1        476           240
g8a2qnnzqtp11       25          4          1        476            10
d3dushu2u5wc0        1          4          1        476           240
6d59769nvk43n       16          3          1        476            11
st8gujtcmfx17       18          3          1        476            10
y34chy5jckg7c        9          2          1        476            13
9chrt1tpmgv4c       10          2          1        476            12
ts9uc2fy8fvc3        1          2          1        476           120
96by3cg2yr74h        1          2          1        476           120
22p9p916wqh6b        1          1          1        476            60

Conclusion

It is clear from the output that during the last 24 hours, there was just one session running the procedure and the total time was approximately 476 minutes
and nearly 390 seconds where spent on 5 SQLs. Only one of that SQL was called more than once.
Tuning these 5 statements will help improve the run time.

59 thoughts on “Finding Top SQLs from Package Execution

  1. Advertising your home for cash and flipping houses for profit may be a powerful way to generate income when you look at the housing market, however it requires careful planning and preparation. By using the best strategies, it is possible to raise your likelihood of success and also make a substantial profit. In this article, we’re going to negotiate at length the steps you’ll want to decide to try sell your property for cash fast and flip houses for profit.

    Determine the marketplace worth of your property: Before you market your home for cash, you need to find out its market value. This can provide you with a sense of simply how much you need to sell your house for and certainly will help you create informed decisions through the process. There are many methods to determine the marketplace worth of your house, including hiring an expert appraiser, measuring up your house to similar properties in the region which have sold recently, and using online tools such as for example .

    Price your home correctly: after you have determined the marketplace worth of your house, you need to price it correctly. If you price it too low, you certainly will lose cash, and if you price it too much, it could take a number of years to offer. In order to avoid this, remember to set an aggressive price this is certainly based on the present market environment. It is possible to ask a realtor with regards to their opinion from the best price for your house.

    Make vital remedies and modifications: Before you sell your home for cash, make essential repairs and changes which will increase its value. Give attention to locations that may have the greatest impact, like the kitchen and bathroom. Updating these areas will allow you to sell your home for cash fast, since they are two of the most extremely interesting rooms in your home. Its also wise to ensure that your home is well-maintained and clean. A clear, so-maintained home may well be more attractive to potential customers and can assist you to sell your home for cash fast.

    Present your property: Staging your property might help increase its appeal and then make it more desirable to potential customers. This calls for decluttering, rearranging furniture, additionally introducing accents that help create a warm and inviting atmosphere. A fine-organized back could be a big selling point, so it is worth investing enough time and energy to accomplish it right. You can hire an expert home stager that will help you create an optimal liveable space for potential customers.

    Secure financing: To flip houses for profit, you’ll want to secure financing. There are numerous options available, including traditional loans from banks, hard money loans, and private loans. Pick the option that is most beneficial for your needs along with your financial predicament, and then make certain to have a good plan set up for how you will fund your flipping project.

    Make use of just the right experts: to make sure a successful turning project, it is vital to make use of the proper experts. This can include real estate professionals, contractors, inspectors, then legal professionals. An agent will allow you to find the correct dwelling and show you through the buying and selling undertaking. Building contractors can deal with repairs and reparations, inspectors can gauge the condition associated with property, and lawyers are designed for legal matters. By using the services of the right workers, you can easily guarantee a even and prospering flipping plan.

    If you wish to understand more info on your topic take a look at my excellent online store: we buy any home advert throughout Atlanta GA and Lithonia, StoneCrest Georgia 30058

  2. friends at work have been searching for. The specifics here on the website is beneficial and appreciated and is going to assist My wife and her kids in our studies twice a week. It looks like all of the members here acquired a lot of knowledge concerning this and this page and other categories and info like wise show it. Typically i’m not browsing websites all of the time however when I have a drink im more often than not scouring for this sort of knowledge or things closely having to do with it. When you get a chance, check out at my website: insights to ensure the scientific writing & communication

  3. Hey there I am so delighted I found your site, I really found you by error, while I was researching on Yahoo
    for something else, Regardless I am here now and would just
    like to say thank you for a fantastic post and a all round thrilling blog (I also love the theme/design), I don’t have time to browse it all at
    the minute but I have bookmarked it and also added your RSS
    feeds, so when I have time I will be back to read a great deal more, Please do keep
    up the superb work.

  4. great post, very informative. I wonder why the other specialists of this sector don’t notice this. You must continue your writing. I am sure, you have a great readers’ base already!

  5. Thanx for the effort, keep up the good work Great work, I am going to start a small Blog Engine course work using your site I hope you enjoy blogging with the popular BlogEngine.net.Thethoughts you express are really awesome. Hope you will right some more posts.

  6. Prodentim is the most recent dental health product. It helps to maintain healthy gums by using an ingredient that dentists at ProDentim UK developed.

  7. I’m impressed, I must say. Actually not often do I encounter a blog that’s both educative and entertaining, and let me tell you, you’ve hit the nail on the head. Your idea is outstanding; the issue is something that not enough persons are talking intelligently about. I am very comfortable that I stumbled throughout this in my search for something relating to this.

  8. Hi , I do believe this is an excellent blog. I stumbled upon it on Yahoo , i will come back once again. Money and freedom is the best way to change, may you be rich and help other people.

  9. Its like you learn my thoughts! You seem to understand so much approximately this, such as you wrote the book in it or something. I believe that you can do with some p.c. to force the message house a little bit, however other than that, that is excellent blog. A great read. I’ll certainly be back.

  10. hey there and thank you for your information – I’ve certainly picked up something new from right here.
    I did however expertise some technical issues using this website, since I experienced to reload
    the web site a lot of times previous to I could get it to load correctly.
    I had been wondering if your hosting is OK?
    Not that I am complaining, but sluggish loading instances times will
    very frequently affect your placement in google
    and can damage your high-quality score if ads and marketing with Adwords.
    Well I am adding this RSS to my e-mail and can look out for much more of
    your respective exciting content. Make sure you
    update this again very soon.

  11. Yesterday, while I was at work, my cousin stole my apple ipad and
    tested to see if it can survive a 30 foot drop, just so she can be a youtube sensation.
    My iPad is now broken and she has 83 views. I know this is completely
    off topic but I had to share it with someone!

  12. I’ve been absent for a while, but now I remember why I used to love this blog. Thanks , I’ll try and check back more often. How frequently you update your web site?

  13. Hey there! Do you know if they make any plugins to help with Search Engine Optimization? I’m trying to get my blog to rank for some targeted keywords but I’m not seeing very good gains. If you know of any please share. Kudos!

  14. Howdy I am so delighted I found your blog page, I really found you by error, while I was researching on Bing for something else, Anyhow I am here now and would just like to say thank you for a remarkable post and a all round enjoyable blog (I also love the theme/design), I don’t have time to browse it all at the minute but I have book-marked it and also included your RSS feeds, so when I have time I will be back to read much more, Please do keep up the excellent job.

  15. Hi there, You have done an excellent job. I’ll certainly digg it and personally recommend to my friends. I am confident they’ll be benefited from this site.

  16. When I originally commented I clicked the -Notify me when new comments are added- checkbox and now each time a comment is added I get four emails with the same comment. Is there any way you can remove me from that service? Thanks!

  17. It’s a pity you don’t have a donate button! I’d definitely donate to this brilliant blog! I suppose for now i’ll settle for book-marking and adding your RSS feed to my Google account. I look forward to brand new updates and will share this website with my Facebook group. Talk soon!

  18. I was just looking for this info for some time. After six hours of continuous Googleing, finally I got it in your site. I wonder what’s the lack of Google strategy that don’t rank this type of informative sites in top of the list. Usually the top sites are full of garbage.

  19. I like the helpful info you provide in your articles. I will bookmark your blog and check again here regularly. I am quite sure I’ll learn plenty of new stuff right here! Good luck for the next!

  20. Whats Taking place i am new to this, I stumbled upon this I’ve discovered It positively useful and it has aided me out loads. I’m hoping to give a contribution & help different customers like its aided me. Great job.

  21. Good ?V I should certainly pronounce, impressed with your website. I had no trouble navigating through all the tabs as well as related info ended up being truly simple to do to access. I recently found what I hoped for before you know it at all. Quite unusual. Is likely to appreciate it for those who add forums or something, web site theme . a tones way for your customer to communicate. Excellent task..

  22. I am no longer positive the place you’re getting your info, but great topic. I needs to spend some time studying more or figuring out more. Thank you for excellent info I was looking for this info for my mission.

  23. I don’t even know how I ended up here, but I thought this post was good. I don’t know who you are but certainly you’re going to a famous blogger if you are not already 😉 Cheers!

  24. Hi there, I found your website via Google while looking for a related topic, your website came up, it looks good. I’ve bookmarked it in my google bookmarks.

  25. There are some fascinating closing dates on this article however I don’t know if I see all of them center to heart. There may be some validity but I will take hold opinion until I look into it further. Good article , thanks and we want more! Added to FeedBurner as effectively

  26. Greetings! I know this is kind of off topic but I was wondering if you knew where I could get a captcha plugin for my comment form? I’m using the same blog platform as yours and I’m having trouble finding one? Thanks a lot!

  27. Hello there, simply was aware of your blog through Google, and located that it is really informative. I’m going to watch out for brussels. I’ll appreciate in the event you proceed this in future. A lot of folks will probably be benefited out of your writing. Cheers!

  28. trying to find your way around a Social Security Disability application process may be a disheartening task for many individuals. The method may be compound and time consuming, in addition to likelihood of getting dismissed are raised. That is where a social security disability legal professional is available in. Legal counsel makes it possible to navigate the application form process, increase your likelihood of getting approved, as well as appeal a denied claim. In this specific article, we’re going to go over 5 topics pertaining to the role of a social security disability attorney at law.

    Going through the Social Security Disability application process with the aid of a lawyer
    The social security disability application process may be complicated additionally stressful. A legal professional makes it possible to comprehend the requirements and show you through the procedure. They are able to also help you gather the mandatory health related information and certification to guide your very own claim. They are able to also help out with arranging you for the proceeding, if required.

    The importance of medical facts in a Social Security Disability case
    Medical evidence is vital in a social security disability claim. It really is used to prove that you hold a medical condition that stops you against working. A lawyer makes it possible to obtain the required medical proof and present it in a manner that is most probably to be accepted by the social security organisation. They may be able also help you obtain medical records as well as other documentation that maintain your case.

    Common wrong ideas regarding Social Security Disability and how an attorney can help
    There are numerous myths more than social security disability. For instance, many individuals think that only those people who are permanently disabled are entitled to benefits. Although, this is simply not true. A lawyer makes it possible to comprehend the eligibility requirements and dispel any misconceptions you may possibly have. They can also provide assistance with how exactly to present your case when you look at the most favorable light.

    The appeals process for waived Social Security Disability scenarios and exactly how legal counsel will help
    Should your claim is denied, there is the directly to appeal. A legal professional makes it possible to comprehend the appeals process and portray you through the hearing. They are able to also assist you to gather additional evidence and create a stronger case to boost your odds of success.

    How to pick the best Social Security Disability lawyer or attorney for the case
    You should choose a legal professional who’s got valuable experience handling social security disability matters. Search for a lawyer that is acquainted with the social security administration’s guidelines and procedures. Its also wise to feel comfortable chatting with them and trust their judgment. Search for a legal professional who is able to supply clear and straightforward advice to your questions and offer guidance all through the procedure.

    In summary, a social security disability legal professional can play a vital role into the application and appeals process. They are able to help you navigate the procedure, raise your likelihood of getting authorized, and appeal a refuted claim. A legal professional will help you realize the qualifications criteria and drive off any misconceptions you may possibly have. You need to choose a lawyer who may have experience maneuvering social security disability matters, along with whom you feel at ease communicating.

    if you’d like to uncover more about this unique subject browse the S.S.A. attorney web-site:

      binder and binder disability attorneys in San Elizario, TX

Leave a Reply

Your email address will not be published. Required fields are marked *