when was the last time I restored a database from a database snapshot in the current server?
0
votes
0
answers
69
views
I generally create a database snapshot , depending on circumstances - in order to compare data before and after changes, or for an easy way to roll back changes, like for instance, an alter table.
I have recently had to roll back a considerate big change in one of our live systems
and I had a snapshot to use, and it was very quickly and effective way to recover the database to before the changes.
(let me stress that that database in particular was not involved in replication, otherwise it would not have been possible, without breaking the replication)
this script shows my last database restores :
WITH LastRestores AS
(
SELECT
DatabaseName = [d].[name] ,
[d].[create_date] ,
[d].[compatibility_level] ,
[d].[collation_name] ,
r.*,
RowNum = ROW_NUMBER() OVER (PARTITION BY d.Name ORDER BY r.[restore_date] DESC)
FROM master.sys.databases d
LEFT OUTER JOIN msdb.dbo.[restorehistory] r ON r.[destination_database_name] = d.Name
)
SELECT *
FROM [LastRestores]
WHERE [RowNum] = 1
order by restore_history_id desc
when I run the above script it does not show my restore from a database snapshot.
this is how I restore a database from a snapshot (example - snapshot previously created)
RESTORE DATABASE [PPROD_Milano_202407] FROM DATABASE_SNAPSHOT = 'PPROD_Milano_202407_SS';
how can I see when the database was last restored from a snapshot?
Asked by Marcello Miorelli
(17274 rep)
Sep 23, 2024, 12:07 PM