PVI_COPY

11_1_2_SQLServer_Резервное копирование

Apr 12th, 2021
178
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. -- 11_1_2_SQLServer_Резервное копирование
  3.  
  4. --Набор скриптов для знакомства с SQL Server
  5. --https://infostart.ru/1c/articles/1128594/
  6.  
  7.  
  8. SELECT  @@Servername AS ServerName ,
  9.         d.Name AS DBName ,
  10.         MAX(b.backup_finish_date) AS LastBackupCompleted
  11. FROM    sys.databases d
  12.         LEFT OUTER JOIN msdb..backupset b
  13.                     ON b.database_name = d.name
  14.                        AND b.[type] = 'D'
  15. GROUP BY d.Name
  16. ORDER BY d.Name;
  17.  
  18.  
  19. SELECT  @@Servername AS ServerName ,
  20.         d.Name AS DBName ,
  21.         b.Backup_finish_date ,
  22.         bmf.Physical_Device_name
  23. FROM    sys.databases d
  24.         INNER JOIN msdb..backupset b ON b.database_name = d.name
  25.                                         AND b.[type] = 'D'
  26.         INNER JOIN msdb.dbo.backupmediafamily bmf ON b.media_set_id = bmf.media_set_id
  27. ORDER BY d.NAME ,
  28.         b.Backup_finish_date DESC;
RAW Paste Data