DROP AVAILABILITY GROUP (Transact-SQL)

**APPLIES TO:** ![yes](media/yes.png)SQL Server (starting with 2012) ![no](media/no.png)Azure SQL Database ![no](media/no.png)Azure SQL Data Warehouse ![no](media/no.png)Parallel Data Warehouse

Removes the specified availability group and all of its replicas. If a server instance that hosts one of the availability replicas is offline when you delete an availability group, after coming online, the server instance will drop the local availability replica. Dropping an availability group also deletes the associated availability group listener, if any.

[!IMPORTANT]
If possible, remove the availability group only while connected to the server instance that hosts the primary replica. When the availability group is dropped from the primary replica, changes are allowed in the former primary databases (without high availability protection). Deleting an availability group from a secondary replica leaves the primary replica in the RESTORING state, and changes are not allowed on the databases.

For information about alternative ways to drop an availability group, see Remove an Availability Group (SQL Server).

Topic link icon Transact-SQL Syntax Conventions

Syntax

  
DROP AVAILABILITY GROUP group_name   
[ ; ]  

Arguments

group_name
Specifies the name of the availability group to be dropped.

Limitations and Recommendations

Security

Permissions

Requires ALTER AVAILABILITY GROUP permission on the availability group, CONTROL AVAILABILITY GROUP permission, ALTER ANY AVAILABILITY GROUP permission, or CONTROL SERVER permission. To drop an availability group that is not hosted by the local server instance you need CONTROL SERVER permission or CONTROL permission on that availability group.

Examples

The following example drops the AccountsAG availability group.

DROP AVAILABILITY GROUP AccountsAG;  

See Also

ALTER AVAILABILITY GROUP (Transact-SQL)
CREATE AVAILABILITY GROUP (Transact-SQL)
Remove an Availability Group (SQL Server)