Symptoms
Unable to remove a MSSQL database example_db from Plesk > Domains > example.com > Databases:
SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Cannot use KILL to kill your own process.
SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Login 'jdoe' owns one or more database(s). Change the owner of the database(s) before dropping the login.
Cause
Security misconfiguration in the MSSQL Management Studio.
Resolution
-
Connect to the server via RDP;
-
Login to the MSSQL instance via SQL Management Studio;
-
Click New Query and run the following query to change the owner of the databases to "sa" user:
sp_MSforeachdb 'EXEC [?]..sp_changedbowner ''adminplesk'' '
-
Go to Domains > example.com > Databases and remove the example_db database.