Remove an Availability Group Listener (SQL Server)
This topic describes how to remove an availability group listener from an AlwaysOn availability group by using SQL Server Management Studio, Transact-SQL, or PowerShell in SQL Server 2012.
**Before you begin: **
Prerequisites
Recommendations
Security
To remove a listener, using:
SQL Server Management Studio
Transact-SQL
PowerShell
Before You Begin
Prerequisites
- You must be connected to the server instance that hosts the primary replica.
Recommendations
Before you delete an availability group listener, we recommend that you ensure that no applications are using it.
Security
Permissions
Requires ALTER AVAILABILITY GROUP permission on the availability group, CONTROL AVAILABILITY GROUP permission, ALTER ANY AVAILABILITY GROUP permission, or CONTROL SERVER permission.
[Top]
Using SQL Server Management Studio
To remove an availability group listener
In Object Explorer, connect to the server instance that hosts the primary replica, and click the server name to expand the server tree.
Expand the AlwaysOn High Availability node and the Availability Groups node.
Expand the node of the availability group, and expand the Availability Groups Listeners node.
Right-click the listener to be removed, and select the Delete command.
This opens the Remove Listener from Availability Group dialog box. For more information, see Remove Listener from Availability Group, later in this topic.
Remove Listener from Availability Group (Dialog Box)
Name
The name of the listener to be removed.Result
Displays a link, either Success or Error, which you can click for more information.
[Top]
Using Transact-SQL
To remove an availability group listener
Connect to the server instance that hosts the primary replica.
Use the ALTER AVAILABILITY GROUP statement, as follows:
ALTER AVAILABILITY GROUP group_name REMOVE LISTENER ‘dns_name’
where group_name is the name of the availability group and dns_name is the DNS name of the availability group listener.
The following example deletes the listener of the AccountsAG availability group. The DNS name is AccountsAG_Listener.
ALTER AVAILABILITY GROUP AccountsAG REMOVE LISTENER ‘AccountsAG_Listener’;
[Top]
Using PowerShell
To remove an availability group listener
Set default (cd) to the server instance that hosts the primary replica.
Use the built in Remove-Item cmdlet to remove a listener. For example, the following command removes a listener named MyListener from an availability group named MyAg.
Remove-Item ` SQLSERVER:\Sql\PrimaryServer\InstanceName\AvailabilityGroups\MyAg\AGListeners\MyListener
[!UWAGA]
To view the syntax of a cmdlet, use the Get-Help cmdlet in the SQL Server PowerShell environment. For more information, see Get Help SQL Server PowerShell.
[Top]
Related Tasks
[Top]
Zobacz także
Koncepcje
Overview of AlwaysOn Availability Groups (SQL Server)
Availability Group Listeners, Client Connectivity, and Application Failover (SQL Server)