SQL Clone 3

Help for older versions available.

These pages cover SQL Clone 3, which is not the latest version. Help for other versions is also available.

Create a clone on all connected SQL Server instances

You may have a scenario in which you want a 'latest' copy of a database to be available on all SQL Server instances which are registered with SQL Clone.

  1. Connect-SqlClone -ServerUrl 'http://sql-clone.example.com:14145'
  2. $SourceDataImage = Get-SqlCloneImage -Name 'ImageName'
  3. $CloneName = 'ImageName_Latest'
  4.  
  5. # I have multiple SQL Server instances registered on my SQL Clone Server - I want to deliver a copy to all of them
  6. $Destinations = Get-SqlCloneSqlServerInstance
  7.  
  8. # Start a timer
  9. $elapsed = [System.Diagnostics.Stopwatch]::StartNew()
  10. "Started at {0}, creating clone databases for image ""{1}""" -f $(get-date) , $SourceDataImage.Name
  11. foreach ($Destination in $Destinations)
  12. {
  13. $SourceDataImage | New-SqlClone -Name $CloneName -Location $Destination | Wait-SqlCloneOperation
  14. $ServerInstance = $Destination.Server + '\' +$Destination.Instance
  15. "Created clone in instance {0}" -f $Destination.Server + '\' + $Destination.Instance;
  16. }
  17. "Total Elapsed Time: {0}" -f $($elapsed.Elapsed.ToString())
  18.  

Didn't find what you were looking for?