Friday , August 7 2020

Could not drop Login as the user is currently logged in. Error 15434

Created a Temporary users for testing purposes . But not able to remove the user in Microsoft SQL server Management Studio.

Error :

Could not drop Login as the user is currently logged in. (Microsoft SQL server,Error: 15434)

image

Drop Failed for Login (Microsoft.Sqlserver.smo)

Additional Information:

An exception while executing a Transact-SQL statement or batch.

(Microsoft.Sqlserver.Connectioninfo)

 

Solution –

Step 1 – Get the session ID (ENTER Login name in below)


SELECT session_id

FROM sys.dm_exec_sessions

WHERE login_name = 'Enter the login name you are trying to remove'

Step 2 – Enter the session ID like below to kill the existing sessions (Mine is 323)


SELECT session_id

FROM sys.dm_exec_sessions

WHERE login_name = 'Enter the login name you are trying to remove'

KILL 323

Step 3 – Remove User

Now you should be able to remove the user.

Good to know-

To Take Database Offline Immediately. Killing all existing connections.


USE master
GO
ALTER DATABASE databasename
SET OFFLINE WITH ROLLBACK IMMEDIATE
GO

About Satheshwaran Manoharan

Satheshwaran Manoharan is an Microsoft Office Server and Services MVP , Publisher of Azure365pro.com. Specialized in Office365 / Microsoft Exchange / Virtualization , Sathesh is an Messaging Expert supporting/Designing/Deploying many medium size businesses to large enterprises when it comes to Corporate messaging and Virtualization Infrastructure

Check Also

Migration Endpoint Fails with Connection Exception

Solution –  Make sure Outlook Anywhere succeeds with test account. Make sure you enter the …

Leave a Reply

Your email address will not be published.