Author | Simone Bizzotto (@niphold) |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Remove-DbaDbSnapshot on GitHub.
Want to see the Bill Of Health for this command? Check out Remove-DbaDbSnapshot.
Removes database snapshots
Removes (drops) database snapshots from the server
Remove-DbaDbSnapshot
[[-SqlInstance] <DbaInstanceParameter[]>]
[[-SqlCredential] <PSCredential>]
[[-Database] <String[]>]
[[-ExcludeDatabase] <String[]>]
[[-Snapshot] <String[]>]
[[-InputObject] <Database[]>]
[-AllSnapshots]
[-Force]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
PS C:\> Remove-DbaDbSnapshot -SqlInstance sql2014 -Snapshot HR_snap_20161201, HR_snap_20161101
Removes database snapshots named HR_snap_20161201 and HR_snap_20161101
PS C:\> Remove-DbaDbSnapshot -SqlInstance sql2014 -Database HR, Accounting
Removes all database snapshots having HR and Accounting as base dbs
PS C:\> Get-DbaDbSnapshot -SqlInstance sql2014 -Database HR, Accounting | Remove-DbaDbSnapshot
Removes all database snapshots having HR and Accounting as base dbs
PS C:\> Remove-DbaDbSnapshot -SqlInstance sql2014 -Snapshot HR_snapshot, Accounting_snapshot
Removes HR_snapshot and Accounting_snapshot
PS C:\> Get-DbaDbSnapshot -SqlInstance sql2016 | Where-Object SnapshotOf -like '*dumpsterfire*' | Remove-DbaDbSnapshot
Removes all snapshots associated with databases that have dumpsterfire in the name
PS C:\> Get-DbaDbSnapshot -SqlInstance sql2016 | Out-GridView -PassThru | Remove-DbaDbSnapshot
Allows the selection of snapshots on sql2016 to remove
PS C:\> Remove-DbaDbSnapshot -SqlInstance sql2014 -AllSnapshots
Removes all database snapshots from sql2014
PS C:\> Remove-DbaDbSnapshot -SqlInstance sql2014 -AllSnapshots -Confirm
Removes all database snapshots from sql2014 and prompts for each database
The target SQL Server instance or instances
Alias | |
Required | False |
Pipeline | false |
Default Value |
Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.
For MFA support, please use Connect-DbaInstance.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Removes snapshots for only this specific base db
Alias | |
Required | False |
Pipeline | false |
Default Value |
Removes snapshots excluding this specific base dbs
Alias | |
Required | False |
Pipeline | false |
Default Value |
Restores databases from snapshot with this name only
Alias | |
Required | False |
Pipeline | false |
Default Value |
Enables input from Get-DbaDbSnapshot
Alias | |
Required | False |
Pipeline | true (ByValue) |
Default Value |
Specifies that you want to remove all snapshots from the server
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Will forcibly kill all running queries that prevent the drop process.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Shows what would happen if the command were to run
Alias | wi |
Required | False |
Pipeline | false |
Default Value |
Prompts for confirmation of every step.
Alias | cf |
Required | False |
Pipeline | false |
Default Value |