column TIME_TAKEN_DISPLAY format a20
column L format 9
column status format a20
column INPUT_TYPE format a15
column INPUT_BYTES format a15
column OUTPUT_BYTES format a15
@nls

/*
SELECT SESSION_RECID,START_TIME,END_TIME,STATUS,INPUT_TYPE,INPUT_BYTES,OUTPUT_BYTES,TIME_TAKEN_DISPLAY
FROM(
SELECT SESSION_RECID,START_TIME,END_TIME,STATUS,INPUT_TYPE,INPUT_BYTES_DISPLAY INPUT_BYTES,OUTPUT_BYTES_DISPLAY OUTPUT_BYTES,TIME_TAKEN_DISPLAY
FROM V$RMAN_BACKUP_JOB_DETAILS
--WHERE INPUT_TYPE LIKE 'DATAFILE%'
ORDER BY START_TIME DESC
)
WHERE ROWNUM < &1;
*/

SELECT
/*+
      BEGIN_OUTLINE_DATA
      IGNORE_OPTIM_EMBEDDED_HINTS
      OPTIMIZER_FEATURES_ENABLE('10.2.0.5')
      ALL_ROWS
      OUTLINE_LEAF(@"SEL$11")
      OUTLINE_LEAF(@"SEL$13")
      OUTLINE_LEAF(@"SEL$12")
      OUTLINE_LEAF(@"SEL$15")
      OUTLINE_LEAF(@"SEL$14")
      OUTLINE_LEAF(@"SEL$2F35337B")
      MERGE(@"SEL$0EE6DB63")
      OUTLINE_LEAF(@"SEL$20")
      OUTLINE_LEAF(@"SEL$19")
      OUTLINE_LEAF(@"SEL$22")
      OUTLINE_LEAF(@"SEL$21")
      OUTLINE_LEAF(@"SEL$83E0BE25")
      MERGE(@"SEL$18")
      OUTLINE_LEAF(@"SEL$68B588A0")
      MERGE(@"SEL$7")
      OUTLINE_LEAF(@"SEL$5")
      OUTLINE_LEAF(@"SEL$40AA690C")
      MERGE(@"SEL$DCCAED8A")
      OUTLINE_LEAF(@"SEL$4A5D56A1")
      MERGE(@"SEL$5F9076AD")
      OUTLINE_LEAF(@"SEL$874CA85A")
      MERGE(@"SEL$62725911")
      OUTLINE_LEAF(@"SET$2")
      OUTLINE_LEAF(@"SEL$32")
      OUTLINE_LEAF(@"SEL$69F4D93D")
      MERGE(@"SEL$5A0C3989")
      OUTLINE_LEAF(@"SET$1")
      OUTLINE_LEAF(@"SEL$F718CC2F")
      MERGE(@"SEL$A065B7E5")
      OUTLINE_LEAF(@"SEL$46")
      OUTLINE_LEAF(@"SEL$45")
      OUTLINE_LEAF(@"SEL$48")
      OUTLINE_LEAF(@"SEL$57F31E95")
      MERGE(@"SEL$44")
      MERGE(@"SEL$47")
      OUTLINE_LEAF(@"SEL$49")
      OUTLINE_LEAF(@"SEL$50")
      OUTLINE_LEAF(@"SEL$51")
      OUTLINE_LEAF(@"SEL$4EC534CE")
      MERGE(@"SEL$DC3B0B0A")
      OUTLINE_LEAF(@"SEL$641071AC")
      MERGE(@"SEL$07BDC5B4")
      OUTLINE_LEAF(@"SEL$1")
      OUTLINE(@"SEL$11")
      OUTLINE(@"SEL$13")
      OUTLINE(@"SEL$12")
      OUTLINE(@"SEL$15")
      OUTLINE(@"SEL$14")
      OUTLINE(@"SEL$8")
      OUTLINE(@"SEL$0EE6DB63")
      MERGE(@"SEL$10")
      OUTLINE(@"SEL$20")
      OUTLINE(@"SEL$19")
      OUTLINE(@"SEL$22")
      OUTLINE(@"SEL$21")
      OUTLINE(@"SEL$97CCBC9E")
      MERGE(@"SEL$17")
      OUTLINE(@"SEL$18")
      OUTLINE(@"SEL$6")
      OUTLINE(@"SEL$7")
      OUTLINE(@"SEL$5")
      OUTLINE(@"SEL$29")
      OUTLINE(@"SEL$DCCAED8A")
      MERGE(@"SEL$31")
      OUTLINE(@"SEL$33")
      OUTLINE(@"SEL$5F9076AD")
      MERGE(@"SEL$35")
      OUTLINE(@"SEL$36")
      OUTLINE(@"SEL$62725911")
      MERGE(@"SEL$38")
      OUTLINE(@"SET$2")
      OUTLINE(@"SEL$32")
      OUTLINE(@"SEL$39")
      OUTLINE(@"SEL$5A0C3989")
      MERGE(@"SEL$41")
      OUTLINE(@"SET$1")
      OUTLINE(@"SEL$26")
      OUTLINE(@"SEL$A065B7E5")
      MERGE(@"SEL$28")
      OUTLINE(@"SEL$46")
      OUTLINE(@"SEL$45")
      OUTLINE(@"SEL$48")
      OUTLINE(@"SEL$956A709B")
      MERGE(@"SEL$43")
      OUTLINE(@"SEL$44")
      OUTLINE(@"SEL$47")
      OUTLINE(@"SEL$49")
      OUTLINE(@"SEL$50")
      OUTLINE(@"SEL$51")
      OUTLINE(@"SEL$23")
      OUTLINE(@"SEL$DC3B0B0A")
      MERGE(@"SEL$25")
      OUTLINE(@"SEL$2")
      OUTLINE(@"SEL$07BDC5B4")
      MERGE(@"SEL$4")
      OUTLINE(@"SEL$1")
      OUTLINE(@"SEL$9")
      OUTLINE(@"SEL$10")
      OUTLINE(@"SEL$16")
      OUTLINE(@"SEL$17")
      OUTLINE(@"SEL$30")
      OUTLINE(@"SEL$31")
      OUTLINE(@"SEL$34")
      OUTLINE(@"SEL$35")
      OUTLINE(@"SEL$37")
      OUTLINE(@"SEL$38")
      OUTLINE(@"SEL$40")
      OUTLINE(@"SEL$41")
      OUTLINE(@"SEL$27")
      OUTLINE(@"SEL$28")
      OUTLINE(@"SEL$42")
      OUTLINE(@"SEL$43")
      OUTLINE(@"SEL$24")
      OUTLINE(@"SEL$25")
      OUTLINE(@"SEL$3")
      OUTLINE(@"SEL$4")
      NO_ACCESS(@"SEL$1" "from$_subquery$_001"@"SEL$1")
      NO_ACCESS(@"SEL$641071AC" "A"@"SEL$4")
      NO_ACCESS(@"SEL$641071AC" "VBSD"@"SEL$2")
      LEADING(@"SEL$641071AC" "A"@"SEL$4" "VBSD"@"SEL$2")
      USE_NL(@"SEL$641071AC" "VBSD"@"SEL$2")
      NO_ACCESS(@"SEL$5" "A"@"SEL$5")
      USE_HASH_AGGREGATION(@"SEL$5")
      NO_ACCESS(@"SEL$4EC534CE" "C"@"SEL$25")
      NO_ACCESS(@"SEL$4EC534CE" "D"@"SEL$25")
      NO_ACCESS(@"SEL$4EC534CE" "E"@"SEL$25")
      NO_ACCESS(@"SEL$4EC534CE" "A"@"SEL$25")
      NO_ACCESS(@"SEL$4EC534CE" "B"@"SEL$25")
      LEADING(@"SEL$4EC534CE" "C"@"SEL$25" "D"@"SEL$25" "E"@"SEL$25" "A"@"SEL$25" "B"@"SEL$25")
      USE_MERGE_CARTESIAN(@"SEL$4EC534CE" "D"@"SEL$25")
      USE_MERGE_CARTESIAN(@"SEL$4EC534CE" "E"@"SEL$25")
      USE_MERGE_CARTESIAN(@"SEL$4EC534CE" "A"@"SEL$25")
      USE_HASH(@"SEL$4EC534CE" "B"@"SEL$25")
      SWAP_JOIN_INPUTS(@"SEL$4EC534CE" "B"@"SEL$25")
      USE_HASH_AGGREGATION(@"SEL$4EC534CE")
      NO_ACCESS(@"SEL$F718CC2F" "B"@"SEL$26")
      FULL(@"SEL$F718CC2F" "X$KCCBS"@"SEL$28")
      NO_ACCESS(@"SEL$F718CC2F" "C"@"SEL$26")
      LEADING(@"SEL$F718CC2F" "B"@"SEL$26" "X$KCCBS"@"SEL$28" "C"@"SEL$26")
      USE_HASH(@"SEL$F718CC2F" "X$KCCBS"@"SEL$28")
      USE_HASH(@"SEL$F718CC2F" "C"@"SEL$26")
      USE_HASH_AGGREGATION(@"SEL$F718CC2F")
      FULL(@"SEL$57F31E95" "R2"@"SEL$43")
      FULL(@"SEL$57F31E95" "X$KRBMRST"@"SEL$44")
      NO_ACCESS(@"SEL$57F31E95" "HH"@"SEL$43")
      FULL(@"SEL$57F31E95" "R"@"SEL$47")
      NO_ACCESS(@"SEL$57F31E95" "RS"@"SEL$47")
      LEADING(@"SEL$57F31E95" "R2"@"SEL$43" "X$KRBMRST"@"SEL$44" "HH"@"SEL$43" "R"@"SEL$47" "RS"@"SEL$47")
      USE_HASH(@"SEL$57F31E95" "X$KRBMRST"@"SEL$44")
      USE_HASH(@"SEL$57F31E95" "HH"@"SEL$43")
      USE_HASH(@"SEL$57F31E95" "R"@"SEL$47")
      USE_HASH(@"SEL$57F31E95" "RS"@"SEL$47")
      SWAP_JOIN_INPUTS(@"SEL$57F31E95" "X$KRBMRST"@"SEL$44")
      SWAP_JOIN_INPUTS(@"SEL$57F31E95" "HH"@"SEL$43")
      FULL(@"SEL$45" "R"@"SEL$45")
      NO_ACCESS(@"SEL$45" "RS"@"SEL$45")
      LEADING(@"SEL$45" "R"@"SEL$45" "RS"@"SEL$45")
      USE_HASH(@"SEL$45" "RS"@"SEL$45")
      USE_HASH_AGGREGATION(@"SEL$45")
      FULL(@"SEL$48" "X$KSFQP"@"SEL$48")
      FULL(@"SEL$46" "X$KSFQP"@"SEL$46")
      USE_HASH_AGGREGATION(@"SEL$46")
      FULL(@"SEL$40AA690C" "X$KCCBP"@"SEL$31")
      FULL(@"SEL$69F4D93D" "X$KCCBL"@"SEL$41")
      NO_ACCESS(@"SEL$32" "from$_subquery$_011"@"SEL$32")
      USE_HASH_AGGREGATION(@"SEL$32")
      FULL(@"SEL$874CA85A" "X$KCCBI"@"SEL$38")
      FULL(@"SEL$4A5D56A1" "X$KCCBF"@"SEL$35")
      NO_ACCESS(@"SEL$68B588A0" "A"@"SEL$7")
      NO_ACCESS(@"SEL$68B588A0" "B"@"SEL$7")
      LEADING(@"SEL$68B588A0" "A"@"SEL$7" "B"@"SEL$7")
      USE_HASH(@"SEL$68B588A0" "B"@"SEL$7")
      FULL(@"SEL$2F35337B" "R2"@"SEL$10")
      NO_ACCESS(@"SEL$2F35337B" "R1"@"SEL$10")
      NO_ACCESS(@"SEL$2F35337B" "HH"@"SEL$10")
      NO_ACCESS(@"SEL$2F35337B" "ODEV"@"SEL$10")
      LEADING(@"SEL$2F35337B" "R2"@"SEL$10" "R1"@"SEL$10" "HH"@"SEL$10" "ODEV"@"SEL$10")
      USE_HASH(@"SEL$2F35337B" "R1"@"SEL$10")
      USE_HASH(@"SEL$2F35337B" "HH"@"SEL$10")
      USE_HASH(@"SEL$2F35337B" "ODEV"@"SEL$10")
      SWAP_JOIN_INPUTS(@"SEL$2F35337B" "R1"@"SEL$10")
      SWAP_JOIN_INPUTS(@"SEL$2F35337B" "HH"@"SEL$10")
      USE_HASH_AGGREGATION(@"SEL$2F35337B")
      FULL(@"SEL$83E0BE25" "R2"@"SEL$17")
      FULL(@"SEL$83E0BE25" "X$KRBMRST"@"SEL$18")
      NO_ACCESS(@"SEL$83E0BE25" "HH"@"SEL$17")
      NO_ACCESS(@"SEL$83E0BE25" "ODEV"@"SEL$17")
      LEADING(@"SEL$83E0BE25" "R2"@"SEL$17" "X$KRBMRST"@"SEL$18" "HH"@"SEL$17" "ODEV"@"SEL$17")
      USE_HASH(@"SEL$83E0BE25" "X$KRBMRST"@"SEL$18")
      USE_HASH(@"SEL$83E0BE25" "HH"@"SEL$17")
      USE_HASH(@"SEL$83E0BE25" "ODEV"@"SEL$17")
      SWAP_JOIN_INPUTS(@"SEL$83E0BE25" "X$KRBMRST"@"SEL$18")
      SWAP_JOIN_INPUTS(@"SEL$83E0BE25" "HH"@"SEL$17")
      USE_HASH_AGGREGATION(@"SEL$83E0BE25")
      FULL(@"SEL$19" "R"@"SEL$19")
      NO_ACCESS(@"SEL$19" "RS"@"SEL$19")
      LEADING(@"SEL$19" "R"@"SEL$19" "RS"@"SEL$19")
      USE_HASH(@"SEL$19" "RS"@"SEL$19")
      USE_HASH_AGGREGATION(@"SEL$19")
      FULL(@"SEL$21" "R"@"SEL$21")
      NO_ACCESS(@"SEL$21" "RS"@"SEL$21")
      LEADING(@"SEL$21" "R"@"SEL$21" "RS"@"SEL$21")
      USE_HASH(@"SEL$21" "RS"@"SEL$21")
      SWAP_JOIN_INPUTS(@"SEL$21" "RS"@"SEL$21")
      USE_HASH_AGGREGATION(@"SEL$21")
      FULL(@"SEL$22" "X$KSFQP"@"SEL$22")
      FULL(@"SEL$20" "X$KSFQP"@"SEL$20")
      USE_HASH_AGGREGATION(@"SEL$20")
      FULL(@"SEL$11" "X$KRBMRST"@"SEL$11")
      FULL(@"SEL$12" "R"@"SEL$12")
      NO_ACCESS(@"SEL$12" "RS"@"SEL$12")
      LEADING(@"SEL$12" "R"@"SEL$12" "RS"@"SEL$12")
      USE_HASH(@"SEL$12" "RS"@"SEL$12")
      USE_HASH_AGGREGATION(@"SEL$12")
      FULL(@"SEL$14" "R"@"SEL$14")
      NO_ACCESS(@"SEL$14" "RS"@"SEL$14")
      LEADING(@"SEL$14" "R"@"SEL$14" "RS"@"SEL$14")
      USE_HASH(@"SEL$14" "RS"@"SEL$14")
      SWAP_JOIN_INPUTS(@"SEL$14" "RS"@"SEL$14")
      USE_HASH_AGGREGATION(@"SEL$14")
      FULL(@"SEL$15" "X$KSFQP"@"SEL$15")
      FULL(@"SEL$13" "X$KSFQP"@"SEL$13")
      USE_HASH_AGGREGATION(@"SEL$13")
      END_OUTLINE_DATA
  */
SESSION_RECID,START_TIME,END_TIME,STATUS,incremental_level as "L",INPUT_TYPE,INPUT_BYTES,OUTPUT_BYTES,TIME_TAKEN_DISPLAY
FROM(
SELECT VRBJD.SESSION_RECID,VRBJD.START_TIME,VRBJD.END_TIME,VRBJD.STATUS,VRBJD.INPUT_TYPE,VRBJD.INPUT_BYTES_DISPLAY INPUT_BYTES,VRBJD.OUTPUT_BYTES_DISPLAY OUTPUT_BYTES,VRBJD.TIME_TAKEN_DISPLAY,VBSD.incremental_level
FROM V$RMAN_BACKUP_JOB_DETAILS VRBJD, (select SESSION_KEY, SESSION_RECID, max(incremental_level) incremental_level from V$BACKUP_SET_DETAILS group by SESSION_KEY, SESSION_RECID) VBSD
WHERE VRBJD.SESSION_KEY = VBSD.SESSION_KEY (+) and VRBJD.SESSION_RECID = VBSD.SESSION_RECID (+)
ORDER BY START_TIME DESC
)
WHERE ROWNUM < &1;

