Finding Restore and Backup dates | SansSQL

Wednesday, December 10, 2008

Finding Restore and Backup dates

/*Works for both SQL 2000 and SQL 2005 */

USE msdb

GO

SELECT
destination_database_name AS DBRestored ,
restore_date AS RestoreDate ,
RH.USER_NAME AS RestoredBY,
BS.name AS BackupName,
BS.USER_NAME AS DBBackedUpBY,
BS.server_name SourceServerName,
BackupType= CASE
                       when BS.type='D'  Then 'Database '
                       when BS.type='I'   Then 'Differential database'
                       when BS.type='L'  Then 'Log'
                       when BS.type='F'  Then 'File or filegroup'
                       when BS.type='G'  Then 'Differential file'
                       when BS.type='P'  Then 'Partial '
                       when BS.type='Q'  Then 'Differential partial '
END,
BS.database_name AS SourceDB,
physical_name AS SourceFile,
backup_start_date AS BackupDate
FROM RestoreHistory RH
INNER JOIN BackupSet BS
ON RH.backup_set_id = BS.backup_set_id
INNER JOIN BackupFile BKF
ON BKF.backup_set_id = BS.backup_set_id
WHERE destination_database_name='pubs'
ORDER BY RestoreDate

3 comments:

Huongkvb said...

Đặt vé tại phòng vé Aivivu, tham khảo

vé máy bay đi Mỹ tháng nào rẻ nhất

chuyến bay từ mỹ về việt nam

khi nào có chuyến bay từ đức về việt nam

ve may bay tu nga ve viet nam

lịch bay từ anh về việt nam hôm nay

chuyến bay từ pháp về việt nam

ve may bay chuyen gia nuoc ngoai

MartenJames said...

To read your article, now we can get backup dates easily. moreover, we have highly trained Alzheimer’s Care Services in Villages FL experts. Safety has always been on priority for us.

Gabby said...

The support for the keen machine and alloy is MT for the valued items for people. The judgment of the tech support austin tx is implied for the rates. Suggestion formed for goals. Passage is filed for the content production for humans.

Post a Comment

Ads