Przedstawiam skrypt, który wyświetla informacje o wykonywanych kopiach baz danych.
SELECT DISTINCT [Baza] = bs.database_name ,[Start] = bs.backup_start_date ,[Koniec] = bs.backup_finish_date ,[Razem_s] = CAST((DATEDIFF(second, bs.backup_start_date, bs.backup_finish_date)) AS VARCHAR) + ' sekund' ,[Razem_m] = CAST((DATEDIFF(minute, bs.backup_start_date, bs.backup_finish_date)) AS VARCHAR) + ' minut' ,[Rozmiar_MB] = CAST(bs.backup_size / 1024 / 1024 AS NUMERIC(9, 2)) ,[Typ] = CASE bs.type WHEN 'D' THEN 'Full' WHEN 'I' THEN 'Differential' WHEN 'L' THEN 'Transaction Log' END ,[Nazwa] = bs.NAME ,[Gdzie] = bmf.physical_device_name FROM msdb.dbo.backupmediafamily bmf INNER JOIN msdb.dbo.backupset bs ON bs.media_set_id = bmf.media_set_id --AND bs.backup_start_date > '2017-10-17' ORDER BY bs.backup_start_date ,bs.database_name