--LISTAR OS ÚLTIMOS BACKUPS REALIZADOS COM SUCESSO
SELECT
SD.NAME,
CASE BS.TYPE
WHEN 'D' THEN 'DADOS'
WHEN 'L' THEN 'LOG'
END AS TYPE,
BS.DATABASE_NAME,
MAX(BS.BACKUP_START_DATE) AS LAST_BACKUP
FROM
MASTER..SYSDATABASES SD
LEFT OUTER JOIN MSDB..BACKUPSET BS ON
RTRIM(BS.DATABASE_NAME) = RTRIM(SD.NAME)
LEFT OUTER JOIN MSDB..BACKUPMEDIAFAMILY BMF ON
BS.MEDIA_SET_ID = BMF.MEDIA_SET_ID
GROUP BY
SD.NAME,
BS.TYPE,
BS.DATABASE_NAME
ORDER BY
SD.NAME,LAST_BACKUP
Nenhum comentário:
Postar um comentário