Edit

Share via


Get-AzureSqlDatabaseCopy

Checks the status of copy relationships.

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

ByServerNameOnly (Default)

Get-AzureSqlDatabaseCopy
    -ServerName <String>
    [-DatabaseName <String>]
    [-PartnerServer <String>]
    [-PartnerDatabase <String>]
    [-Profile <AzureSMProfile>]
    [<CommonParameters>]

ByInputObject

Get-AzureSqlDatabaseCopy
    -ServerName <String>
    -DatabaseCopy <DatabaseCopy>
    [-Profile <AzureSMProfile>]
    [<CommonParameters>]

ByDatabase

Get-AzureSqlDatabaseCopy
    -ServerName <String>
    -Database <Database>
    [-PartnerServer <String>]
    [-PartnerDatabase <String>]
    [-Profile <AzureSMProfile>]
    [<CommonParameters>]

Description

The Get-AzureSqlDatabaseCopy cmdlet checks the status of one or more active copy relationships. Run this cmdlet after you run the Start-AzureSqlDatabaseCopy or Stop-AzureSqlDatabaseCopy cmdlet. You can check a specific copy relationship, all copy relationships, or a filtered list of copy relationships, such as all copies on a specific target server. You can run this cmdlet on the server that hosts the source or target database.

This cmdlet is synchronous. The cmdlet blocks the Azure PowerShell console until it returns a status object.

The PartnerServer and PartnerDatabase parameters are optional. If you do not specify either parameter, this cmdlet returns a table of results. To see the status for only a particular database, specify both parameters.

Examples

Example 1: Get the copy status of a database

PS C:\> Get-AzureSqlDatabaseCopy -ServerName "lpqd0zbr8y" -DatabaseName "Orders" -PartnerServer "bk0b8kf658"

This command gets the status of the database named Orders on the server named lpqd0zbr8y. The PartnerServer parameter restricts this command to the bk0b8kf658 server.

Example 2: Get the status of all copies on a serverGet the status of all copies on a server

PS C:\> Get-AzureSqlDatabaseCopy -ServerName "lpqd0zbr8y"

This command gets the status of all active copies on the server named lpqd0zbr8y.

Parameters

-Database

Specifies an object that represents the source Azure SQL Database. This cmdlet gets the copy status of the database that this parameter specifies.

Parameter properties

Type:Database
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ByDatabase
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-DatabaseCopy

Specifies an object that represents a database. This cmdlet gets the copy status of the database that this parameter specifies. This parameter accepts pipeline input.

Parameter properties

Type:DatabaseCopy
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ByInputObject
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-DatabaseName

Specifies the name of the source database. This cmdlet gets that copy status of the database that this parameter specifies.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ByServerNameOnly
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PartnerDatabase

Specifies name of the secondary database. If this database is not found in the sys.dm_database_copies dynamic management view, this cmdlet returns an empty status object.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ByServerNameOnly
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ByDatabase
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PartnerServer

Specifies the name of the server that hosts the target database. If this server is not found in the sys.dm_database_copies dynamic management view, this cmdlet returns an empty status object.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ByServerNameOnly
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ByDatabase
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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.

Parameter properties

Type:AzureSMProfile
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ServerName

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

Microsoft.WindowsAzure.Commands.SqlDatabase.Model.DatabaseCopy

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 the New-AzureSqlDatabaseServerContext cmdlet.