Listing all databases backup
Are you sure, that you make your db backups?
CREATE VIEW ViewLastBackup
AS
SELECT a.name AS 'DataBase', Backup_Date, Days_since_last_Backup
FROM master.dbo.sysdatabases AS a LEFT JOIN
(SELECT database_name,MAX(backup_finish_date) AS Backup_Date,
ABS(DATEDIFF(day,GETDATE(),MAX(backup_finish_date))) AS Days_since_last_Backup
FROM msdb.dbo.backupset WHERE backup_finish_date <= GETDATE()
GROUP BY database_name) AS b
ON a.name = b.database_name
SELECT * FROM ViewLastBackup WHERE Backup_Date IS NOT NULL
ORDER BY 2 DESC,1
SELECT * FROM ViewLastBackup WHERE Backup_Date IS NULL
ORDER BY 2 DESC,1
You can download it here ;)
Print article | This entry was posted by tosc on 2006-12-14 at 15:03:23 . Follow any responses to this post through RSS 2.0. |
Tag cloud
administration backup «best practices» books bug configuration ctp «cumulative update» demo dmv ebook humor index indexoptimize integrity kbfix links maintenance «ms sql server 2008» pass performance php reviews «ross mistry» «service pack» «service pack 2» «service pack 3» «service packs» sharepoint «sql server» «sql server 2005» «sql server 2008 r2» «sql server 2012» «sql server 2014» sqlcat sqlpass «sqlpass franken» ssms ssmstoolspack «stacia misner» sysadmin t-sql technet «technical note» tempdb tools «trace flag» upgrade version whitepapers