Home All Groups Group Topic Archive Search About

how to find media name of the last successful backup via SMO

Author
29 Mar 2007 7:40 PM
ktmd
Would you show me how to use SMO to find the name of the media of the last
succesful backup via SMO?

I use maintenance plan to do backup.  I need to find the name of the media
(backup file) that was created for the last backup.

thanks,
ktm

Author
4 Apr 2007 4:56 PM
ktmd
I did not get a response to my question.  I am not sure if my question was
not clear enough, or SMO has no support for what I need.  Anyway below is the
query in SQL 2005 that i think can provide the correct device name of the
last backup of a database.  I need an easier way via SMO to find the device
name.

select top 1 database_name, backup_set_id, type, physical_device_name
'DeviceName'
  ,backup_start_date Start, backup_finish_date Finish
  ,is_damaged 'Damaged', has_incomplete_metadata 'Incomplete'
  FROM msdb..backupmediafamily f, msdb..backupset s
where upper(database_name) = 'ADVENTUREWORKS'
and f.media_set_id = s.media_set_id
order by backup_finish_date desc

thanks,
ktm

Show quote
"ktmd" wrote:

> Would you show me how to use SMO to find the name of the media of the last
> succesful backup via SMO?
>
> I use maintenance plan to do backup.  I need to find the name of the media
> (backup file) that was created for the last backup.
>
> thanks,
> ktm
>

AddThis Social Bookmark Button