Get the last full and log backup information for SQL Server 2005/2008
SELECT sdb.Name AS DatabaseName, sdb.recovery_model_desc,
COALESCE(CONVERT(VARCHAR(30), MAX(bus.backup_finish_date), 120),'-') AS LastBackUpTime
FROM sys.databases sdb
LEFT OUTER JOIN msdb.dbo.backupset bus ON bus.database_name = sdb.name and bus.type='D'
GROUP BY sdb.Name, sdb.recovery_model_desc
order by sdb.Name
SELECT sdb.Name AS DatabaseName,sdb.recovery_model_desc,
COALESCE(CONVERT(VARCHAR(30), MAX(bus.backup_finish_date), 120),'-') AS LastBackUpTime
FROM sys.databases sdb
LEFT OUTER JOIN msdb.dbo.backupset bus ON bus.database_name = sdb.name and bus.type='L'
where sdb.recovery_model_desc='FULL'
GROUP BY sdb.Name, sdb.recovery_model_desc
order by sdb.Name
If you need commands to give the location of the backups then please leave a comment.
SELECT sdb.Name AS DatabaseName, sdb.recovery_model_desc,
COALESCE(CONVERT(VARCHAR(30), MAX(bus.backup_finish_date), 120),'-') AS LastBackUpTime
FROM sys.databases sdb
LEFT OUTER JOIN msdb.dbo.backupset bus ON bus.database_name = sdb.name and bus.type='D'
GROUP BY sdb.Name, sdb.recovery_model_desc
order by sdb.Name
SELECT sdb.Name AS DatabaseName,sdb.recovery_model_desc,
COALESCE(CONVERT(VARCHAR(30), MAX(bus.backup_finish_date), 120),'-') AS LastBackUpTime
FROM sys.databases sdb
LEFT OUTER JOIN msdb.dbo.backupset bus ON bus.database_name = sdb.name and bus.type='L'
where sdb.recovery_model_desc='FULL'
GROUP BY sdb.Name, sdb.recovery_model_desc
order by sdb.Name
If you need commands to give the location of the backups then please leave a comment.
No comments:
Post a Comment