=========================================
1    delete /*+ UNNEST(@SEL$2)             UNNEST(@SEL$1)             LEADING(@SEL$690D83E6 TAB@DEL$1 REFC@SEL$1 B@SEL$2)             USE_NL(@SEL$690D83E6 REFC@SEL$1)             INDEX(@SEL$690D83E6 REFC@SEL$1                     (WRI$_SQLTEXT_REFCOUNT.DBID                      WRI$_SQLTEXT_REFCOUNT.SQL_ID))        */   from   wrh$_sqltext tab  where  tab.dbid = :dbid         and :beg_snap <= tab.snap_id         and tab.snap_id <= :end_snap         and not exists (select 1                         from   wri$_sqltext_refcount refc                         where  refc.dbid = tab.dbid and                                refc.sql_id = tab.sql_id and                                refc.ref_count > 0)         and not exists (select 1                         from   WRM$_BASELINE b                         where  b.dbid = :dbid2 and                                tab.snap_id >= b.start_snap_id and                                tab.snap_id <= b.end_snap_id)
NO  delete from WRM$_WR_USAGE tab   where usage_time <=    (select nvl(max(last_sample_date), sysdate-7)       from wri$_dbu_usage_sample)
0    delete from WRH$_FILESTATXS_BL tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
4    delete from WRH$_FILESTATXS tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
5    delete from WRH$_TEMPSTATXS tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
6    delete from WRH$_DATAFILE tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
7    delete from WRH$_TEMPFILE tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
0    delete from WRH$_SQLSTAT_BL tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
9    delete from WRH$_SQLSTAT tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
10    delete from WRH$_SQL_SUMMARY tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
11    delete from WRH$_SQL_PLAN tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
12    delete from WRH$_SYSTEM_EVENT_BL tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
13    delete from WRH$_SYSTEM_EVENT tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
14    delete from WRH$_BG_EVENT_SUMMARY tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
15    delete from WRH$_WAITSTAT_BL tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
16    delete from WRH$_WAITSTAT tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
17    delete from WRH$_ENQUEUE_STAT tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
18    delete from WRH$_LATCH_BL tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
19    delete from WRH$_LATCH tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
20    delete from WRH$_LATCH_CHILDREN_BL tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
21    delete from WRH$_LATCH_CHILDREN tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
22    delete from WRH$_LATCH_PARENT_BL tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
23    delete from WRH$_LATCH_PARENT tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
24    delete from WRH$_LATCH_MISSES_SUMMARY_BL tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
25    delete from WRH$_LATCH_MISSES_SUMMARY tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
26    delete from WRH$_LIBRARYCACHE tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
27    delete from WRH$_DB_CACHE_ADVICE_BL tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
28    delete from WRH$_DB_CACHE_ADVICE tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
29    delete from WRH$_BUFFER_POOL_STATISTICS tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
30    delete from WRH$_ROWCACHE_SUMMARY_BL tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
31    delete from WRH$_ROWCACHE_SUMMARY tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
32    delete from WRH$_SGA tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
33    delete from WRH$_SGASTAT_BL tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
34    delete from WRH$_SGASTAT tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
35    delete from WRH$_PGASTAT tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
36    delete from WRH$_RESOURCE_LIMIT tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
37    delete from WRH$_SHARED_POOL_ADVICE tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
38+   delete from WRH$_SQL_WORKAREA_HISTOGRAM tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
39    delete from WRH$_PGA_TARGET_ADVICE tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
40    delete from WRH$_INSTANCE_RECOVERY tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
41    delete from WRH$_SYSSTAT_BL tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
42    delete from WRH$_SYSSTAT tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
43    delete from WRH$_PARAMETER_BL tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
44    delete from WRH$_PARAMETER tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
45    delete from WRH$_UNDOSTAT tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
46    delete from WRH$_PROCESS_MEMORY_SUMMARY tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
47    delete from WRH$_SEG_STAT_BL tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
48    delete from WRH$_SEG_STAT tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
49    delete from WRH$_SEG_STAT_OBJ tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
50    delete from WRH$_DLM_MISC_BL tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
51    delete from WRH$_DLM_MISC tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
52    delete from WRH$_SERVICE_NAME tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
53    delete from WRH$_SERVICE_STAT_BL tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
54    delete from WRH$_SERVICE_STAT tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
55    delete from WRH$_ACTIVE_SESSION_HISTORY_BL tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
56    delete from WRH$_ACTIVE_SESSION_HISTORY tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
57    delete from WRH$_SYSMETRIC_HISTORY tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
58    delete from WRH$_FILEMETRIC_HISTORY tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
59    delete from WRH$_WAITCLASSMETRIC_HISTORY tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
60    delete from WRH$_TABLESPACE_STAT_BL tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
61    delete from WRH$_TABLESPACE_STAT tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
62    delete from WRH$_LOG tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
63    delete from WRH$_MTTR_TARGET_ADVICE tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
64    delete from WRH$_TABLESPACE_SPACE_USAGE tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
65    delete from WRH$_SYSMETRIC_SUMMARY tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
66    delete from WRH$_SQL_BIND_METADATA tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
67    delete from WRH$_JAVA_POOL_ADVICE tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
68    delete from WRH$_THREAD tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
69    delete from WRH$_SESSMETRIC_HISTORY tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
70    delete from WRH$_OSSTAT_BL tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
71    delete from WRH$_OSSTAT tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
72    delete from WRH$_SYS_TIME_MODEL_BL tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
73    delete from WRH$_SYS_TIME_MODEL tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
74    delete from WRH$_OPTIMIZER_ENV tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
75    delete from WRM$_SNAP_ERROR tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
76    delete from WRH$_SERVICE_WAIT_CLASS_BL tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
77    delete from WRH$_SERVICE_WAIT_CLASS tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
78    delete from WRH$_CR_BLOCK_SERVER tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
79    delete from WRH$_CURRENT_BLOCK_SERVER tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
80    delete from WRH$_INST_CACHE_TRANSFER_BL tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
81    delete from WRH$_INST_CACHE_TRANSFER tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
82    delete from WRH$_STREAMS_POOL_ADVICE tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
83    delete from WRH$_COMP_IOSTAT tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
84    delete from WRH$_SGA_TARGET_ADVICE tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
85    delete from WRH$_SESS_TIME_STATS tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
86    delete from WRH$_STREAMS_CAPTURE tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
87    delete from WRH$_STREAMS_APPLY_SUM tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
88    delete from WRH$_BUFFERED_QUEUES tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
89    delete from WRH$_BUFFERED_SUBSCRIBERS tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
90   delete from WRH$_RULE_SET tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
91    delete from WRH$_EVENT_HISTOGRAM_BL tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
92    delete from WRH$_EVENT_HISTOGRAM tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
93    delete from WRH$_MUTEX_SLEEP tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
94    delete from WRH$_MEMORY_TARGET_ADVICE tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
95    delete from WRH$_MEMORY_RESIZE_OPS tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
96    delete from WRH$_PERSISTENT_QUEUES tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
97    delete from WRH$_PERSISTENT_SUBSCRIBERS tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
98    delete from WRH$_IOSTAT_FUNCTION tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
99    delete from WRH$_IOSTAT_FILETYPE tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
100    delete from WRH$_RSRC_CONSUMER_GROUP tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
    delete from WRH$_RSRC_PLAN tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
    delete from WRH$_CLUSTER_INTERCON tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
    delete from WRH$_MEM_DYNAMIC_COMP tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
    delete from WRH$_IC_CLIENT_STATS tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
    delete from WRH$_IC_DEVICE_STATS tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
    delete from WRH$_INTERCONNECT_PINGS_BL tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
    delete from WRH$_INTERCONNECT_PINGS tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
