SQL Server 2008 Maintenance Plan Backup List

 ̄綄美尐妖づ 提交于 2020-02-05 05:12:28

问题


I'm working on a Maintenance Plan for doing Backups on my server. I just want to know if SQL Server maintains a list of the backup files that were created during the backup process?

Thanks a lot!


回答1:


USE DatabaseName
GO

SELECT 
s.database_name,
m.physical_device_name,
CAST(CAST(s.backup_size / 1000000 AS INT) AS VARCHAR(14)) + ' ' + 'MB' AS bkSize,
CAST(DATEDIFF(second, s.backup_start_date,
s.backup_finish_date) AS VARCHAR(4)) + ' ' + 'Seconds' TimeTaken,
s.backup_start_date,
CAST(s.first_lsn AS VARCHAR(50)) AS first_lsn,
CAST(s.last_lsn AS VARCHAR(50)) AS last_lsn,
CASE s.[type]
WHEN 'D' THEN 'Full'
WHEN 'I' THEN 'Differential'
WHEN 'L' THEN 'Transaction Log'
END AS BackupType,
s.server_name,
s.recovery_model
FROM msdb.dbo.backupset s
INNER JOIN msdb.dbo.backupmediafamily m ON s.media_set_id = m.media_set_id
WHERE s.database_name = DB_NAME() -- Remove this line for all the database
ORDER BY backup_start_date DESC, backup_finish_date
GO

By Pinal Dave SOURCE




回答2:


For get this information using SQL you can run the following query

USE msdb
Go
SELECT *
FROM backupfile

complete list of backup history tables and explation of each one can be foound on MSDN http://technet.microsoft.com/en-us/library/ms188062.aspx



来源:https://stackoverflow.com/questions/21292134/sql-server-2008-maintenance-plan-backup-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!