Thursday, August 25, 2011

Backup time

 You can find your backup time with the following query
SELECT * FROM (SELECT END.dt, 'Incremental' BACKUP, STAR.TIME started, END.TIME END,  

DECODE(TRUNC(END.TIME - star.TIME), 0, NULL, TRUNC(END.TIME - star.TIME) || ' Days' || ' + ') ||

TO_CHAR(TO_DATE(TRUNC(MOD(END.TIME - star.TIME,1) * 86400), 'SSSSS'), 'HH24:MI:SS') TIME

FROM

(SELECT TRUNC(start_time) dt , MAX(COMPLETION_TIME) TIME FROM V$BACKUP_SET WHERE BACKUP_TYPE='I'

GROUP BY TRUNC(start_time)) END,

(SELECT TRUNC(start_time) dt, MIN(START_TIME) TIME FROM V$BACKUP_SET WHERE BACKUP_TYPE='I'

GROUP BY TRUNC(start_time)) STAR

WHERE END.dt = STAR.dt

UNION ALL

SELECT END.dt, 'Full Database' BACKUP, STAR.TIME started, END.TIME END,

DECODE(TRUNC(END.TIME - star.TIME), 0, NULL, TRUNC(END.TIME - star.TIME) || ' Days' || ' + ') ||

TO_CHAR(TO_DATE(TRUNC(MOD(END.TIME - star.TIME,1) * 86400), 'SSSSS'), 'HH24:MI:SS') TIME

FROM

(SELECT TRUNC(start_time) dt , MAX(COMPLETION_TIME) TIME FROM V$BACKUP_SET WHERE BACKUP_TYPE='D'

GROUP BY TRUNC(start_time)) END,

(SELECT TRUNC(start_time) dt, MIN(START_TIME) TIME FROM V$BACKUP_SET WHERE BACKUP_TYPE='D'

GROUP BY TRUNC(start_time)) STAR

WHERE END.dt = STAR.dt)

ORDER BY dt ASC;
Apps DBA Free Lance
Sukhwinder Singh

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.