/*
We had to restore a full backup and a differential backup a while ago
To a local db to get some old data put back into the live database.
my manager & I had a heck of a time trying to find out where someone put the last back up.
This query helped us know a utility was still backing up to another location AFTER the job ran...
hence all the extents the DIFF were looking for were bye-bye into the rogue, full-backup.
*/
-------------copy below this line-----------------------
declare
@startDate DATETIME,
@endDate DATETIME,
@database sysname
-- enter your database and date range here:
select
@database = 'SSRC_V5SP1-2',
@startDate = '09/28/09',
@endDate = '09/30/09'
SELECT b.database_name,
b.backup_start_date,
b.backup_finish_date,
b.user_name,
f.logical_name,
f.physical_name,
mf.physical_device_name,
f.file_type,
f.file_size,
b.backup_size
FROM msdb.dbo.backupfile f,
msdb.dbo.backupset b,
msdb.dbo.backupmediafamily mf
WHERE f.backup_set_id = b.backup_set_id
AND b.media_set_id = mf.media_set_id
AND b.backup_start_date BETWEEN @startDate
AND @endDate
AND b.database_name = COALESCE
(@database,database_name)
ORDER BY b.database_name,
b.backup_start_date
No comments:
Post a Comment