select
r.id, r.name
, r.dbid, r.dbname, r.dbversion
, (case when rs.parallel > 0 then 'YES' else 'NO' end)
, r.directory
, r.status
, r.start_time, r.end_time
, round((r.end_time - r.start_time) * 86400)
, r.start_scn, r.end_scn
, r.default_action, nvl(f.cnt,0)
, rs.capture_size
, rs.dbtime, greatest(rs.dbtime_total, rs.dbtime)
, rs.user_calls, greatest(rs.user_calls_total, rs.user_calls)
, rs.user_calls_empty
, rs.txns, greatest(rs.txns_total, rs.txns)
, rs.connects, greatest(rs.connects_total, rs.connects)
, rs.errors
, r.awr_dbid, r.awr_begin_snap, r.awr_end_snap
, decode(r.awr_exported, 1, 'YES', 0, 'NO', 'NOT POSSIBLE')
, r.error_code, r.error_msg
, r.dir_path
, r.dir_path_shared
, r.last_prep_version
, r.sqlset_owner
, r.sqlset_name
from
wrr$_captures r
, (select wrr_id, count(*) as cnt
from wrr$_filters
where filter_type = 'CAPTURE'
group by wrr_id) f
, (select id,
sum(decode(parallel,'YES',1,0)) as parallel,
sum(capture_size) as capture_size,
sum(dbtime) as dbtime,
sum(dbtime_tend - dbtime_tstart) as dbtime_total,
sum(user_calls) as user_calls,
sum(user_calls_tend - user_calls_tstart) as user_calls_total,
sum(user_calls_empty) as user_calls_empty,
sum(txns) as txns,
sum(txns_tend - txns_tstart) as txns_total,
sum(connects) as connects,
sum(connects_tend - connects_tstart) as connects_total,
sum(errors) as errors
from wrr$_capture_stats
group by id) rs
where r.id = f.wrr_id(+)
and r.id = rs.id(+)
SELECT
R.ID
, R.NAME
, R.DBID
, R.DBNAME
, R.DBVERSION
, (CASE WHEN RS.PARALLEL > 0 THEN 'YES' ELSE 'NO' END)
, R.DIRECTORY
, R.STATUS
, R.START_TIME
, R.END_TIME
, ROUND((R.END_TIME - R.START_TIME) * 86400)
, R.START_SCN
, R.END_SCN
, R.DEFAULT_ACTION
, NVL(F.CNT
, 0)
, RS.CAPTURE_SIZE
, RS.DBTIME
, GREATEST(RS.DBTIME_TOTAL
, RS.DBTIME)
, RS.USER_CALLS
, GREATEST(RS.USER_CALLS_TOTAL
, RS.USER_CALLS)
, RS.USER_CALLS_EMPTY
, RS.TXNS
, GREATEST(RS.TXNS_TOTAL
, RS.TXNS)
, RS.CONNECTS
, GREATEST(RS.CONNECTS_TOTAL
, RS.CONNECTS)
, RS.ERRORS
, R.AWR_DBID
, R.AWR_BEGIN_SNAP
, R.AWR_END_SNAP
, DECODE(R.AWR_EXPORTED
, 1
, 'YES'
, 0
, 'NO'
, 'NOT POSSIBLE')
, R.ERROR_CODE
, R.ERROR_MSG
, R.DIR_PATH
, R.DIR_PATH_SHARED
, R.LAST_PREP_VERSION
, R.SQLSET_OWNER
, R.SQLSET_NAME
FROM
WRR$_CAPTURES R
, (SELECT WRR_ID
, COUNT(*) AS CNT
FROM WRR$_FILTERS
WHERE FILTER_TYPE = 'CAPTURE'
GROUP BY WRR_ID) F
, (SELECT ID
,
SUM(DECODE(PARALLEL
, 'YES'
, 1
, 0)) AS PARALLEL
,
SUM(CAPTURE_SIZE) AS CAPTURE_SIZE
,
SUM(DBTIME) AS DBTIME
,
SUM(DBTIME_TEND - DBTIME_TSTART) AS DBTIME_TOTAL
,
SUM(USER_CALLS) AS USER_CALLS
,
SUM(USER_CALLS_TEND - USER_CALLS_TSTART) AS USER_CALLS_TOTAL
,
SUM(USER_CALLS_EMPTY) AS USER_CALLS_EMPTY
,
SUM(TXNS) AS TXNS
,
SUM(TXNS_TEND - TXNS_TSTART) AS TXNS_TOTAL
,
SUM(CONNECTS) AS CONNECTS
,
SUM(CONNECTS_TEND - CONNECTS_TSTART) AS CONNECTS_TOTAL
,
SUM(ERRORS) AS ERRORS
FROM WRR$_CAPTURE_STATS
GROUP BY ID) RS
WHERE R.ID = F.WRR_ID(+)
AND R.ID = RS.ID(+)
|
|
|