Ver Mensaje Individual
  #5 (permalink)  
Antiguo 23/09/2015, 13:49
Avatar de iislas
iislas
Colaborador
 
Fecha de Ingreso: julio-2007
Ubicación: Mexico, D.F.
Mensajes: 6.482
Antigüedad: 17 años, 4 meses
Puntos: 180
Respuesta: Saber ubicación backup

Cita:
Código SQL:
Ver original
  1. SELECT
  2.    A.[Server],
  3.    A.last_db_backup_date,
  4.    B.backup_start_date,
  5.    B.expiration_date,
  6.    B.backup_size,
  7.    B.logical_device_name,
  8.    B.physical_device_name,  
  9.    B.backupset_name,
  10.    B.description
  11. FROM
  12.    (
  13.    SELECT  
  14.        CONVERT(CHAR(100), SERVERPROPERTY('Servername')) AS Server,
  15.        msdb.dbo.backupset.database_name,
  16.        MAX(msdb.dbo.backupset.backup_finish_date) AS last_db_backup_date
  17.    FROM    msdb.dbo.backupmediafamily
  18.        INNER JOIN msdb.dbo.backupset ON msdb.dbo.backupmediafamily.media_set_id = msdb.dbo.backupset.media_set_id
  19.    WHERE   msdb..backupset.TYPE = 'D'
  20.    GROUP BY
  21.        msdb.dbo.backupset.database_name
  22.    ) AS A
  23.    
  24.    LEFT JOIN
  25.  
  26.    (
  27.    SELECT  
  28.    CONVERT(CHAR(100), SERVERPROPERTY('Servername')) AS Server,
  29.    msdb.dbo.backupset.database_name,
  30.    msdb.dbo.backupset.backup_start_date,
  31.    msdb.dbo.backupset.backup_finish_date,
  32.    msdb.dbo.backupset.expiration_date,
  33.    msdb.dbo.backupset.backup_size,
  34.    msdb.dbo.backupmediafamily.logical_device_name,
  35.    msdb.dbo.backupmediafamily.physical_device_name,  
  36.    msdb.dbo.backupset.name AS backupset_name,
  37.    msdb.dbo.backupset.description
  38. FROM   msdb.dbo.backupmediafamily
  39.    INNER JOIN msdb.dbo.backupset ON msdb.dbo.backupmediafamily.media_set_id = msdb.dbo.backupset.media_set_id
  40. WHERE  msdb..backupset.TYPE = 'D'
  41.    ) AS B
  42.    ON A.[server] = B.[server] AND A.[database_name] = B.[database_name] AND A.[last_db_backup_date] = B.[backup_finish_date]
  43. ORDER BY
  44.    A.database_name
__________________
MCTS Isaias Islas