Remove-SqlAvailabilityReplica
Removes the secondary availability replica specified by the InputObject or Path parameter.
Remove-SqlAvailabilityReplica [-Path*] <string> [-Script] [-Confirm] [-WhatIf] [<CommonParameters>]
Remove-SqlAvailabilityReplica [-InputObject*] <AvailabilityReplica> [-Script] [-Confirm] [-WhatIf][<CommonParameters>]
The Remove-SqlAvailabilityGroup cmdlet removes the secondary replica specified by the InputObject or Path parameter. This cmdlet can be executed only at the server instance that hosts the primary replica.
Parameters |
---|
-InputObject <AvailabilityReplica>
|
-Path <string>
|
-Script [<SwitchParameter>]
|
-Confirm [<SwitchParameter>]
|
-WhatIf [<SwitchParameter>]
|
<CommonParameters>
|
Inputs
Microsoft.SqlServer.Management.Smo.AvailabilityReplica
The availability replica to be removed.
Examples
- This command removes the availability replica named ‘MyReplica’ from the availability group named ‘MyAg’:
C:PS> Remove-SqlAvailabilityReplica -Path SQLSERVER:SQLPrimaryServerInstanceNameAvailabilityGroupsMyAgAvailabilityReplicasMyReplica
This command must be run on the server instance that hosts the primary replica of the availability group.
- This command outputs the Transact-SQL script that removes the availability replica named ‘MyReplica’ from the availability group named ‘MyAg’:
C:PS> Remove-SqlAvailabilityReplica -Path SQLSERVER:SQLPrimaryServerInstanceNameAvailabilityGroupsMyAgAvailabilityReplicasMyReplica -Script
The replica is not actually removed by this command.