Technological recipes that I've held to prepare some solutions DBA environment. (by Felipe Donoso Bastias)

30 Oct 2007

Script que entrega los últimos respaldos ejecutados en SQL Server

Script que entrega los últimos respaldos ejecutados en la base de Datos

PRINT 'ÚLTIMOS RESPALDOS EJECUTADOS'

SELECT B.name as Database_Name, ISNULL(STR(ABS(DATEDIFF(day, GetDate(),
MAX(Backup_finish_date)))), 'NUNCA') as DaysSinceLastBackup,
ISNULL(Convert(char(10), MAX(backup_finish_date), 101), 'NUNCA') as LastBackupDate
FROM master.dbo.sysdatabases B LEFT OUTER JOIN msdb.dbo.backupset A
ON A.database_name = B.name AND A.type = 'D' GROUP BY B.Name ORDER BY B.name
Share:

Copyright © DBA TIPS | Powered by Blogger
Design by SimpleWpThemes | Blogger Theme by NewBloggerThemes.com | Free Blogger Templates