Search This Blog

Total Pageviews

Sunday, 23 July 2017

How to Drop a Pluggable Database ...

How to Drop a Pluggable Database...



Drop a Pluggable Database



set linesize 200 
col NAME for a30
COLUMN "RESTRICTED" FORMAT A10
select
d.PDB_ID,
v.name,
v.open_mode,
nvl(v.restricted, 'n/a') "RESTRICTED",
d.status from v$pdbs v , dba_pdbs d
where 1=1
and v.guid=d.guid
order by v.create_scn;


    PDB_ID NAME                           OPEN_MODE  RESTRICTED STATUS
---------- ------------------------------ ---------- ---------- ----------
         2 PDB$SEED                       READ ONLY  NO         NORMAL
         3 ANUJ                           MOUNTED    n/a        NORMAL
         4 ANUJ1                          MOUNTED    NO         NORMAL

 alter pluggable database ANUJ1 open;


    PDB_ID NAME                           OPEN_MODE  RESTRICTED STATUS
---------- ------------------------------ ---------- ---------- ----------
         2 PDB$SEED                       READ ONLY  NO         NORMAL
         3 ANUJ                           MOUNTED    n/a        NORMAL
         4 ANUJ1                          READ WRITE NO         NORMAL



set linesize 200 
col NAME for a30
select con_id,name,open_mode,open_time from v$pdbs;

    CON_ID NAME                           OPEN_MODE  OPEN_TIME
---------- ------------------------------ ---------- ---------------------------------------------------------------------------
         2 PDB$SEED                       READ ONLY  23-JUL-17 07.12.37.823 AM +01:00
         3 ANUJ                           MOUNTED
         4 ANUJ1                          READ WRITE 23-JUL-17 07.20.06.798 AM +01:00



alter pluggable database ANUJ1 close immediate;   ------ <<<<< First close the database 


set linesize 200 
col NAME for a30
select con_id,name,open_mode,open_time from v$pdbs;

     CON_ID NAME                           OPEN_MODE  OPEN_TIME
---------- ------------------------------ ---------- ---------------------------------------------------------------------------
         2 PDB$SEED                       READ ONLY  23-JUL-17 07.12.37.823 AM +01:00
         3 ANUJ                           MOUNTED
         4 ANUJ1                          MOUNTED    23-JUL-17 07.32.54.795 AM +01:00



SQL> drop pluggable database ANUJ1 including datafiles;

Pluggable database dropped.


set linesize 200 
col NAME for a30
select con_id,name,open_mode,open_time from v$pdbs;

   CON_ID NAME                           OPEN_MODE  OPEN_TIME
---------- ------------------------------ ---------- ---------------------------------------------------------------------------
         2 PDB$SEED                       READ ONLY  23-JUL-17 07.12.37.823 AM +01:00
         3 ANUJ                           MOUNTED

Pluggable Database status ....



Pluggable Database status ....




On Oracle Database 12c Enterprise Edition Release 12.2.0.1.0

SQL> def
DEFINE _DATE           = "23-07-2017 07:16:22" (CHAR)
DEFINE _O_VERSION      = "Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production" (CHAR)
DEFINE _O_RELEASE      = "1202000100" (CHAR)


set head off verify off echo off pages 1500 linesize 120 feedback off
alter session set nls_date_format='DD-MM-YYYY HH24:MI:SS';
select
'PDB_ID..................................................: '||PDB_ID ,
'PDB_NAME................................................: '||PDB_NAME ,
'DBID....................................................: '||DBID ,
'CON_UID.................................................: '||CON_UID,
'GUID....................................................: '||GUID ,
'STATUS..................................................: '||STATUS,
'CREATION_SCN............................................: '||CREATION_SCN,  
'VSN.....................................................: '||VSN, 
'LOGGING ................................................: '||LOGGING ,  
'FORCE_LOGGING ..........................................: '||FORCE_LOGGING ,
'FORCE_NOLOGGING ........................................: '||FORCE_NOLOGGING, 
'APPLICATION_ROOT........................................: '||APPLICATION_ROOT,  
'APPLICATION_PDB.........................................: '||APPLICATION_PDB, 
'APPLICATION_SEED........................................: '||APPLICATION_SEED,
'APPLICATION_ROOT_CON_ID.................................: '||APPLICATION_ROOT_CON_ID,
'IS_PROXY_PDB............................................: '||IS_PROXY_PDB,
'CON_ID..................................................: '||CON_ID, 
'UPGRADE_PRIORITY........................................: '||UPGRADE_PRIORITY,
'APPLICATION_CLONE.......................................: '||APPLICATION_CLONE,
'FOREIGN_CDB_DBID........................................: '||FOREIGN_CDB_DBID,
'UNPLUG_SCN..............................................: '||UNPLUG_SCN,
'FOREIGN_PDB_ID..........................................: '||FOREIGN_PDB_ID,
'CREATION_TIME...........................................: '||CREATION_TIME, 
'REFRESH_MODE............................................: '||REFRESH_MODE,
'REFRESH_INTERVAL........................................: '||REFRESH_INTERVAL
from CDB_PDBS
where 1=1
-- and PDB_ID=3
;


PDB_ID..................................................: 3
PDB_NAME................................................: ANUJ
DBID....................................................: 2259250378
CON_UID.................................................: 2259250378
GUID....................................................: 54F57A42B6BF1AD0E055000000000001
STATUS..................................................: NORMAL
CREATION_SCN............................................: 1524245
VSN.....................................................: 203424000
LOGGING ................................................: LOGGING
FORCE_LOGGING ..........................................: NO
FORCE_NOLOGGING ........................................: NO
APPLICATION_ROOT........................................: NO
APPLICATION_PDB.........................................: NO
APPLICATION_SEED........................................: NO
APPLICATION_ROOT_CON_ID.................................:
IS_PROXY_PDB............................................: NO
CON_ID..................................................: 3
UPGRADE_PRIORITY........................................:
APPLICATION_CLONE.......................................: NO
FOREIGN_CDB_DBID........................................: 1477822556
UNPLUG_SCN..............................................: 1523784
FOREIGN_PDB_ID..........................................: 2
CREATION_TIME...........................................: 23-07-2017 05:24:43
REFRESH_MODE............................................: NONE
REFRESH_INTERVAL........................................:





