Thursday, August 25, 2011

Find which media tapes have the latest backup

You can find which media tapes have the latest RMAN backup with the following query: 
SELECT RECID, STAMP, SET_STAMP, SET_COUNT, PIECE#, DEVICE_TYPE, HANDLE, MEDIA,
STATUS, DELETED, START_TIME,  COMPLETION_TIME, BYTES

FROM GV$BACKUP_PIECE

WHERE HANDLE LIKE '%ORACLE%SID%'

AND TRUNC(START_TIME) > TRUNC(SYSDATE-6)

ORDER BY START_TIME DESC;
Where SID is the database SID, for example A7







To find the distinct tapes use: 


SELECT DISTINCT(MEDIA) FROM GV$BACKUP_PIECE 

WHERE HANDLE LIKE 'ORACLE%A7%'

AND TRUNC(START_TIME) > TRUNC(SYSDATE-7);
Apps DBA Free Lance,
Sukhwinder Singh

No comments:

Post a Comment

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