Redgate SQL Instant Clone Alpha

Introduction

This is an alpha release of SQL Instant Clone by Redgate Software. This is a limited alpha release for your personal use only – please don't distribute! This is an early version, so don't use it in production or on important systems.
SQL Instant Clone is a technology for creating many 'clones' of a Microsoft SQL Server database. These clones appear in a few seconds, use little disk space, and are independent of each other. You can use these clones just like any other SQL Server database. In each clone, it only stores the difference between the clone and the original snapshot.
Instant Clone can be used from PowerShell or from the command-line. The functionality is roughly the same.
Let us know how you get on! Email Richard.Macaskill@Red-Gate.com or Jason.Crease@Red-Gate.com with your thoughts.

Using the PowerShell cmdlets

The installer automatically sets up PowerShell to use the module located at: C:\Program Files (x86)\Red Gate\Instant Clone X.Y.Z\Modules\. Run the PowerShell command-line or ISE as an administrator. Use the cmdlets like this. Finish all invocations with –Verbose to see debug output.
# Set connection string for use by Instant Clone. Only need to do this the first time
Initialize-InstantCloneConnectionString -ConnectionString "Server=JOHNSMITHTEST\sql2012;Trusted_Connection=True" -Verbose
# Save a snapshot of my WidgetProd database to disk
Save-InstantCloneSnapshot -DatabaseName WidgetProd -SnapshotName WidgetSnp1 -Verbose
# Create a couple of clones from the WidgetSnp1 snapshot
New-InstantCloneClone -NewDatabaseName WidgetClone1 -SnapshotName WidgetSnp1 -Verbose
New-InstantCloneClone -NewDatabaseName WidgetClone2 -SnapshotName WidgetSnp1 -Verbose
# I'm bored with these clones now. Let's drop them
Remove-InstantCloneClone -CloneName WidgetClone1 -Verbose
Remove-InstantCloneClone -CloneName WidgetClone2 -Verbose
# Let's drop that snapshot too
Remove-InstantCloneSnapshot -SnapshotName WidgetSnp1 -Verbose

When you restart your machine, clone databases will be offline until you run the restore cmdlet:
Restore-InstantClone -Verbose
See all the clones and snapshots with the Show-InstantCloneSnapshots/Clones cmdlets
Show-InstantCloneSnapshots -Verbose
Show-InstantCloneClones -Verbose
See all cmdlets available with the Get-Command cmdlet:
Get-Command -Module RedGate.InstantClone.PowerShell

Sharing a snapshot using the PowerShell cmdlets

You may want to create a snapshot on one machine, but clone it on another. To do this, setup the
On the source machine:

  1. Setup your shared folder with the Save-InstantCloneOptions cmdlet:

Save-InstantCloneOptions -SharedSnapshotFolder [\\myServer\SharedSnapshots|\\myServer\SharedSnapshots] -Verbose

  1. Create a snapshot as usual with the Save-InstantCloneSnapshot cmdlet:

Save-InstantCloneSnapshot -DatabaseName AdventureWorks -SnapshotName AdvSnap -Verbose

  1. Run the Save-InstantCloneSharedSnapshot cmdlet. This will copy your Snapshot into the shared-directory so it can be accessed by others.

Save-InstantCloneSharedSnapshot -SnapshotName AdvSnap -NewSnapshotName AdvSnapShared
A shared-snapshot can listed/deleted/cloned just like any other snapshot.
On the target machine:

  1. Setup your shared folder with the Save-InstantCloneOptions cmdlet:

Save-InstantCloneOptions -SharedSnapshotFolder [\\myServer\SharedSnapshots|\\myServer\SharedSnapshots] -Verbose

  1. (Optional) Run Show-InstantCloneSnapshot cmdlet. AdvSnapShared is listed.

Show-InstantCloneSnapshots -Verbose

  1. Run the New-InstantCloneClone cmdlet to create a new clone from the shared-snapshot.

New-InstantCloneClone -SnapshotName AdvSnapShared -NewDatabaseName AdvClone -Verbose

Using the command-line

  1. Open an Administrator command-prompt. Go to C:\Program Files (x86)\Red Gate\Instant Clone Alpha\ and run rgclone.exe to see the options.
  2. Firstly, use connect to specify a ConnectionString which will be stored by Instant Clone.

>rgclone.exe connect –c "Data Source=JOHNSMITHTEST\SQL2012;Integrated Security=True;"
JOHNSMITH\SQL2012 will now be used as the Server for subsequent queries.

  1. Snapshot a database using the snapshot verb. This stores a snapshot of your database to disk. This operation may take a long time for large databases (eg a few minutes for a 5Gb database). The snapshot will be roughly the same size as the original database.

>rgclone snapshot -d AdventureWorks -s AdvSnap1
Snapshot mode : Full backup
Source database : Data Source=JOHNSMITHTEST\SQL2012;Integrated Security=True;
Snapshot folder : d:\snapshots
Snapshotting database [AdventureWorks] as 'AdvSnap1'
Snapshot complete

  1. Clone this snapshot to a new database using the clone verb. This creates a new database which is identical to the original database. It will take a few seconds to be created and use a few megabytes of disk space, regardless of the snapshot size.

>rgclone clone -s AdvSnap1 –n AdvClone1
Clone connection string : Data Source= JOHNSMITHTEST\SQL2012;Integrated Security=True;
Clone folder : d:\clones
Cloning snapshot 'AdvSnap1' as new database [AdvClone1]

  1. You can clone as many new databases as you like. These can all be used and edited without affecting each other, or the original snapshot.

>rgclone clone -s AdvSnap1 –n AdvClone2
>rgclone clone -s AdvSnap1 –n AdvClone3
...

  1. When you're done with the clones, delete them with the drop clone verb.

>rgclone drop clone AdvClone1

  1. When you're done with the snapshot, delete it with the drop snapshot verb.

>rgclone drop snapshot AdvSnap1

  1. When you restart your machine, your clone databases will be offline. Bring them online with the restore verb.

>rgclone restore

Important Tips


Space and Time


Contact

Email richard.macaskill@red-gate.com

Licensing

Read https://www.red-gate.com/assets/purchase/assets/license.pdf . Remember, this product is an experimental product for your own use only.