< Back

Switch-AzureRmSqlDatabaseFailoverGroup

Tue Jan 29, 2019 10:11 pm

NAME Switch-AzureRmSqlDatabaseFailoverGroup



SYNOPSIS

Executes a failover of an Azure SQL Database Failover Group.





SYNTAX

Switch-AzureRmSqlDatabaseFailoverGroup [-ResourceGroupName] <String> [-ServerName] <String> [[-FailoverGroupName] <String>] [-AllowDataLoss]

[-AsJob] [-DefaultProfile <IAzureContextContainer>] [-Confirm] [-WhatIf] [<CommonParameters>]





DESCRIPTION

This command swaps the roles of the servers in a Failover Group and switches all secondary databases to the primary role. All new TDS sessions are

automatically re-routed to the secondary server after the DNS client cache is refreshed. When the original primary server is back online, all

formerly primary databases in it will switch to the secondary role.



The Failover Group's secondary server must be used to execute this command.





PARAMETERS

-AllowDataLoss [<SwitchParameter>]

Complete the failover even if doing so may result in data loss. This will allow the failover to proceed even if a primary database is

unavailable.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-AsJob [<SwitchParameter>]

Run cmdlet in the background



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-DefaultProfile <IAzureContextContainer>

The credentials, account, tenant, and subscription used for communication with azure



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-FailoverGroupName <String>

The name of the Azure SQL Database Failover Group.



Required? false

Position? 2

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ResourceGroupName <String>

The name of the resource group.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ServerName <String>

The name of the secondary Azure SQL Database Server of the Failover Group.



Required? true

Position? 1

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

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



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

System.String







OUTPUTS

System.Object







NOTES









Example 1



C:\\> Get-AzureRmSqlDatabaseFailoverGroup -ResourceGroupName rg -ServerName secondaryserver -FailoverGroupName fg |

Switch-AzureRmSqlDatabaseFailoverGroup -AllowDataLoss



Issue a failover operation allowing data loss by piping in the Failover Group.





Example 2



C:\\> Switch-AzureRmSqlDatabaseFailoverGroup -ResourceGroupName rg -ServerName secondaryserver -FailoverGroupName fg



Issue a best effort failover operation that will either succeed without losing data or fail and roll back.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... lovergroup

New-AzureRmSqlDatabaseFailoverGroup

Set-AzureRmSqlDatabaseFailoverGroup

Get-AzureRmSqlDatabaseFailoverGroup

Add-AzureRmSqlDatabaseToFailoverGroup

Remove-AzureRmSqlDatabaseFromFailoverGroup

Remove-AzureRmSqlDatabaseFailoverGroup

SQL Database Documentation https://docs.microsoft.com/azure/sql-database/