set linesize 200 
SET SERVEROUTPUT ON
col NAME for a30
COLUMN "RESTRICTED" FORMAT A10
select
d.PDB_ID,
v.name,
v.open_mode,
nvl(v.restricted, 'n/a') "RESTRICTED",
d.status from v$pdbs v , dba_pdbs d
where 1=1
and v.guid=d.guid
order by v.create_scn;


    PDB_ID NAME                           OPEN_MODE  RESTRICTED STATUS
---------- ------------------------------ ---------- ---------- ----------
         2 PDB$SEED                       READ ONLY  NO         NORMAL
         3 ANUJ                           MOUNTED    n/a        NORMAL
         4 ANUJ1                          READ WRITE NO         NORMAL


Monday, 17 July 2017

Oracle log file sync waits ...

Oracle log file sync waits info script ...

oracle log file sync waits Script to Collect Log File Sync Diagnostic Information (lfsdiag.sql) (Doc ID 1064487.1) his script is intended to provide a user friendly guide to troubleshoot log file sync waits. The script will look at important parameters involved in log file sync waits, log file sync wait histogram data, and the script will look at some of the worst average log file sync times in the active session history data and AWR data and dump information to help determine why those times were the highest. The script will create a file called lfsdiag_<timestamp>.out in your local directory. -- NAME: LFSDIAG.SQL -- ------------------------------------------------------------------------ -- AUTHOR: Michael Polaski - Oracle Support Services -- ------------------------------------------------------------------------ -- PURPOSE: -- This script is intended to provide a user friendly guide to troubleshoot -- log file sync waits. The script will look at important parameters involved -- in log file sync waits, log file sync wait histogram data, and the script -- will look at the worst average log file sync times in the active session -- history data and AWR data and dump information to help determine why those -- times were the highest. The script will create a file called -- lfsdiag_<timestamp>.out in your local directory. set echo off set feedback off column timecol new_value timestamp column spool_extension new_value suffix select to_char(sysdate,'Mondd_hh24mi') timecol,'.out' spool_extension from sys.dual; column output new_value dbname select value || '_' output from v$parameter where name = 'db_name'; spool lfsdiag_&&dbname&&timestamp&&suffix set trim on trims on lines 200 pages 400 verify off alter session set optimizer_features_enable = '10.2.0.4'; PROMPT LFSDIAG DATA FOR &&dbname&&timestamp PROMPT Note: All timings are in milliseconds (1000 milliseconds = 1 second) set linesize 300 pagesize 300 PROMPT PROMPT IMPORTANT PARAMETERS RELATING TO LOG FILE SYNC WAITS: column name format a40 wra column value format a40 wra select inst_id, name, value from gv$parameter where ((value is not null and name like '%log_archive%') or name like '%commit%' or name like '%event=%' or name like '%lgwr%') and name not in (select name from gv$parameter where (name like '%log_archive_dest_state%' and value = 'enable') or name = 'log_archive_format') order by 1,2,3; set linesize 300 column REDOLOG_FILE_NAME format a50 SELECT a.GROUP#, a.THREAD#, a.SEQUENCE#, a.ARCHIVED, a.STATUS, b.MEMBER AS REDOLOG_FILE_NAME, (a.BYTES/1024/1024) AS SIZE_MB FROM v$log a JOIN v$logfile b ON a.Group#=b.Group# ORDER BY a.GROUP# ASC; prompt redo Recommended Size SELECT (SELECT ROUND(AVG(BYTES) / 1024 / 1024, 2) FROM V$LOG) AS "Redo size (MB)",ROUND((20 / AVERAGE_PERIOD) * (SELECT AVG(BYTES) FROM V$LOG) / 1024 / 1024, 2) AS "Recommended Size (MB)" FROM (SELECT AVG((NEXT_TIME - FIRST_TIME) * 24 * 60) AS AVERAGE_PERIOD FROM V$ARCHIVED_LOG WHERE FIRST_TIME > SYSDATE - 7 ) SELECT (SELECT ROUND(AVG(BYTES) / 1024 / 1024, 2) FROM V$LOG) AS "Redo size (MB)",ROUND((20 / AVERAGE_PERIOD) * (SELECT AVG(BYTES) FROM V$LOG) / 1024 / 1024, 2) AS "Recommended Size (MB)" FROM (SELECT AVG((NEXT_TIME - FIRST_TIME) * 24 * 60) AS AVERAGE_PERIOD FROM V$ARCHIVED_LOG WHERE FIRST_TIME > SYSDATE - 3 ) PROMPT PROMPT ASH THRESHOLD... PROMPT PROMPT This will be the threshold in milliseconds for average log file sync PROMPT times. This will be used for the next queries to look for the worst PROMPT 'log file sync' minutes. Any minutes that have an average log file PROMPT sync time greater than the threshold will be analyzed further. column threshold_in_ms new_value threshold format 999999999.999 select min(threshold_in_ms) threshold_in_ms from (select inst_id, to_char(sample_time,'Mondd_hh24mi') minute,avg(time_waited)/1000 threshold_in_ms from gv$active_session_history where event = 'log file sync' group by inst_id,to_char(sample_time,'Mondd_hh24mi') order by 3 desc) where rownum <= 10; PROMPT PROMPT ASH WORST MINUTES FOR LOG FILE SYNC WAITS: PROMPT PROMPT APPROACH: These are the minutes where the avg log file sync time PROMPT was the highest (in milliseconds). column minute format a12 tru column event format a30 tru column program format a40 tru column total_wait_time format 999999999999.999 column avg_time_waited format 999999999999.999 select to_char(sample_time,'Mondd_hh24mi') minute, inst_id, event,sum(time_waited)/1000 TOTAL_WAIT_TIME , count(*) WAITS,avg(time_waited)/1000 AVG_TIME_WAITED from gv$active_session_history where event = 'log file sync' group by to_char(sample_time,'Mondd_hh24mi'), inst_id, event having avg(time_waited)/1000 > &&threshold order by 1,2; PROMPT PROMPT ASH LFS BACKGROUND PROCESS WAITS DURING WORST MINUTES: PROMPT PROMPT APPROACH: What is LGWR doing when 'log file sync' waits PROMPT are happening? LMS info may be relevent for broadcast PROMPT on commit and LNS data may be relevant for dataguard. PROMPT If more details are needed see the ASH DETAILS FOR WORST PROMPT MINUTES section at the bottom of the report. column inst format 999 column minute format a12 tru column event format a30 tru column program format a50 wra select to_char(sample_time,'Mondd_hh24mi') minute, inst_id inst, program, event,sum(time_waited)/1000 TOTAL_WAIT_TIME , count(*) WAITS,avg(time_waited)/1000 AVG_TIME_WAITED from gv$active_session_history where to_char(sample_time,'Mondd_hh24mi') in (select to_char(sample_time,'Mondd_hh24mi') from gv$active_session_history where event = 'log file sync' group by to_char(sample_time,'Mondd_hh24mi'), inst_id having avg(time_waited)/1000 > &&threshold and sum(time_waited)/1000 > 1) and (program like '%LGWR%' or program like '%LMS%' or program like '%LNS%' or event = 'log file sync') group by to_char(sample_time,'Mondd_hh24mi'), inst_id, program, event order by 1,2,3,5 desc, 4; PROMPT PROMPT HISTOGRAM DATA FOR LFS AND OTHER RELATED WAITS: PROMPT PROMPT APPROACH: Look at the wait distribution for log file sync waits PROMPT by looking at "wait_time_milli". Look at the high wait times then PROMPT see if you can correlate those with other related wait events. column event format a40 wra select inst_id, event, wait_time_milli, wait_count from gv$event_histogram where event in ('log file sync','gcs log flush sync','log file parallel write','wait for scn ack','log file switch completion','gc cr grant 2-way','gc buffer busy','gc current block 2-way') or event like '%LGWR%' or event like '%LNS%' order by 2 desc,1,3; PROMPT PROMPT ORDERED BY WAIT_TIME_MILLI select inst_id, event, wait_time_milli, wait_count from gv$event_histogram where event in ('log file sync','gcs log flush sync','log file parallel write','wait for scn ack','log file switch completion','gc cr grant 2-way','gc buffer busy','gc current block 2-way') or event like '%LGWR%' or event like '%LNS%' order by 3,1,2 desc; PROMPT PROMPT REDO WRITE STATS PROMPT PROMPT "redo write time" in centiseconds (100 per second) PROMPT 11.1: "redo write broadcast ack time" in centiseconds (100 per second) PROMPT 11.2: "redo write broadcast ack time" in microseconds (1000 per millisecond) column value format 99999999999999999999 column milliseconds format 99999999999999.999 select v.version, ss.inst_id, ss.name, ss.value,decode(substr(version,1,4),'11.1',decode (name,'redo write time',value*10,'redo write broadcast ack time',value*10),'11.2', decode (name,'redo write time',value*10,'redo write broadcast ack time',value/1000),decode (name,'redo write time',value*10)) milliseconds from gv$sysstat ss, v$instance v where name like 'redo write%' and value > 0 order by 1,2,3; PROMPT PROMPT AWR WORST AVG LOG FILE SYNC SNAPS: PROMPT PROMPT APPROACH: These are the AWR snaps where the average 'log file sync' PROMPT times were the highest. column begin format a12 tru column end format a12 tru column name format a13 tru select dhs.snap_id, dhs.instance_number inst, to_char(dhs.begin_interval_time,'Mondd_hh24mi') BEGIN, to_char(dhs.end_interval_time,'Mondd_hh24mi') END, en.name, se.time_waited_micro/1000 total_wait_time, se.total_waits,se.time_waited_micro/1000 / se.total_waits avg_time_waited from dba_hist_snapshot dhs, wrh$_system_event se, v$event_name en where (dhs.snap_id = se.snap_id and dhs.instance_number = se.instance_number) and se.event_id = en.event_id and en.name = 'log file sync' and dhs.snap_id in (select snap_id from (select se.snap_id, se.time_waited_micro/1000 / se.total_waits avg_time_waited from wrh$_system_event se, v$event_name en where se.event_id = en.event_id and en.name = 'log file sync' order by avg_time_waited desc) where rownum < 4) order by 1,2; PROMPT PROMPT AWR REDO WRITE STATS PROMPT PROMPT "redo write time" in centiseconds (100 per second) PROMPT 11.1: "redo write broadcast ack time" in centiseconds (100 per second) PROMPT 11.2: "redo write broadcast ack time" in microseconds (1000 per millisecond) column stat_name format a30 tru select v.version, ss.snap_id, ss.instance_number inst, sn.stat_name, ss.value,decode(substr(version,1,4), '11.1',decode (stat_name,'redo write time',value*10,'redo write broadcast ack time',value*10),'11.2',decode (stat_name,'redo write time',value*10,'redo write broadcast ack time',value/1000), decode (stat_name,'redo write time',value*10)) milliseconds from wrh$_sysstat ss, wrh$_stat_name sn, v$instance v where ss.stat_id = sn.stat_id and sn.stat_name like 'redo write%' and ss.value > 0 and ss.snap_id in (select snap_id from ( select se.snap_id, se.time_waited_micro/1000 / se.total_waits avg_time_waited from wrh$_system_event se, v$event_name en where se.event_id = en.event_id and en.name = 'log file sync' order by avg_time_waited desc) where rownum < 4) order by 1,2,3; PROMPT PROMPT AWR LFS AND OTHER RELATED WAITS FOR WORST LFS AWRs: PROMPT PROMPT APPROACH: These are the AWR snaps where the average 'log file sync' PROMPT times were the highest. Look at related waits at those times. column name format a40 tru select se.snap_id, se.instance_number inst, en.name,se.total_waits, se.time_waited_micro/1000 total_wait_time,se.time_waited_micro/1000 / se.total_waits avg_time_waited from wrh$_system_event se, v$event_name en where se.event_id = en.event_id and (en.name in ('log file sync','gcs log flush sync','log file parallel write','wait for scn ack','log file switch completion','gc cr grant 2-way','gc buffer busy','gc current block 2-way') or en.name like '%LGWR%' or en.name like '%LNS%') and se.snap_id in (select snap_id from (select se.snap_id, se.time_waited_micro/1000 / se.total_waits avg_time_waited from wrh$_system_event se, v$event_name en where se.event_id = en.event_id and en.name = 'log file sync' order by avg_time_waited desc) where rownum < 4) order by 1, 6 desc; PROMPT PROMPT AWR HISTOGRAM DATA FOR LFS AND OTHER RELATED WAITS FOR WORST LFS AWRs: PROMPT Note: This query won't work on 10.2 - ORA-942 PROMPT PROMPT APPROACH: Look at the wait distribution for log file sync waits PROMPT by looking at "wait_time_milli". Look at the high wait times then PROMPT see if you can correlate those with other related wait events. select eh.snap_id, eh.instance_number inst, en.name, eh.wait_time_milli, eh.wait_count from wrh$_event_histogram eh, v$event_name en where eh.event_id = en.event_id and (en.name in ('log file sync','gcs log flush sync','log file parallel write','wait for scn ack','log file switch completion','gc cr grant 2-way','gc buffer busy','gc current block 2-way') or en.name like '%LGWR%' or en.name like '%LNS%') and snap_id in (select snap_id from (select se.snap_id, se.time_waited_micro/1000 / se.total_waits avg_time_waited from wrh$_system_event se, v$event_name en where se.event_id = en.event_id and en.name = 'log file sync' order by avg_time_waited desc) where rownum < 4) order by 1,3 desc,2,4; PROMPT PROMPT ORDERED BY WAIT_TIME_MILLI PROMPT Note: This query won't work on 10.2 - ORA-942 select eh.snap_id, eh.instance_number inst, en.name, eh.wait_time_milli, eh.wait_count from wrh$_event_histogram eh, v$event_name en where eh.event_id = en.event_id and (en.name in ('log file sync','gcs log flush sync','log file parallel write','wait for scn ack','log file switch completion','gc cr grant 2-way','gc buffer busy','gc current block 2-way') or en.name like '%LGWR%' or en.name like '%LNS%') and snap_id in (select snap_id from ( select se.snap_id, se.time_waited_micro/1000 / se.total_waits avg_time_waited from wrh$_system_event se, v$event_name en where se.event_id = en.event_id and en.name = 'log file sync' order by avg_time_waited desc) where rownum < 4) order by 1,4,2,3 desc; PROMPT PROMPT ASH DETAILS FOR WORST MINUTES: PROMPT PROMPT APPROACH: If you cannot determine the problem from the data PROMPT above, you may need to look at the details of what each session PROMPT is doing during each 'bad' snap. Most likely you will want to PROMPT note the times of the high log file sync waits, look at what PROMPT LGWR is doing at those times, and go from there... set linesize 300 pagesize 200 column program format a45 wra column sample_time format a25 tru column event format a30 tru column time_waited format 999999.999 column p1 format a40 tru column p2 format a40 tru column p3 format a40 tru select sample_time, inst_id inst, session_id, program, event, time_waited/1000 TIME_WAITED,p1text||': '||p1 p1,p2text||': '||p2 p2,p3text||': '||p3 p3 from gv$active_session_history where to_char(sample_time,'Mondd_hh24mi') in (select to_char(sample_time,'Mondd_hh24mi') from gv$active_session_history where event = 'log file sync' group by to_char(sample_time,'Mondd_hh24mi'), inst_id having avg(time_waited)/1000 > &&threshold) and time_waited > 0.5 order by 1,2,3,4,5; select to_char(sysdate,'Mondd hh24:mi:ss') TIME from dual; spool off PROMPT PROMPT OUTPUT FILE IS: lfsdiag_&&dbname&&timestamp&&suffix PROMPT

