How to determine when Last backup taken of a database n SQL Server? TIP #15

Sometime we require to know when we have taken last backup.
So let me share here all the backup, log shipping related detail you can find in the MSDB database which is system database.
SQL server maintain all the backup related detail in the MSDB database table
As Show in the figure

Now we can run the following command to determine the database backups
GO
SELECT Name,
       database_creation_date,
       backup_start_date ,
       backup_finish_date,
       database_name,
      bmf.physical_device_name
FROM MSDB.dbo.backupset bs
INNER JOIN msdb.dbo.backupmediafamily bmf  ON bmf.media_set_id = bs.media_set_id
WHERE database_name=’DBayDB’

GO
WHERE DBAY is database name when you run this command you will get all the backup taken for this database.

Enjoy !!!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

code