

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to display a SQL execution progress along with execution plan in Oracle?
Problem:
You want to view where Oracle SQL is taking time within a SQL execution plan.
Solution
With Oracle 11g version, we can view SQL execution plan progress while the SQL is running. The “V$SQL_PLAN_MONITOR” view contains a row for each step of a SQL statement’s execution plan. Below SQL will help to view the execution plan along with the progress.
The “V$SQL_PLAN_MONITOR" provides you with information on the steps that are using the most resources. The statistics in "V$SQL_PLAN_MONITOR” are updated every second.
We can also generate a real time text, HTML, or even a XML report of query progress within an execution plan by using the REPORT_SQL_MONITOR function of the DBMS_SQLTUNE package.
Example
select a.sid ,a.status ,to_char(a.sql_exec_start,'yymmdd hh24:mi') start_time ,a.plan_line_id ,a.plan_operation ,a.plan_options ,a.output_rows ,a.workarea_mem mem_bytes ,a.workarea_tempseg temp_bytes from v$sql_plan_monitor a ,v$sql_monitor b where a.status NOT LIKE '%DONE%' and a.key = b.key order by a.sid, a.sql_exec_start, a.plan_line_id;
To generate a HTML report.
Example
SET LINES 3000 PAGES 0 LONG 1000000 TRIMSPOOL ON SPOOL report.html select dbms_sqltune.report_sql_monitor(session_id=> 901, event_detail => 'YES' ,report_level => 'ALL' ,type => 'HTML' ) from dual; SPOOL OFF;
- Related Questions & Answers
- How to monitor real time SQL execution statistics in Oracle?
- How to validate the syntax of a Oracle dynamic SQL before execution ?
- How to gather extended query execution stats in Oracle?
- Execution time while running a SQL query in HANA Studio
- How to stop the execution of a function with JavaScript?
- PHP Execution Operator
- How to find PHP execution time?
- Program execution in CPU
- Implementation of a table level locks in a COBOL-DB2 program during SQL execution
- How to achieve parallel execution in TestNG?
- Execution of printf with ++ operators in C
- How to trigger headless test execution in Selenium with Python?
- How to exclude a test from execution in Pytest?
- Android AsyncTasks Parallel Execution
- How to perform parameterization in execution in TestNG?