Sunday, 16 July 2017

AWR Retention and period

Oracle AWR Retention period   ..


SELECT extract(day from snap_interval) *24*60+extract(hour from snap_interval) *60+extract(minute from snap_interval) snapshot_Interval,
extract(day from retention) *24*60+extract(hour from retention) *60+extract(minute from retention) retention_Interval
FROM dba_hist_wr_control;

SNAPSHOT_INTERVAL RETENTION_INTERVAL
----------------- ------------------
               60              11520  <<<<In min 

set lines 200
col snap_interval        format a20
col retention            format a20
select * from dba_hist_wr_control;


      DBID SNAP_INTERVAL        RETENTION            TOPNSQL                                      CON_ID
---------- -------------------- -------------------- ---------------------------------------- ----------
2955063305 +00000 01:00:00.0    +00008 00:00:00.0    DEFAULT                                           0
                                     ^
                                     Days


To Change 15 minutes and retention to 30 days (30x24x60 = 43200)

SQL> exec dbms_workload_repository.modify_snapshot_settings(interval => 15, retention => 43200)

Friday, 14 July 2017

Oracle View metadata



Oracle View Metadata  ..




SET LONG 20000 LONGCHUNKSIZE 20000 PAGESIZE 0 LINESIZE 1000 FEEDBACK OFF VERIFY OFF TRIMSPOOL ON
BEGIN
   DBMS_METADATA.set_transform_param (DBMS_METADATA.session_transform, 'SQLTERMINATOR', true);
   DBMS_METADATA.set_transform_param (DBMS_METADATA.session_transform, 'PRETTY', true);
