Thursday, March 29, 2012

Backup status/timestamp

Hi,
I was wondering if anyone had a sql script that can pull the last backup
timestamp as displayed when you check database properties in Enterprise
manager.
Thanks
RustyThe data you're after is stored in msdb, a query like this :-
select top 1 *
from msdb..backupset
where database_name = 'pubs' and type = 'D'
order by backup_finish_date desc
Have a look in SQL BOL for an explanation to what all the columns mean.
HTH. Ryan
"Rusty" <Rusty@.discussions.microsoft.com> wrote in message
news:2183A80E-9299-431D-A9D2-26E318B13E8A@.microsoft.com...
> Hi,
> I was wondering if anyone had a sql script that can pull the last backup
> timestamp as displayed when you check database properties in Enterprise
> manager.
> Thanks
> Rusty|||Thanks!
I found this as well while googling.
http://searchsqlserver.techtarget.c...1178991,00.html
This is perfect cause I can code a Cold Fusion web page for the help desk to
monitor.
But Im having a devil of a time getting it to run. The table thats supposed
to be populated by the stored procedure keeps coming up with nothing in it.
#tmp is populating normally. #tmp2 was coming up with no rows either. I foun
d
what I thought was a bug where it refers to inserting data into #t instead o
f
#tmp. I changed #t to #tmp and now #tmp2 is showing at least a field but no
data.
Now Im stuck.
"Ryan" wrote:

> The data you're after is stored in msdb, a query like this :-
> select top 1 *
> from msdb..backupset
> where database_name = 'pubs' and type = 'D'
> order by backup_finish_date desc
> Have a look in SQL BOL for an explanation to what all the columns mean.
> --
> HTH. Ryan
>
> "Rusty" <Rusty@.discussions.microsoft.com> wrote in message
> news:2183A80E-9299-431D-A9D2-26E318B13E8A@.microsoft.com...
>
>

No comments:

Post a Comment