Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
Set-AzSqlDatabaseSecondary
- Module:
- Az.Sql Module
Switches a secondary database to be primary in order to initiate failover.
Syntax
NoOptionsSet (Default)
Set-AzSqlDatabaseSecondary
[-DatabaseName] <String>
[-ServerName] <String>
[-ResourceGroupName] <String>
-PartnerResourceGroupName <String>
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
ByFailoverParams
Set-AzSqlDatabaseSecondary
[-DatabaseName] <String>
[-ServerName] <String>
[-ResourceGroupName] <String>
-PartnerResourceGroupName <String>
[-Failover]
[-AllowDataLoss]
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Set-AzSqlDatabaseSecondary cmdlet switches a secondary database to be primary in order to initiate failover. This cmdlet is designed as a general configuration command, but is currently limited to initiating failover. Specify the AllowDataLoss parameter to initiate a force failover during an outage. You do not have to specify this parameter when you perform a planned operation, such as recovery drill. In the latter case, the secondary database is synchronized with the primary before it is switched.
Examples
Example 1: Initiate a planned failover
$database = Get-AzSqlDatabase -DatabaseName $databaseName -ResourceGroupName $secondaryResourceGroupName -ServerName $secondaryServerName
$database | Set-AzSqlDatabaseSecondary -PartnerResourceGroupName $primaryResourceGroupName -Failover
Example 2: Initiate a forced failover (with potential data loss)
$database = Get-AzSqlDatabase -DatabaseName $databaseName -ResourceGroupName $secondaryResourceGroupName -ServerName $secondaryServerName
$database | Set-AzSqlDatabaseSecondary -PartnerResourceGroupName $primaryResourceGroupName -Failover -AllowDataLoss
Parameters
-AllowDataLoss
Indicates that this failover operation permits data loss.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-AsJob
Run cmdlet in the background
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
| Type: | SwitchParameter |
| Default value: | False |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | cf |
Parameter sets
-DatabaseName
Specifies the name of the Azure SQL Database Secondary.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure
Parameter properties
| Type: | IAzureContextContainer |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | AzContext, AzureRmContext, AzureCredential |
Parameter sets
-Failover
Indicates that this operation is a failover.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-PartnerResourceGroupName
Specifies the name of the resource group to which the partner Azure SQL Database is assigned.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ResourceGroupName
Specifies the name of the resource group to which the Azure SQL Database Secondary is assigned.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ServerName
Specifies the name of the SQL Server that hosts the Azure SQL Database Secondary.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Parameter properties
| Type: | SwitchParameter |
| Default value: | False |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | wi |
Parameter sets
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
String
Outputs
AzureReplicationLinkModel
Related Links
Azure PowerShell
Feedback
Was this page helpful?
