These pages cover SQL Clone Technical Preview 0.2 to 0.3, which is not the latest version. Help for other versions is also available.

Remove-InstantCloneSnapshot

Remove the InstantClone snapshot.

Syntax

Remove-InstantCloneSnapshot -SnapshotName <string> [-SharedSnapshot] [<CommonParameters>]

Remove-InstantCloneSnapshot -All [-SharedSnapshot] [<CommonParameters>]

Remove-InstantCloneSnapshot -SnapshotId <string> [-SharedSnapshot] [<CommonParameters>]

Description

This deletes the snapshot file. You cannot delete a snapshot with clones.

Parameters

-SnapshotName <System.String>

The name of the snapshot to remove. If there are multitple snapshots with the same name, the most recent one is removed.

Aliases None
Required?true
Position?named
Default Value None
Accept Pipeline Inputfalse
Accept Wildcard Charactersfalse

-SharedSnapshot <System.Management.Automation.SwitchParameter>

If it is a shared snapshot, you must include this switch.

Aliases None
Required?false
Position?named
Default ValueFalse
Accept Pipeline Inputfalse
Accept Wildcard Charactersfalse

-All <System.Management.Automation.SwitchParameter>

Remove all snapshots with no clones. Warning: This may remove shared snapshots that are used by other clients.

Aliases None
Required?true
Position?named
Default ValueFalse
Accept Pipeline Inputfalse
Accept Wildcard Charactersfalse

-SnapshotId <System.String>

The Id of the snapshot you want to remove.

Aliases None
Required?true
Position?named
Default Value None
Accept Pipeline Inputfalse
Accept Wildcard Charactersfalse

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see http://technet.microsoft.com/en-us/library/hh847884.aspx.

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • None.
    You cannot pipe input to this cmdlet.

Return values

The output type is the type of the objects that the cmdlet emits.

  • None.
    You cannot pipe input to this cmdlet.

Examples

---------- EXAMPLE 1 ----------

Remove-InstantCloneSnapshot -SnapshotName AdvSnap1

This drops the snapshot AdvSnap1.

---------- EXAMPLE 2 ----------

Save-InstantCloneSnapshot   -DatabaseName AdvWorks2012 -SnapshotName AdvSnap1 -PutInSharedFolder -Verbose
Remove-InstantCloneSnapshot -SnapshotName AdvSnap1 -SharedSnapshot

This shows creating a shared snapshot, and then removing it. When removing shared snapshots, you must specify -SharedSnapshot.

---------- EXAMPLE 3 ----------

Save-InstantCloneSnapshot   -SnapshotName AdvSnap1   -DatabaseName    AdvWorks2012 -Verbose
New-InstantCloneClone       -SnapshotName AdvSnap1   -NewDatabaseName AdvClone1    -Verbose
Remove-InstantCloneClone    -CloneName    AdvClone1                                -Verbose
Remove-InstantCloneSnapshot -SnapshotName AdvSnap1                                 -Verbose

This shows a full-cycle of AdvWorks2012. (1) AdvWorks2012 is saved as a snapshot. (2) This is cloned as AdvClone1 (3) This clone if removed. (4) The snapshot is no longer needed, so is removed.

---------- EXAMPLE 4 ----------

Save-InstantCloneSnapshot   -DatabaseName AdvWorks2012 -SnapshotName AdvSnap1     -Verbose
Save-InstantCloneSnapshot   -DatabaseName AdvWorks2012 -SnapshotName AdvSnap2     -Verbose
Save-InstantCloneSnapshot   -DatabaseName AdvWorks2012 -SnapshotName AdvSnap3     -Verbose
New-InstantCloneClone       -SnapshotName AdvSnap2   -NewDatabaseName AdvClone2   -Verbose 
Remove-InstantCloneSnapshots -All -Verbose

This creates three snapshots, and creates a clone from one of them. Remove-InstantCloneSnapshots -All will remove snapshots AdvSnap1 and AdvSnap3, leaving AdvSnap2 because it has a clone. Shared snapshots and local snapshots must be done separately; use the -SharedSnapshot switch.

  • No labels