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


New-DbaDatabaseSnapshot

Creates database snapshots without hassles.

Screenshots

Examples

To create a snapshot for the HR and Accounting databases, returning a custom object displaying Server, Database, DatabaseCreated, SnapshotOf, SizeMB, DatabaseCreated, PrimaryFilePath, Status, Notes.

New-DbaDatabaseSnapshot -SqlServer sqlserver2014a -Database HR, Accounting

To create a snapshot for the HR and Accounting databases, returning a custom object displaying Server, Database, DatabaseCreated, SnapshotOf, SizeMB, DatabaseCreated, PrimaryFilePath, Status, Notes.

New-DbaDatabaseSnapshot -SqlServer sqlserver2014a -Database HR, Accounting

To create a snapshot named “HR_snap” for the HR database.

New-DbaDatabaseSnapshot -SqlServer sqlserver2014a -Databases HR -Name _snap

To create a snapshot named “fool_HR_snap” for the HR database.

New-DbaDatabaseSnapshot -SqlServer sqlserver2014a -Databases HR -Name ‘fool_{0}_snap

To create a snapshots for the HR and Accounting databases, storing files under the F:\snapshotpath\ directory.

New-DbaDatabaseSnapshot -SqlServer sqlserver2014a -Databases HR, Accounting -Path F:\snapshotpath

To create a snapshots with defaults names and locations for all databases

New-DbaDatabaseSnapshot -SqlServer sqlserver2014a -AllDatabases

Author

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

Get-Help

From PowerShell, execute Get-Help New-DbaDatabaseSnapshot -Detailed for more information on this function.

Source Code

Want to see the source code? View New-DbaDatabaseSnapshot.ps1 on GitHub
 

Related commands