END;
/


SELECT DBMS_METADATA.get_ddl ('VIEW', view_name, owner) FROM   dba_views
WHERE  1=1
AND view_name = '&View_name';




SET LONG 20000 LONGCHUNKSIZE 20000 PAGESIZE 0 LINESIZE 1000 FEEDBACK OFF VERIFY OFF TRIMSPOOL ON
BEGIN
   DBMS_METADATA.set_transform_param (DBMS_METADATA.session_transform, 'SQLTERMINATOR', true);
   DBMS_METADATA.set_transform_param (DBMS_METADATA.session_transform, 'PRETTY', true);
END;
/

SELECT DBMS_METADATA.get_ddl ('VIEW', view_name, owner)
FROM   dba_views
WHERE  owner      = UPPER('&1')
AND    view_name = DECODE(UPPER('&2'), 'ALL', view_name, UPPER('&2'));

SET PAGESIZE 14 LINESIZE 100 FEEDBACK ON VERIFY ON





set long 200000 pages 0 lines 150
select dbms_metadata.GET_DDL('VIEW',u.view_name,DECODE(u.owner,'SYS','',owner)) 
from   all_views u
where 1=1
and  owner IN ('SYS') 
--and owner IN ('ANUJ') 
and view_name='ALL_IND_STATISTICS'
order by owner,view_name ;

