Start-AzureSqlDatabaseCopy

Starts a copy operation of an Azure SQL Database.

Note

The cmdlets referenced in this documentation are for managing legacy Azure resources that use Azure Service Manager (ASM) APIs. This legacy PowerShell module isn't recommended when creating new resources since ASM is scheduled for retirement. For more information, see Azure Service Manager retirement.

The Az PowerShell module is the recommended PowerShell module for managing Azure Resource Manager (ARM) resources with PowerShell.

Syntax

Start-AzureSqlDatabaseCopy
     -ServerName <String>
     -Database <Database>
     [-PartnerServer <String>]
     -PartnerDatabase <String>
     [-Force]
     [-Profile <AzureSMProfile>]
     [-WhatIf]
     [-Confirm]
     [<CommonParameters>]
Start-AzureSqlDatabaseCopy
     -ServerName <String>
     -Database <Database>
     -PartnerServer <String>
     [-PartnerDatabase <String>]
     [-ContinuousCopy]
     [-OfflineSecondary]
     [-Force]
     [-Profile <AzureSMProfile>]
     [-WhatIf]
     [-Confirm]
     [<CommonParameters>]
Start-AzureSqlDatabaseCopy
     -ServerName <String>
     -DatabaseName <String>
     [-PartnerServer <String>]
     -PartnerDatabase <String>
     [-Force]
     [-Profile <AzureSMProfile>]
     [-WhatIf]
     [-Confirm]
     [<CommonParameters>]
Start-AzureSqlDatabaseCopy
     -ServerName <String>
     -DatabaseName <String>
     -PartnerServer <String>
     [-PartnerDatabase <String>]
     [-ContinuousCopy]
     [-OfflineSecondary]
     [-Force]
     [-Profile <AzureSMProfile>]
     [-WhatIf]
     [-Confirm]
     [<CommonParameters>]

Description

The Start-AzureSqlDatabaseCopy cmdlet starts a one-time copy operation or a continuous copy operation of a specific Azure SQL Database. This cmdlet is not transactional.

The original database is the source database. The copy is the secondary or target database. For a continuous copy, the source and target databases cannot reside on the same server, and the servers that host the source and target databases must be part of the same subscription.

If you do not specify the ContinuousCopy parameter, this cmdlet creates a one-time copy of the source database. When the response is received, the operation can still be in progress. You can monitor the operation by using the Get-AzureSqlDatabaseCopy or Get-AzureSqlDatabaseOperation cmdlet.

If you specify ContinuousCopy, this cmdlet creates a continuous copy of the source database. When the response is received, the operation will be in progress. You can monitor the operation by using Get-AzureSqlDatabaseCopy or Get-AzureSqlDatabaseOperation.

You can create a continuous copy as an online or offline database. The online continuous copy is used to configure Active Geo-Replication for Azure SQL Databasehttps://azure.microsoft.com/en-us/documentation/articles/sql-database-geo-replication-overview/. The offline continuous copy is used to configure Standard Geo-Replication for Azure SQL Databasehttps://azure.microsoft.com/en-us/documentation/articles/sql-database-business-continuity-scenarios/.

Examples

Example 1: Schedule a continuous database copy

PS C:\> Start-AzureSqlDatabaseCopy -ServerName "lpqd0zbr8y" -DatabaseName "Orders" -PartnerServer "bk0b8kf65" -ContinuousCopy

This command schedules a continuous copy of the database named Orders on the server named lpqd0zbr8y. The command creates a target database on the server named bk0b8kf658.

Example 2: Create a one-time copy on the same server

PS C:\> Start-AzureSqlDatabaseCopy -ServerName "lpqd0zbr8y" -DatabaseName "Orders" -PartnerDatabase "OrdersCopy"

This command creates a one-time copy of the database named Orders on the server named lpqd0zbr8y. The command creates a copy named OrdersCopy on the same server.

Example 3: Schedule a continuous offline database copy

PS C:\> Start-AzureSqlDatabaseCopy -ServerName "lpqd0zbr8y" -DatabaseName "Orders" -PartnerServer "bk0b8kf65" -ContinuousCopy -OfflineSecondary

This command schedules a continuous copy of the database named Orders on the server named lpqd0zbr8y. This command creates an offline target database on the server named bk0b8kf658.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ContinuousCopy

Indicates that the database copy will be a continuous-copy (a replica database). Continuous copy is not supported within the same server. If this parameter is not specified, then a one-time copy is performed. For a one-time copy, the source and partner databases must be on the same server.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Database

Specifies an object that represents the source Azure SQL Database. This parameter accepts pipeline input.

Type:Database
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-DatabaseName

Specifies the name of the source database.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Force

Forces the command to run without asking for user confirmation.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-OfflineSecondary

Specifies that a continuous copy is a passive copy rather than an active copy. If the source database is a Standard edition database, then this parameter is required. If this parameter is specified then ContinuousCopy must also be specified.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PartnerDatabase

Specifies name of the target database. If you specify the ContinuousCopy parameter, the value for PartnerDatabase must match the name of the source database. If you do not specify ContinuousCopy, you must specify a name for the target database, which can be different from the source database name.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-PartnerServer

Specifies the name of the server that hosts the target database. This server must be in the same Azure subscription as the source database server.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Profile

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

Type:AzureSMProfile
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ServerName

Specifies the name of the server on which the source database resides.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server.Database

Outputs

Microsoft.WindowsAzure.Commands.SqlDatabase.Model.DatabaseCopy

Notes

  • Authentication: This cmdlet requires certificate-based authentication. For an example of how to use certificate-based authentication to set the current subscription, see New-AzureSqlDatabaseServerContext cmdlet.
  • Monitoring: To check for the status of one or more continuous copy relationships that are active on the server, use the Get-AzureSqlDatabaseCopy cmdlet. To verify the status of the operations at both the source and target of the continuous copy relationship, use the Get-AzureSqlDatabaseOperation cmdlet.