108    delete from WRH$_DISPATCHER tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
    delete from WRH$_SHARED_SERVER_SUMMARY tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
    delete from WRH$_IOSTAT_DETAIL tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
    delete from WRH$_DYN_REMASTER_STATS tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
    delete from WRH$_MVPARAMETER_BL tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
    delete from WRH$_MVPARAMETER tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
    delete from WRH$_PERSISTENT_QMN_CACHE tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
115    delete from WRH$_TABLESPACE tab where (:beg_snap <= tab.snap_id and         tab.snap_id <= :end_snap and         dbid = :dbid)    and not exists (select 1 from WRM$_BASELINE b                    where (tab.dbid = b.dbid) and                          (tab.snap_id >= b.start_snap_id) and                          (tab.snap_id <= b.end_snap_id)) 
NO    delete from WRM$_SNAPSHOT_DETAILS snap_det   where snap_det.dbid = :dbid   and snap_det.snap_id >= :beg_snap   and snap_det.snap_id <= :end_snap
NO    delete from WRM$_SNAPSHOT   where :beg_snap <= snap_id and         snap_id <= :end_snap and         status = 2 and         dbid = :dbid
NO    delete from WRM$_DATABASE_INSTANCE dbinst where dbinst.dbid = :dbid   and NOT EXISTS       (select 1 from WRM$_SNAPSHOT snap          where snap.dbid = :dbid            and snap.instance_number = dbinst.instance_number            and snap.startup_time = dbinst.startup_time)   and dbinst.startup_time <       (select max(startup_time)          from WRM$_DATABASE_INSTANCE         where dbid = :dbid           and instance_number = dbinst.instance_number           and startup_time < (cast(SYSTIMESTAMP as TIMESTAMP) -                               :retention))


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