Database cannot be reverted. Either the primary or the snapshot names are improperly specified, all other snapshots have not been dropped, or there are missing files.

I was trying to revert a database to a database snapshot using below TSQL and got below error. After reading MS docs I came to know that , we need to drop any other database snapshots before restoring.

use master
RESTORE DATABASE test from
DATABASE_SNAPSHOT = ‘test_snapshot5 ‘
GO


————————-$$$$$$$$$$$$$$$$$$——————————-

TSQL to create snapshot:

--use master
CREATE DATABASE test_snapshot6 ON( NAME = test, FILENAME ='C:\Users\xxxxxy\Desktop\delete\test_snapshot6.ss' )
AS SNAPSHOT OF test
GO

some more facts about Snapshots : Reasons to why we can’t use snapshots instead of native SQL backups.

  1. Database snapshot on the system databases are not allowed.
  2. can’t create database snapshot on different server. it should remain on the same server instance as the source database
  3. if the database is offline or corrupted, we can’t access Snapshots. will get error like below one