[SCRIPT] – Ultimo Restore Eseguito

Script per verificare la ultima volta che è stato eseguito un Restore in un Database specifico.

declare @database varchar(50)
set @database = 'NOME_DATABASE'
SELECT rsh.destination_database_name AS [Database]
,rsh.user_name AS [Restored By]
,rsh.restore_date AS [Restore Started]
,bmf.physical_device_name AS [Restored From]
,rf.destination_phys_name AS [Restored To]
FROM msdb.dbo.restorehistory rsh
INNER JOIN msdb.dbo.backupset bs
ON rsh.backup_set_id = bs.backup_set_id
INNER JOIN msdb.dbo.restorefile rf
ON rsh.restore_history_id = rf.restore_history_id
INNER JOIN msdb.dbo.backupmediafamily bmf
ON bmf.media_set_id = bs.media_set_id
where rsh.destination_database_name = @database
and rsh.restore_type = 'D'
ORDER BY rsh.restore_date DESC

A dopo!

Chi Sono

Bruno Bragatto è laureato in Automazione Industriale nell’IFSP (San Paolo – Brasile), con specializzazione in Database nella FIAP (San Paolo – Brasile) e è certificato Oracle Database 11g Administrator Certified Associate e Microsoft MCSA – SQL 2016 Database Administration.

OCA - Oracle 11g Database Administrator