Last active
January 6, 2017 20:04
-
-
Save JosiahSiegel/2e9977c6a57ab539999f to your computer and use it in GitHub Desktop.
#MSSQL #Research #Backup Full Backups for all databases For Previous Week
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
CONVERT(CHAR(100), SERVERPROPERTY('Servername')) AS Server, | |
msdb.dbo.backupset.user_name, | |
msdb.dbo.backupset.database_name, | |
cast(msdb.dbo.backupset.backup_start_date as datetime2(0)) as 'backup_start_date', | |
cast(msdb.dbo.backupset.backup_finish_date as datetime2(0)) as 'backup_finish_date', | |
cast(msdb.dbo.backupset.expiration_date as datetime2(0)) as 'expiration_date', | |
CASE msdb..backupset.type | |
WHEN 'D' THEN 'Database' | |
WHEN 'L' THEN 'Log' | |
END AS backup_type, | |
msdb.dbo.backupset.backup_size, | |
msdb.dbo.backupmediafamily.logical_device_name, | |
msdb.dbo.backupmediafamily.physical_device_name, | |
msdb.dbo.backupset.name AS backupset_name, | |
msdb.dbo.backupset.description | |
FROM msdb.dbo.backupmediafamily | |
INNER JOIN msdb.dbo.backupset ON msdb.dbo.backupmediafamily.media_set_id = msdb.dbo.backupset.media_set_id | |
WHERE (CONVERT(datetime, msdb.dbo.backupset.backup_start_date, 102) >= GETDATE() - 7) | |
AND msdb..backupset.type = 'D' | |
ORDER BY | |
msdb.dbo.backupset.database_name, | |
msdb.dbo.backupset.backup_finish_date |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment