dbatools is a free PowerShell module with over 200 SQL Server administration, best practice and migration commands included.

Please note that documentation and command names may be out of date while we work furiously towards 1.0


Restore-DbaFromDatabaseSnapshot

Restores the database from the snapshot, discarding every modification made to the database
NB: Restoring to a snapshot will result in every other snapshot of the same database to be dropped. It also fixes some long-standing bugs in SQL Server when restoring from snapshots.

Screenshots

Examples

To Restore the HR and Accounting databases using the latest snapshot available.

Restore-DbaFromDatabaseSnapshot -SqlServer sqlserver2014a -Databases HR, Accounting

To restore the databases from snapshots named HR_snap_20161201 and Accounting_snap_20161101.

Restore-DbaFromDatabaseSnapshot -SqlServer sqlserver2014a -Snapshots HR_snap_20161201, Accounting_snap_20161101

Author

This command was created by Simone Bizzotto. You can find Simone on LinkedIn.

Get-Help

From PowerShell, execute Get-Help Restore-DbaFromDatabaseSnapshot -Detailed for more information on this function.

Source Code

Want to see the source code? View Restore-DbaFromDatabaseSnapshot.ps1 on GitHub
 

Related commands