Starts creating a new image from either a live dabase or backup.
New-SqlCloneImage [-Name] <string> [-SqlServerInstance] <SqlServerInstanceResource> [-DatabaseName] <string> [-Destination] <ImageLocationResource> [<CommonParameters>] New-SqlCloneImage [-Name] <string> [-BackupLocation] <BackupLocationResource> [-BackupFileName] <string[]> [-Destination] <ImageLocationResource> [<CommonParameters>] |
The New-SqlCloneImage cmdlet starts creating a new image from either a live dabase or backup 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.
-Name
<System.String>
Specifies the name of the image.
Aliases | None |
Required? | true |
Position? | 0 |
Default Value | None |
Accept Pipeline Input | false |
Accept Wildcard Characters | false |
-SqlServerInstance
<RedGate.SqlClone.Client.Api.Objects.SqlServerInstanceResource>
Specifies the SQL Server instance that the source database is on. The Get-SqlCloneSqlServerInstance cmdlet can be used to get a SqlServerInstanceResource.
You can't use this parameter in addition to the BackupLocation and BackupFileName parameters.
Aliases | None |
Required? | true |
Position? | 1 |
Default Value | None |
Accept Pipeline Input | true (ByValue) |
Accept Wildcard Characters | false |
-DatabaseName
<System.String>
Specifies the name of the database to be used as the source for the image.
You can't use this parameter in addition to the BackupLocation and BackupFileName parameters.
Aliases | None |
Required? | true |
Position? | 2 |
Default Value | None |
Accept Pipeline Input | false |
Accept Wildcard Characters | false |
-BackupLocation
<RedGate.SqlClone.Client.Api.Objects.BackupLocationResource>
Specifies location of the backup files. The Get-SqlCloneBackupLocation cmdlet can be used to get a BackupLocationResource.
You can't use this parameter in addition to the SqlServerInstance and DatabaseName parameters.
Aliases | None |
Required? | true |
Position? | 1 |
Default Value | None |
Accept Pipeline Input | true (ByValue) |
Accept Wildcard Characters | false |
-BackupFileName
<System.String[]>
Specifies the name of the database to be used as the source for the image.
You can't use this parameter in addition to the SqlServerInstance and DatabaseName parameters.
Aliases | None |
Required? | true |
Position? | 2 |
Default Value | None |
Accept Pipeline Input | false |
Accept Wildcard Characters | false |
-Destination
<RedGate.SqlClone.Client.Api.Objects.ImageLocationResource>
Specifies where the image will be stored. The Get-SqlCloneImageLocation cmdlet can be used to get an ImageLocationResource
Aliases | None |
Required? | true |
Position? | 3 |
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.
The input type is the type of the objects that you can pipe to the cmdlet.
Specifies the SQL Server instance that the source database is on. The Get-SqlCloneSqlServerInstance cmdlet can be used to get a SqlServerInstanceResource.
You can't use this parameter in addition to the BackupLocation and BackupFileName parameters.
Specifies location of the backup files. The Get-SqlCloneBackupLocation cmdlet can be used to get a BackupLocationResource.
You can't use this parameter in addition to the SqlServerInstance and DatabaseName parameters.
The output type is the type of the objects that the cmdlet emits.
Connect-SqlClone -ServerUrl 'http://sql-clone.example.com:14145' $SqlServerInstance = Get-SqlCloneSqlServerInstance -MachineName WIN201601 -InstanceName SQL2014 $ImageDestination = Get-SqlCloneImageLocation -Path '\\red-gate\data-images' $ImageOperation = New-SqlCloneImage -Name "AdventureWorks-$((get-date).ToString("yyyyMMddHHmmss"))" ` -SqlServerInstance $SqlServerInstance ` -DatabaseName 'AdventureWorks' ` -Destination $ImageDestination Wait-SqlCloneOperation -Operation $ImageOperation |
This example creates a new image from the 'AdventureWorks' database on WIN201601\SQL2014 and saves it under '\\red-gate\data-images' with a timestamp postfix.
Connect-SqlClone -ServerUrl 'http://sql-clone.example.com:14145' $BackupLocation = Get-SqlCloneBackupLocation -Path '\\red-gate\backups' $ImageDestination = Get-SqlCloneImageLocation -Path '\\red-gate\data-images' $ImageOperation = New-SqlCloneImage -Name "AdventureWorks-$((get-date).ToString("yyyyMMddHHmmss"))" ` -BackupLocation $BackupLocation ` -BackupFileName @('AdventureWorks-201701012210.bak') ` -Destination $ImageDestination $ImageOperation | Wait-SqlCloneOperation |
This example creates a new image from the backup file '\\red-gate\backups\AdventureWorks-201701012210.bak' and saves it under '\\red-gate\data-images' with a timestamp postfix.