Or 

select
  dbms_metadata.get_ddl('VIEW', 'ALL_IND_STATISTICS') stmt
from
  dual;

Create an Oracle SQL TUNING TASK manually with the sql_id !!!!!!!


Create an Oracle SQL TUNING TASK manually with the sql_id ..

Create Oracle Task 
save this on task.sql
set long 100000000 pagesize 1000 linesize 300 verify off col recommendations for a200 accept task_name - prompt 'Task_Name: ' declare ret_val varchar2(32700); begin ret_val := dbms_sqltune.create_tuning_task(task_name=>'&&Task_name', sql_id=>'&sql_id', time_limit=>&time_limit); dbms_sqltune.execute_tuning_task('&&Task_name'); end; / ============== @task.sql Task_Name: SQLT Enter value for sql_id: 40ww88ggjtx4y Enter value for time_limit: 3200 SET LONG 1000 SET LONGCHUNKSIZE 1000 SET LINESIZE 100 select dbms_sqltune.report_tuning_task('&&task_name') as recommendations from dual ;

==========================================================

STEP 1: Create tuning task for the specific SQL_ID:

declare
 task_nm varchar2(100);
 begin
 task_nm := dbms_sqltune.create_tuning_task(SQL_ID=> '&SQL_ID',TASK_NAME => 'SQL_TUNNING_TASK_SQL_ID');
 end;
 /
 
 
STEP 2: Check the status of newly created task:

SELECT task_name, status FROM dba_advisor_log WHERE task_name = '&TASK_NAME';



STEP 3: Execute the newly created task:

exec dbms_sqltune.execute_tuning_task (TASK_NAME => '&TASK_NAME');




STEP 4: Check the status after executing the task:

SELECT task_name, status FROM dba_advisor_log WHERE task_name = '&TASK_NAME';
 
 
STEP 5: Execute the Below Query to get the Advisory Report:

  SET LONG 10000 PAGESIZE 1000  LINESIZE 200
  SELECT DBMS_SQLTUNE.report_tuning_task('&TASK_NAME') AS recommendations FROM dual;
  SET PAGESIZE 24

old   1:   SELECT DBMS_SQLTUNE.report_tuning_task('&TASK_NAME') AS recommendations FROM dual
new   1:   SELECT DBMS_SQLTUNE.report_tuning_task('SQL_TUNNING_TASK_SQL_ID') AS recommendations FROM dual


NOTE: Replace task name in above query

RECOMMENDATIONS
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
GENERAL INFORMATION SECTION
-------------------------------------------------------------------------------
Tuning Task Name   : SQL_TUNNING_TASK_SQL_ID
Tuning Task Owner  : SYS
Workload Type      : Single SQL Statement
Scope              : COMPREHENSIVE
Time Limit(seconds): 1800
Completion Status  : COMPLETED
Started at         : 05/06/2021 09:27:26
Completed at       : 05/06/2021 09:27:27

-------------------------------------------------------------------------------
Schema Name: SYS
SQL ID     : 3kywng531fcxu
SQL Text   : delete from tab_stats$ where obj#=:1
Bind Variables :
 1 -  (NUMBER):7231

-------------------------------------------------------------------------------
There are no recommendations to improve the statement.

-------------------------------------------------------------------------------



STEP 6: To Drop the Tuning Task:

execute dbms_sqltune.drop_tuning_task('&TASK_NAME');


==================================================== define p_inst=1 column dt heading 'Date/Hour' format a11 set linesize 500 pages 100 select * from ( select min(snap_id) as snap_id, to_char(start_time,'MM/DD/YY') as dt, to_char(start_time,'HH24') as hr from ( select snap_id, s.instance_number, begin_interval_time start_time, end_interval_time end_time, snap_level, flush_elapsed, lag(s.startup_time) over (partition by s.dbid, s.instance_number order by s.snap_id) prev_startup_time, s.startup_time from dba_hist_snapshot s, gv$instance i where 1=1 -- and begin_interval_time between trunc(sysdate)- p_days and sysdate and begin_interval_time > sysdate -4 and s.instance_number = i.instance_number and s.instance_number = &p_inst order by snap_id ) group by to_char(start_time,'MM/DD/YY') , to_char(start_time,'HH24') order by snap_id, start_time ) pivot (sum(snap_id) for hr in ('00','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23') ) order by dt; Date/Hour '00' '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' '13' '14' '15' '16' '17' '18' '19' '20' '21' '22' '23' ----------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- 05/01/21 32911 32912 32913 32914 32915 32916 32917 32918 32919 32920 32921 32922 32923 32924 32925 32926 32927 32928 32929 32930 05/02/21 32931 32932 32933 32934 32935 32936 32937 32938 32939 32940 32941 32942 32943 32944 32945 32946 32947 32948 32949 32950 32951 32952 32953 32954 05/03/21 32955 32956 32957 32958 32959 32960 32961 32962 32963 32964 32965 32966 32967 32968 32969 32970 32971 32972 32973 32974 32975 32976 32977 32978 05/04/21 32979 32980 32981 32982 32983 32984 32985 32986 32987 32988 32989 32990 32991 32992 32993 32994 32995 32996 32997 32998 32999 33000 33001 33002 05/05/21 33003 33004 33005 DECLARE l_sql_tune_task_id VARCHAR2(100); BEGIN l_sql_tune_task_id := DBMS_SQLTUNE.create_tuning_task ( begin_snap => 32911 , end_snap => 32926, sql_id => '1j6tnz8fcm4c3', scope => DBMS_SQLTUNE.scope_comprehensive, time_limit => 560, task_name => '1j6tnz8fcm4c3_AWR_tuning_task', description => 'Tuning task for statement 1j6tnz8fcm4c3 in AWR.'); DBMS_OUTPUT.put_line('l_sql_tune_task_id: ' || l_sql_tune_task_id); END; / DECLARE l_sql_tune_task_id VARCHAR2(100); BEGIN l_sql_tune_task_id := DBMS_SQLTUNE.create_tuning_task ( sql_id => '1j6tnz8fcm4c3', scope => DBMS_SQLTUNE.scope_comprehensive, time_limit => 560, task_name => '1j6tnz8fcm4c3_AWR_tuning_task', description => 'Tuning task for statement 1j6tnz8fcm4c3'); DBMS_OUTPUT.put_line('l_sql_tune_task_id: ' || l_sql_tune_task_id); END; / SQL> EXEC DBMS_SQLTUNE.execute_tuning_task(task_name => '1j6tnz8fcm4c3_AWR_tuning_task'); PL/SQL procedure successfully completed. SET LONG 1000 SET LONGCHUNKSIZE 1000 SET LINESIZE 100 SELECT DBMS_SQLTUNE.REPORT_TUNING_TASK( '1j6tnz8fcm4c3_AWR_tuning_task' ) FROM DUAL;
DBMS_SQLTUNE.REPORT_TUNING_TASK('1J6TNZ8FCM4C3_AWR_TUNING_TASK') ---------------------------------------------------------------------------------------------------- GENERAL INFORMATION SECTION ------------------------------------------------------------------------------- Tuning Task Name : 1j6tnz8fcm4c3_AWR_tuning_task Tuning Task Owner : SYS Workload Type : Single SQL Statement Scope : COMPREHENSIVE Time Limit(seconds): 560 Completion Status : COMPLETED Started at : 05/05/2021 03:16:45 Completed at : 05/05/2021 03:16:46 ------------------------------------------------------------------------------- Schema Name: SYS SQL ID : 1j6tnz8fcm4c3 SQL Text : delete /* QOSH:PURGE_OLD_STS *//*+ dynamic_sampling(4) */ from sys.wri$_optstat_histgrm_history where savtime < :1 and savtime > timestamp '1900-01-01 00:00:00 -0:0' and rownum <= :2 Bind Variables : 2 - (NUMBER):10000 ------------------------------------------------------------------------------- FINDINGS SECTION (1 finding) -------------------------------------------------------------------------------
EXEC DBMS_SQLTUNE.drop_tuning_task (task_name => '1j6tnz8fcm4c3_AWR_tuning_task');

