:CONNECT SQL2K16-AG01

USE [master]
GO
ALTER AVAILABILITY GROUP [SQL2K16-AG1] FAILOVER;
GO
DROP AVAILABILITY GROUP [SQL2K16-DAG];
GO
DROP AVAILABILITY GROUP [SQL2K16-AG1];
GO

ALTER EVENT SESSION [AlwaysOn_health] ON SERVER STATE=STOP;
ALTER EVENT SESSION [AlwaysOn_health] ON SERVER WITH (STARTUP_STATE=OFF);
GO

DROP ENDPOINT [Hadr_endpoint];
GO


:CONNECT SQL2K16-AG02

ALTER EVENT SESSION [AlwaysOn_health] ON SERVER STATE=STOP;
ALTER EVENT SESSION [AlwaysOn_health] ON SERVER WITH (STARTUP_STATE=OFF);
GO

DROP ENDPOINT [Hadr_endpoint];
GO

DROP DATABASE ConfigDB;
GO

:CONNECT SQL2K16-AG03

ALTER EVENT SESSION [AlwaysOn_health] ON SERVER STATE=STOP;
ALTER EVENT SESSION [AlwaysOn_health] ON SERVER WITH (STARTUP_STATE=OFF);
GO

DROP ENDPOINT [Hadr_endpoint];
GO

DROP DATABASE ConfigDB;
GO


:CONNECT SQL2K16-DAG01

USE [master]
GO
ALTER AVAILABILITY GROUP [SQL2K16-AG2] FAILOVER;
GO
DROP AVAILABILITY GROUP [SQL2K16-AG2];
GO

ALTER EVENT SESSION [AlwaysOn_health] ON SERVER STATE=STOP;
ALTER EVENT SESSION [AlwaysOn_health] ON SERVER WITH (STARTUP_STATE=OFF);
GO

DROP ENDPOINT [Hadr_endpoint];
GO

DROP DATABASE ConfigDB;
GO

:CONNECT SQL2K16-DAG02

ALTER EVENT SESSION [AlwaysOn_health] ON SERVER STATE=STOP;
ALTER EVENT SESSION [AlwaysOn_health] ON SERVER WITH (STARTUP_STATE=OFF);
GO

DROP ENDPOINT [Hadr_endpoint];
GO

DROP DATABASE ConfigDB;
GO
