Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5949723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:17:26+00:00 2026-05-22T17:17:26+00:00

I want to know total how many queries got executed with its count and

  • 0

I want to know total how many queries got executed with its count and execution time for my Java program (I dont have the source code).

I am planning to write PL/SQL which joins gv$session and gv$sql, logging output to one of the table. After program execution ends I will query the table to get more details.

But I wanted to know whether Oracle has any default utility to get similar report already? I was looking at AWR reporting for Oracle but didn’t get easy documentation for the same.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T17:17:27+00:00Added an answer on May 22, 2026 at 5:17 pm

    I’d go with

    DBMS_SESSION.SESSION_TRACE_ENABLE (waits => true);
    

    On the database server you will get a file generated (in the directory indicated by user_dump_dest in v$parameter) that will contain a trace.

    Run that trace through the tkprof utility (database utility on the DB server) and it will give you all the SQLs, how many times they were executed, how long they spent executed and a breakdown of what that time was spent on.

    The drawback of v$sql (or gv$sql for RAC) is that (1) some queries might be aged out, especially for a long running process and (2) potential ‘interference’ from other sessions if you don’t haev exclusive access to the DB.

    If you don’t want to get into messaing around with files, from v$session you can also drill down to v$sessstat and v$session_event which can offer some useful tidbits.

    select event, sum(round(time_waited/(100*60),2)) time_mins, wait_class
    from v$session_event
    where sid in (221)
    group by event, wait_class
    order by 2 desc;
    
    select sid, name, value from v$sesstat s 
      join v$statname n on n.statistic# = s.statistic#
    where s.sid in (221)
    and name in ('consistent gets','sorts (rows)','execute count',
            'parse count (total)','user calls','user commits','user rollbacks'
    order by value desc;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a total newbie and want to start with php. I know some javascript
I have read many article about this one. I want to hear from you.
I want to know how many users are connected to the IIS web server
Given 2 file revisions I want to know how many lines were added/modified/deleted. I
I want to know how to design invoice table. An invoice include many orders
I just want to know how to total formatted strings like $ 100,000.00 Ive
I want to know how many milliseconds a PHP for-loop takes to execute. I
I want the program to check how many large boxes are needed, then use
I am working with Northwind Data Base(Microsoft Example) and i want to know total
I often want just the total count(or other aggregate) of a selection, typically when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.