Sdílet prostřednictvím


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.

Arrow icon used with Back to Top link[Top]

Using SQL Server Management Studio

To remove an availability group listener

  1. In Object Explorer, connect to the server instance that hosts the primary replica, and click the server name to expand the server tree.

  2. Expand the AlwaysOn High Availability node and the Availability Groups node.

  3. Expand the node of the availability group, and expand the Availability Groups Listeners node.

  4. Right-click the listener to be removed, and select the Delete command.

  5. 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.

Arrow icon used with Back to Top link[Top]

Using Transact-SQL

To remove an availability group listener

  1. Connect to the server instance that hosts the primary replica.

  2. 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’;
    

Arrow icon used with Back to Top link[Top]

Using PowerShell

To remove an availability group listener

  1. Set default (cd) to the server instance that hosts the primary replica.

  2. 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
    

    Note

    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.

Arrow icon used with Back to Top link[Top]

Arrow icon used with Back to Top link[Top]

See Also

Concepts

Overview of AlwaysOn Availability Groups (SQL Server)

Availability Group Listeners, Client Connectivity, and Application Failover (SQL Server)