Files
sql-scripts/EXPLOIT - check last full backup date.sql
Schork Thierry (Galenica - ADM) 63d058a7eb added files from swmgmt03
2025-09-22 09:00:00 +02:00

23 lines
675 B
Transact-SQL

USE master; -- Ensure you are connected to the master database
GO
-- Retrieve the last full backup date for the specified database
SELECT top 10
b.backup_start_date AS BackupDate,
CASE
WHEN b.type = 'D' THEN 'Full'
WHEN b.type = 'L' THEN 'Log'
ELSE 'Other'
END AS BackupType
FROM msdb.dbo.backupset b
INNER JOIN (
SELECT
database_name,
MAX(backup_start_date) AS last_backup_date
FROM msdb.dbo.backupset
WHERE database_name = 'arizona'
GROUP BY database_name
) maxb ON b.database_name = maxb.database_name
--AND b.backup_start_date = maxb.last_backup_date
and b.type = 'D'
order by backup_finish_date desc