==============





Test case !!


create table t (n number );



SQL> 

create table t (n number );


declare
          begin
           for i in 1 .. 100000 loop
               insert into t values(i+1);
               commit;
           end loop;
          end;
/



QL> create index t_idx on t(n);

Index created.

SQL> exec dbms_stats.gather_table_stats('SCOTT','T');

PL/SQL procedure successfully completed.



PL/SQL procedure successfully completed.


select /*+ no_index(t t_idx) */ * from t where n=987 ;


set linesize 300 
col sql_text for a50 wrap 
col parsing_schema_name for a20
select sql_id,parsing_schema_name,sql_text from gv$sql where sql_text like '%from t where n=987%'



SQL_ID        PARSING_SCHEMA_NAME  SQL_TEXT
------------- -------------------- --------------------------------------------------
3w7p0ga8tv0fb SCOTT                select /*+ no_index(t t_idx) */ * from t where n=9
                                   87



3w7p0ga8tv0fb select /*+ no_index(t t_idx) */ * from t where n=9
              87


			  
			  
			  
			  
			  
DECLARE
  v_sql_tune_task_id  VARCHAR2(100);
BEGIN
  v_sql_tune_task_id := DBMS_SQLTUNE.create_tuning_task (
                          sql_id      => '3w7p0ga8tv0fb',
                          scope       => DBMS_SQLTUNE.scope_comprehensive,
                          time_limit  => 1000,
                          task_name   => '3w7p0ga8tv0fb_ms_tuning_task',
                          description => 'Tuning task for the SQL statement with the ID3w7p0ga8tv0fb from the cursor cache');
  DBMS_OUTPUT.put_line('v_sql_tune_task_id: ' || v_sql_tune_task_id);
END;
/

PL/SQL procedure successfully completed.



SQL> SELECT task_name, status FROM dba_advisor_log WHERE task_name = '&TASK_NAME';
Enter value for task_name: 3w7p0ga8tv0fb_ms_tuning_task
old   1: SELECT task_name, status FROM dba_advisor_log WHERE task_name = '&TASK_NAME'
new   1: SELECT task_name, status FROM dba_advisor_log WHERE task_name = '3w7p0ga8tv0fb_ms_tuning_task'

TASK_NAME                                                                                                                        STATUS
-------------------------------------------------------------------------------------------------------------------------------- -----------
3w7p0ga8tv0fb_ms_tuning_task                                                                                                     INITIAL




set long 65536
set longchunksize 65536
set linesize 100
SELECT DBMS_SQLTUNE.REPORT_TUNING_TASK('3w7p0ga8tv0fb_ms_tuning_task', 'TEXT', 'TYPICAL', 'FINDINGS') FROM DUAL;


 SET LONG 1000000
 SET LONGCHUNKSIZE 1000
 SET LINESIZE 100
 SELECT DBMS_SQLTUNE.REPORT_TUNING_TASK( '3w7p0ga8tv0fb_ms_tuning_task' ) FROM DUAL;



DBMS_SQLTUNE.REPORT_TUNING_TASK('3W7P0GA8TV0FB_MS_TUNING_TASK')
----------------------------------------------------------------------------------------------------
GENERAL INFORMATION SECTION
-------------------------------------------------------------------------------
Tuning Task Name   : 3w7p0ga8tv0fb_ms_tuning_task
Tuning Task Owner  : SYS
Workload Type      : Single SQL Statement
Scope              : COMPREHENSIVE
Time Limit(seconds): 1000
Completion Status  : COMPLETED
Started at         : 12/02/2023 12:58:02
Completed at       : 12/02/2023 12:58:06


DBMS_SQLTUNE.REPORT_TUNING_TASK('3W7P0GA8TV0FB_MS_TUNING_TASK')
----------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------
Schema Name: SCOTT
SQL ID     : 3w7p0ga8tv0fb
SQL Text   : select /*+ no_index(t t_idx) */ * from t where n=987

-------------------------------------------------------------------------------
FINDINGS SECTION (1 finding)
-------------------------------------------------------------------------------

1- SQL Profile Finding (see explain plans section below)
--------------------------------------------------------

DBMS_SQLTUNE.REPORT_TUNING_TASK('3W7P0GA8TV0FB_MS_TUNING_TASK')
----------------------------------------------------------------------------------------------------
  A potentially better execution plan was found for this statement.

  Recommendation (estimated benefit: 98.94%)
  ------------------------------------------
  - Consider accepting the recommended SQL profile. A SQL plan baseline
    corresponding to the plan with the SQL profile will also be created.
    execute dbms_sqltune.accept_sql_profile(task_name =>
            '3w7p0ga8tv0fb_ms_tuning_task', task_owner => 'SYS', replace =>
            TRUE);

  Validation results

DBMS_SQLTUNE.REPORT_TUNING_TASK('3W7P0GA8TV0FB_MS_TUNING_TASK')
----------------------------------------------------------------------------------------------------
  ------------------
  The SQL profile was tested by executing both its plan and the original plan
  and measuring their respective execution statistics. A plan may have been
  only partially executed if the other could be run to completion in less time.

                           Original Plan  With SQL Profile  % Improved
                           -------------  ----------------  ----------
  Completion Status:            COMPLETE          COMPLETE
  Elapsed Time (s):             .001512           .000026      98.28 %
  CPU Time (s):                 .001541           .000026      98.31 %
  User I/O Time (s):                  0                 0

DBMS_SQLTUNE.REPORT_TUNING_TASK('3W7P0GA8TV0FB_MS_TUNING_TASK')
----------------------------------------------------------------------------------------------------
  Buffer Gets:                      190                 2      98.94 %
  Physical Read Requests:             0                 0
  Physical Write Requests:            0                 0
  Physical Read Bytes:                0                 0
  Physical Write Bytes:               0                 0
  Rows Processed:                     1                 1
  Fetches:                            1                 1
  Executions:                         1                 1

  Notes
  -----

DBMS_SQLTUNE.REPORT_TUNING_TASK('3W7P0GA8TV0FB_MS_TUNING_TASK')
----------------------------------------------------------------------------------------------------
  1. Statistics for the original plan were averaged over 10 executions.
  2. Statistics for the SQL profile plan were averaged over 10 executions.

-------------------------------------------------------------------------------
EXPLAIN PLANS SECTION
-------------------------------------------------------------------------------

1- Original With Adjusted Cost
------------------------------
Plan hash value: 1601196873


DBMS_SQLTUNE.REPORT_TUNING_TASK('3W7P0GA8TV0FB_MS_TUNING_TASK')
----------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------
| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |      |     1 |     5 |    69   (2)| 00:00:01 |
|*  1 |  TABLE ACCESS FULL| T    |     1 |     5 |    69   (2)| 00:00:01 |
--------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   1 - filter("N"=987)

DBMS_SQLTUNE.REPORT_TUNING_TASK('3W7P0GA8TV0FB_MS_TUNING_TASK')
----------------------------------------------------------------------------------------------------

2- Using SQL Profile
--------------------
Plan hash value: 2946670127

--------------------------------------------------------------------------
| Id  | Operation        | Name  | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------
|   0 | SELECT STATEMENT |       |     1 |     5 |     1   (0)| 00:00:01 |
|*  1 |  INDEX RANGE SCAN| T_IDX |     1 |     5 |     1   (0)| 00:00:01 |
--------------------------------------------------------------------------

DBMS_SQLTUNE.REPORT_TUNING_TASK('3W7P0GA8TV0FB_MS_TUNING_TASK')
----------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   1 - access("N"=987)

-------------------------------------------------------------------------------




DECLARE
sqlprofile_name VARCHAR2(30);
BEGIN
sqlprofile_name := DBMS_SQLTUNE.ACCEPT_SQL_PROFILE (task_name => '3w7p0ga8tv0fb_ms_tuning_task', name => 'sql_profile_1', force_match => true);
END;


PL/SQL procedure successfully completed.





alter session set nls_date_format='dd-mm-YYYY hh24:mi'; 
set linesize 400 pagesize 400
 column name format a25
 column category format a15
 column status format a15
 col created for a28
 col sql_text for a100 wrap
 select name, category, created,status ,sql_text from dba_sql_profiles;


 
 
NAME                      CATEGORY        CREATED                      STATUS          SQL_TEXT
------------------------- --------------- ---------------------------- --------------- ----------------------------------------------------------------------------------------------------
sql_profile_1             DEFAULT         02-DEC-23 01.07.41.000000 PM ENABLED         select /*+ no_index(t t_idx) */ * from t where n=987



sqlplus /nolog

SQL*Plus: Release 12.2.0.1.0 Production on Sat Dec 2 13:17:39 2023

Copyright (c) 1982, 2016, Oracle.  All rights reserved.



SQL> connect scott/vihaan123
Connected.
SQL> select /*+ no_index(t t_idx) */ * from t where n=987 ;

         N
----------
       987

	   
	   
col PLAN_TABLE_OUTPUT for a150
select * from table(dbms_xplan.display_cursor('8k564npmnpwdv', null, 'ALLSTATS LAST'));





PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID  8k564npmnpwdv, child number 1
-------------------------------------
 select /*+ no_index(t t_idx) */ * from t where n=987

Plan hash value: 1601196873

-------------------------------------------
| Id  | Operation         | Name | E-Rows |
-------------------------------------------
|   0 | SELECT STATEMENT  |      |        |
|*  1 |  TABLE ACCESS FULL| T    |      1 |
-------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   1 - filter("N"=987)

Note
-----
   - SQL profile sql_profile_1 used for this statement
   - SQL plan baseline SQL_PLAN_4dmarvn36j4u294ecae5c used for this statement
   - Warning: basic plan statistics not available. These are only collected when:
       * hint 'gather_plan_statistics' is used for the statement or
       * parameter 'statistics_level' is set to 'ALL', at session or system level


26 rows selected.


 select sql_id
    ,      child_number
    ,      is_bind_aware
    ,      is_bind_sensitive
    ,      is_shareable
    ,      to_char(exact_matching_signature) sig
    ,      executions
   ,      plan_hash_value,
   sql_plan_baseline
   from   gv$sql
   where 1=1
   and sql_id in ('8k564npmnpwdv','3w7p0ga8tv0fb' )
   ;
   
   
   alter session set optimizer_capture_sql_plan_baselines = true;


	


