检索SQL Server数据库备份记录
2008-10-28 10:09:18 来源:WEB开发网 -------------------------------------------------------------------------------------------
--MostRecentDatabaseBackupforEachDatabase-Detailed
-------------------------------------------------------------------------------------------
SELECT
A.[Server],
A.last_db_backup_date,
B.backup_start_date,
B.expiration_date,
B.backup_size,
B.logical_device_name,
B.physical_device_name,
B.backupset_name,
B.description
FROM
(
SELECT
CONVERT(CHAR(100),SERVERPROPERTY('Servername'))ASServer,
msdb.dbo.backupset.database_name,
MAX(msdb.dbo.backupset.backup_finish_date)ASlast_db_backup_date
FROMmsdb.dbo.backupmediafamily
INNERJOINmsdb.dbo.backupsetONmsdb.dbo.backupmediafamily.media_set_id=msdb.dbo.backupset.media_set_id
WHEREmsdb..backupset.type='D'
GROUPBY
msdb.dbo.backupset.database_name
)ASA
LEFTJOIN
(
SELECT
CONVERT(CHAR(100),SERVERPROPERTY('Servername'))ASServer,
msdb.dbo.backupset.database_name,
msdb.dbo.backupset.backup_start_date,
msdb.dbo.backupset.backup_finish_date,
msdb.dbo.backupset.expiration_date,
msdb.dbo.backupset.backup_size,
msdb.dbo.backupmediafamily.logical_device_name,
msdb.dbo.backupmediafamily.physical_device_name,
msdb.dbo.backupset.nameASbackupset_name,
msdb.dbo.backupset.description
FROMmsdb.dbo.backupmediafamily
INNERJOINmsdb.dbo.backupsetONmsdb.dbo.backupmediafamily.media_set_id=msdb.dbo.backupset.media_set_id
WHEREmsdb..backupset.type='D'
)ASB
ONA.[server]=B.[server]ANDA.[database_name]=B.[database_name]ANDA.[last_db_backup_date]=B.[backup_finish_date]
ORDERBY
A.database_name
- ››sql server自动生成批量执行SQL脚本的批处理
- ››sql server 2008亿万数据性能优化
- ››SQL Server 2008清空数据库日志方法
- ››sqlserver安装和简单的使用
- ››SQL Sever 2008 R2 数据库管理
- ››SQL SERVER无法安装成功,sqlstp.log文件提示[未发...
- ››Sql Server中通过父记录查找出所有关联的子记录
- ››SqlServer触发器、存储过程和函数
- ››SQL Server 中的事务(含义,属性,管理)
- ››Sqlite数据库插入和读取图片数据
- ››Sql server 2005拒绝了对对象 'xx表' (数...
- ››Sql server 2005拒绝了对对象 'xx表' (数...
更多精彩
赞助商链接