1. Used user-A to create DB, and assigned to db owner.
2. Need to remove user-A and to use user-B instead.
1. Can’t remove user-A and encountering following error 15141:
The server principal owns one or more endpoint(s) and cannot be dropped hence unable to delete a login from SQL Server
1. Open SSMS and add new Login user-B, assign db owner.
2. Open DB properties then select File Permission, change owner to user-B.
3. Run query to find all endpoints related to user-A:
SELECT p.name, e.* FROM sys.endpoints e
inner join sys.server_principals p on e.principal_id = p.principal_id
4. Run alter to change owner:
Alter Authorization on endpoint::Mirroring to user-B
5. Go to Security/Login to remove user-A