Saturday, April 24, 2010

Find When Was The Last Backup Taken In SQL Server

Here is the script to find the last backup taken time in SQL Server.

SELECT Database_Name,
CONVERT( SmallDateTime , MAX(Backup_Finish_Date)) as Last_Backup,
DATEDIFF(d, MAX(Backup_Finish_Date), Getdate()) as Days_Since_Last
FROM MSDB.dbo.BackupSet
WHERE Type = 'd'
GROUP BY Database_Name
ORDER BY 3 DESC
Go

Here is the script to find the last Transaction Log backup

SELECT Database_Name,
CONVERT( SmallDateTime , MAX(Backup_Finish_Date)) as Last_Backup,
DATEDIFF(d, MAX(Backup_Finish_Date), Getdate()) as Days_Since_Last
FROM MSDB.dbo.BackupSet
WHERE Type = 'l'
GROUP BY Database_Name
ORDER BY 3 DESC
How to find out what when was last transaction log restored. How to find out what when was last transaction log backup happened.  How to find out what when was last transaction log backup done. How to know when was last transaction log backup happened in sql server. in sql server 2008 R2. in sql server 2012. in sql server 2005. in sql server 2000. how to find the time when last backup taken. last backup time in sql server 2008 R2. last backup time in sql server 2012. data base administrator. Microsoft database administrator. sql questions and answers. interview questions for servers. database administrator interview questions. sql dba interview questions and answers. server interview. sql questions for interview. ms sql interview questions with answers. becoming a database administrator.

0 comments:

Post a Comment