常用脚本--查看数据库最近备份

常用脚本--查看数据库最近备份
--===========================================================================
--查看最近一次备份时间
SELECT D.name  AS DatabaseName,
FB.FullBackupTime,
LB.LogBackupTime
FROM master.sys.databases D 
INNER JOIN sys.database_mirroring dm 
on D.database_id=dm.database_id
AND (dm.mirroring_guid IS NULL OR dm.mirroring_role=1)
LEFT JOIN (
SELECT database_name AS DatabaseName, max(backup_finish_date)  AS FullBackupTime
FROM msdb.dbo.backupset B1
WHERE  B1.type=D
GROUP BY database_name, [type]) AS FB ON D.name=FB.DatabaseName
LEFT JOIN (
SELECT database_name AS DatabaseName, max(backup_finish_date)  AS LogBackupTime
FROM msdb.dbo.backupset B1
WHERE  B1.type=L
GROUP BY database_name, [type]) AS LB ON D.name=LB.DatabaseName
WHERE D.database_id>4
--============================================================================
常用脚本--查看数据库最近备份

常用脚本--查看数据库最近备份

上一篇:InfiniDB 修改一行的效率?


下一篇:Snapshot--使用Snapshot来还原数据库