2010-09-25 8 views

risposta

20
SELECT d.name, 
     MAX(b.backup_finish_date) AS backup_finish_date 
FROM  master.sys.sysdatabases d 
     LEFT OUTER JOIN msdb..backupset b 
     ON  b.database_name = d.name 
     AND  b.type   = 'L' 
GROUP BY d.name 
ORDER BY backup_finish_date DESC 
4

Mi consiglia di utilizzare questo script modificato in modo da poter vedere che BD è in tutto o BULK_LOGGED e non avendo alcuna BACKUP LOG.

SELECT d.name, 
     d.recovery_model_desc, 
     MAX(b.backup_finish_date) AS backup_finish_date 
FROM  master.sys.databases d 
     LEFT OUTER JOIN msdb..backupset b 
     ON  b.database_name = d.name 
     AND  b.type   = 'L' 
GROUP BY d.name, d.recovery_model_desc 
ORDER BY backup_finish_date DES 
+0

Guardando l'output di questa istruzione, vedo NULL per backup_finish_date ... che cosa significa? http://stackoverflow.com/questions/40050221/sql-server-what-exactly-is-the-backup-finish-date-in-master-sys-databases –