•  
  • Scripts
  • Find the latest databse backup SQL server

Find the latest databse backup SQL server

by Muthukkumaran kaliyamoorthy Published on: March 5, 2012
Comments: 2 Comments
Tags: ,
Categories:Scripts

Use the simplest script to find the latest database backup and the location.

 

SELECT b.server_name ,b.database_name,b.user_name, f.physical_device_name,
b.backup_finish_date,b.backup_size /1024/1024 AS size_MB,b.type,b.recovery_model,
b.has_bulk_logged_data,b.is_copy_only,f.mirror
FROM MSDB.DBO.BACKUPMEDIAFAMILY F
JOIN MSDB.DBO.BACKUPSET B
ON (f.media_set_id=b.media_set_id)
WHERE database_name='test'
--AND B.type='L'
ORDER BY b.backup_finish_date DESC

 

You can add more conditions on where clause http://msdn.microsoft.com/en-us/library/ms186299.aspx.

Like backup Type

D = Full

I = Differential database

L = Log

F = File or filegroup

G =Differential file

P = Partial

Q = Differential partial

Muthukkumaran kaliyamoorthy

I’m currently working as a SQL server DBA in one of the top MNC. I’m passionate about SQL Server And I’m specialized in Administration and Performance tuning. I’m an active member of SQL server Central and MSDN forum. I also write articles in SQL server Central. For more Click here

More Posts - Website

Share this
2 Comments - Leave a comment
  1. Akemi says:

    thank you for your information, i like the website very much

Leave a comment

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="">

Current ye@r *


Welcome , today is Thursday, December 18, 2014