I would like to restore a database snapshot using SMO API calls, rather than using Transact-SQL (restore database <dbname> from database_snapshot = '<SnapshotName>') to do so. I've been searching through the Microsoft.SqlServer.Smo assembly without a whole lot of luck though. It doesn't appear that there is a Database.Restore('snapshotname') method, or anything like it.
If this post was helpful, please click the little "Vote as Helpful" button :)Trevor Sullivan
Trevor Sullivan's Tech Room
Hi Trevor,TechNet Subscriber Support
It seems there is not a method in SMO which can be used to restore the database snapshot directly. Issue the Transact-SQL command is a simple way to do this. You may have a look at the Volume Shadow Copy Service API about this type of usage: Introduction to the Volume Shadow Copy Service API in C++.
If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.
TechNet Community Support