set linesize 500	
col SQL_ID for a18 
col PLAN_NAME for a35 
col CREATOR for a18 
col CREATED  for a30	
col HOURS for a12		  
select dbms_sqltune_util0.sqltext_to_sqlid(sql_text||chr(0)) sql_id,
( select to_number(regexp_replace(plan_table_output,'^[^0-9]*')) 
  from table(dbms_xplan.display_sql_plan_baseline(sql_handle,plan_name)) 
  where plan_table_output like 'Plan hash value: %') plan_hash_value
,plan_name,SQL_HANDLE ,enabled,accepted,fixed,reproduced  
,dbms_xplan.format_time_s(elapsed_time/1e6) hours,creator,origin,created,last_modified,last_executed
,sql_text
from dba_sql_plan_baselines b 
where sql_text like '%select /*+ no_index(t t_idx) */ * from t where n=987%'
order by sql_id,hours desc
;


																																						  
SQL_ID             PLAN_HASH_VALUE PLAN_NAME                           SQL_HANDLE                     ENA ACC FIX REP HOURS        CREATOR            ORIGIN                          CREATED                        LAST_MODIFIED                                                               LAST_EXECUTED        SQL_TEXT
------------------ --------------- ----------------------------------- ------------------------------ --- --- --- --- ------------ ------------------ ----------------------------- ------------------------------ --------------------------------------------------------------------------- --------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------
3w7p0ga8tv0fb           1601196873 SQL_PLAN_4dmarvn36j4u294ecae5c      SQL_46cd57dd06689342           YES YES NO  YES 00:00:00     SCOTT              AUTO-CAPTURE                    02-DEC-23 12.54.08.000000 PM   02-DEC-23 12.54.08.000000 PM                                                02-DEC-23 12.54.08.000000 PM                                                  select /*+ no_index(t t_idx) */ * from t where n=987
3w7p0ga8tv0fb           2946670127 SQL_PLAN_4dmarvn36j4u20c80c615      SQL_46cd57dd06689342           YES NO  NO  YES 00:00:00     SCOTT              AUTO-CAPTURE                    02-DEC-23 01.18.14.000000 PM   02-DEC-23 01.18.14.000000 PM                                                                     select /*+ no_index(t t_idx) */ * from t where n=987
6t4pnkz6d9w11           1427923351 SQL_PLAN_5tss04rw268vqfea79147      SQL_5ce30025f8232376           YES YES NO  YES 00:00:00     SYS                AUTO-CAPTURE                    02-DEC-23 02.05.43.000000 PM   02-DEC-23 02.05.43.000000 PM                                                02-DEC-23 02.05.43.000000 PM                                                  select dbms_sqltune_util0.sqltext_to_sqlid(sql_text||chr(0)) sql_id,
             

																																						  



define sql_handle='SQL_46cd57dd06689342'
define sql_plan='SQL_PLAN_4dmarvn36j4u294ecae5c'
select * from table(dbms_xplan.display_sql_plan_baseline(sql_handle=>'&sql_handle',plan_name=>'&sql_plan', format=>'BASIC'));
	


PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------
SQL handle: SQL_46cd57dd06689342
SQL text: select /*+ no_index(t t_idx) */ * from t where n=987
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Plan name: SQL_PLAN_4dmarvn36j4u294ecae5c         Plan id: 2498539100
Enabled: YES     Fixed: NO      Accepted: YES     Origin: AUTO-CAPTURE
Plan rows: From dictionary
--------------------------------------------------------------------------------

Plan hash value: 1601196873

----------------------------------
| Id  | Operation         | Name |
----------------------------------
|   0 | SELECT STATEMENT  |      |
|   1 |  TABLE ACCESS FULL| T    |
----------------------------------

20 rows selected.





from SNAP !!!

1

DECLARE
  l_sql_tune_task_id  VARCHAR2(100);
BEGIN
  l_sql_tune_task_id := DBMS_SQLTUNE.create_tuning_task (
                          begin_snap  => 159954	,
                          end_snap    => 159955,
                          sql_id      => 'xa5m3ggy97233',
                          scope       => DBMS_SQLTUNE.scope_comprehensive,
                          time_limit  => 60,
                          task_name   => 'ga5m3ggy97233_AWR_tuning_task1',
                          description => 'Tuning task for statement ga5m3ggy97233  in AWR');
  DBMS_OUTPUT.put_line('l_sql_tune_task_id: ' || l_sql_tune_task_id);
END;
/



2

EXECUTE DBMS_SQLTUNE.execute_tuning_task(task_name => 'xa5m3ggy97233_AWR_tuning_task1')

3
set long 65536
set longchunksize 65536
set linesize 100
SELECT DBMS_SQLTUNE.REPORT_TUNING_TASK('xa5m3ggy97233_AWR_tuning_task1', 'TEXT', 'TYPICAL', 'FINDINGS') FROM DUAL;
		  



===





from AWR ---


select min(snap_id), max(snap_id) from dba_hist_sqlstat where sql_id='&sql_id' ;



select min(snap_id), max(snap_id) from DBA_HIST_ACTIVE_SESS_HISTORY where sql_id='&sql_id' and SAMPLE_TIME > sysdate -1;


MIN(SNAP_ID) MAX(SNAP_ID)
------------ ------------
      164804       164840




define snap1=164839
define snap2=164840
define sql_id='49xvssdzd07su'
DECLARE
a VARCHAR2(100);
BEGIN
a:= DBMS_SQLTUNE.create_tuning_task ( begin_snap=> &snap1, end_snap=>&snap2, sql_id=> '&sql_id', scope => 'comprehensive', task_name => 'T_&sql_id', time_limit=>7200);
END;
/




check 

 set linesize 300 pagesize 400
 col TASK_NAME for a20
SELECT task_name, status FROM dba_advisor_log WHERE task_name = '&TASK_NAME';


-- execute

exec dbms_sqltune.execute_tuning_task ('T_49xvssdzd07su');


-- report 
set long 65536
set longchunksize 65536
set linesize 100
SELECT DBMS_SQLTUNE.REPORT_TUNING_TASK('T_49xvssdzd07su', 'TEXT', 'TYPICAL', 'FINDINGS') FROM DUAL;








Oracle DBA

anuj blog Archive