Sql-server – How to remove a mirrored database SQL Server 2012

sql server

I have mirrored databases (synchronized), how do I delete such a database correctly? I tried

use master
alter database test0224aEd62 set single_user with rollback immediate
drop database test0224aEd62

by get error

Msg 1468, Level 16, State 1, Line 2 The operation cannot be performed
on database "test0224aEd62" because it is involved in a database
mirroring session or an availability group. Some operations are not
allowed on a database that is participating in a database mirroring
session or in an availability group. Msg 5069, Level 16, State 1, Line
2 ALTER DATABASE statement failed. Msg 3752, Level 16, State 1, Line 3
The database 'test0224aEd62' is currently joined to an availability
group. Before you can drop the database, you need to remove it from
the availatility group.

Best Answer

Did you remove the database mirroring through Management Studio yet? I think you have to do that first in order to drop the principal (I'm not positive though). Go into the database properties of the principal and then stop the mirroring first, then try dropping the principal.