These pages cover SQL Clone Beta 0.6 to 0.9, which is not the latest version. Help for other versions is also available.
New-SqlClone
Starts creating a clone from an image.
Syntax
New-SqlClone [-Image] <ImageResource> [-Name] <string> [-Location] <SqlServerInstanceResource> [<CommonParameters>]
Description
The New-SqlClone cmdlet starts creating a clone from an image and outputs details of the creation operation.
This cmdlet returns a OperationResource which can be passed to the Wait-SqlCloneOperation cmdlet.
Connect-SqlClone must be called before this cmdlet.
Parameters
-Image
<RedGate.SqlClone.Client.Api.Objects.ImageResource>
Specifies the parent image that will be cloned. The Get-SqlCloneImage cmdlet can be used to get an ImageResource.
Aliases | None |
Required? | true |
Position? | 0 |
Default Value | None |
Accept Pipeline Input | true (ByValue) |
Accept Wildcard Characters | false |
-Name
<System.String>
Specifies the database name of the clone. This needs to be a unique database name within the specified SQL Server instance. This value has a maximum length of 128 characters.
Aliases | None |
Required? | true |
Position? | 1 |
Default Value | None |
Accept Pipeline Input | false |
Accept Wildcard Characters | false |
-Location
<RedGate.SqlClone.Client.Api.Objects.SqlServerInstanceResource>
Specifies the SQL Server instance that the clone will be created on. The Get-SqlCloneSqlServerInstance cmdlet can be used to get a SqlServerInstanceResource.
Aliases | None |
Required? | true |
Position? | 2 |
Default Value | None |
Accept Pipeline Input | false |
Accept Wildcard Characters | false |
<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.
-
RedGate.SqlClone.Client.Api.Objects.ImageResource
Specifies the parent image that will be cloned. The Get-SqlCloneImage cmdlet can be used to get an ImageResource.
Return values
The output type is the type of the objects that the cmdlet emits.
- RedGate.SqlClone.Client.Api.Objects.OperationResource
Examples
---------- EXAMPLE 1 ----------
Connect-SqlClone -ServerUrl 'http://sql-clone.example.com:14145' $Image = Get-SqlCloneImage -Name 'AdventureWorks-20170106110745' $SqlServerInstance = Get-SqlCloneSqlServerInstance -MachineName WIN201601 -InstanceName SQL2014 New-SqlClone -Name 'AdventureWorks-clone1' -Location $SqlServerInstance -Image $Image
This example starts creating a new clone named 'AdventureWorks-clone1' on WIN201601\SQL2014 based on the image named 'AdventureWorks-20170106110745'.
---------- EXAMPLE 2 ----------
Connect-SqlClone -ServerUrl 'http://sql-clone.example.com:14145' $Image = Get-SqlCloneImage -Name 'AdventureWorks-20170106110745' $SqlServerInstance = Get-SqlCloneSqlServerInstance -MachineName WIN201601 -InstanceName SQL2014 $Image | New-SqlClone -Name 'AdventureWorks-clone1' -Location $SqlServerInstance | Wait-SqlCloneOpeeration
This example uses the pipeline operator to create a new clone and waits for the creation to complete before returning.