Monitor a sql execution which lasted only for few seconds or even less... report the execution using dbms_sqltune
1) introduce the hint MONITOR in the desired sql, such that how short the execution time, the sql execution is monitored.
insert /*+ MONITOR */ into T1
select * from T1@to_r1;
2) use the dbms_sqltune to report the monitored sql.
SELECT DBMS_SQLTUNE.report_sql_monitor(sql_id=>'bfjf7tz62t1p5',type=>'TEXT',report_level => 'ALL')
from dual;
SQL Monitoring Report
SQL Text
------------------------------
insert /*+ MONITOR */ into T1 select * from T1@to_r1
Global Information
------------------------------
Status : DONE
Instance ID : 1
Session : SYSTEM (268:1203)
SQL ID : bfjf7tz62t1p5
SQL Execution ID : 16777216
Execution Started : 12/02/2018 21:48:34
First Refresh Time : 12/02/2018 21:48:34
Last Refresh Time : 12/02/2018 21:48:37
Duration : 3s
Module/Action : SQL*Plus/-
Service : pdb2
Program : sqlplus@db12c.oracle.com (TNS V1-V3)
Global Stats
===================================================================================
| Elapsed | Cpu | IO | Other | Buffer | Read | Read | Write | Write |
| Time(s) | Time(s) | Waits(s) | Waits(s) | Gets | Reqs | Bytes | Reqs | Bytes |
===================================================================================
| 3.10 | 1.20 | 0.02 | 1.88 | 20794 | 22 | 336KB | 18 | 10MB |
===================================================================================
SQL Plan Monitoring Details (Plan Hash Value=1788691278)
==============================================================================================================================================
| Id | Operation | Name | Rows | Cost | Time | Start | Execs | Rows | Activity | Activity Detail |
| | | | (Estim) | | Active(s) | Active | | (Actual) | (%) | (# samples) |
==============================================================================================================================================
| 0 | INSERT STATEMENT | | | | 2 | +2 | 1 | 0 | | |
| 1 | LOAD TABLE CONVENTIONAL | | | | 3 | +1 | 1 | 0 | | |
| 2 | REMOTE | T1 | 186K | 3879 | 2 | +2 | 1 | 186K | | |
==============================================================================================================================================
1) introduce the hint MONITOR in the desired sql, such that how short the execution time, the sql execution is monitored.
insert /*+ MONITOR */ into T1
select * from T1@to_r1;
2) use the dbms_sqltune to report the monitored sql.
SELECT DBMS_SQLTUNE.report_sql_monitor(sql_id=>'bfjf7tz62t1p5',type=>'TEXT',report_level => 'ALL')
from dual;
SQL Monitoring Report
SQL Text
------------------------------
insert /*+ MONITOR */ into T1 select * from T1@to_r1
Global Information
------------------------------
Status : DONE
Instance ID : 1
Session : SYSTEM (268:1203)
SQL ID : bfjf7tz62t1p5
SQL Execution ID : 16777216
Execution Started : 12/02/2018 21:48:34
First Refresh Time : 12/02/2018 21:48:34
Last Refresh Time : 12/02/2018 21:48:37
Duration : 3s
Module/Action : SQL*Plus/-
Service : pdb2
Program : sqlplus@db12c.oracle.com (TNS V1-V3)
Global Stats
===================================================================================
| Elapsed | Cpu | IO | Other | Buffer | Read | Read | Write | Write |
| Time(s) | Time(s) | Waits(s) | Waits(s) | Gets | Reqs | Bytes | Reqs | Bytes |
===================================================================================
| 3.10 | 1.20 | 0.02 | 1.88 | 20794 | 22 | 336KB | 18 | 10MB |
===================================================================================
SQL Plan Monitoring Details (Plan Hash Value=1788691278)
==============================================================================================================================================
| Id | Operation | Name | Rows | Cost | Time | Start | Execs | Rows | Activity | Activity Detail |
| | | | (Estim) | | Active(s) | Active | | (Actual) | (%) | (# samples) |
==============================================================================================================================================
| 0 | INSERT STATEMENT | | | | 2 | +2 | 1 | 0 | | |
| 1 | LOAD TABLE CONVENTIONAL | | | | 3 | +1 | 1 | 0 | | |
| 2 | REMOTE | T1 | 186K | 3879 | 2 | +2 | 1 | 186K | | |
==============================================================================================================================================
No comments:
Post a Comment