One of the most successful offerings from me has been Comprehensive Database Performance Health Check. Sometimes during my assistance, some random issues appear which I try to solve as well. In a recent engagement, one of their developers asked a question about an error which he was receiving while running sp_dropserver. In this blog, we would see how to fix error 15190 – There are still remote logins or linked logins for the server.
Here is the query which we were using to drop the linked server.
EXEC sp_dropserver 'SQLAUTHORITY'
And here is the output
Msg 15190, Level 16, State 1, Procedure sp_dropserver, Line 56 [Batch Start Line 11] There are still remote logins or linked logins for the server ‘SQLAUTHORITY’.
In SSMS, we could see below.
As the message says, there are logins associated with the linked server. So, if you want to know what they are, you can use
to find them and drop them one by one using below system stored procedure.
In my case, I was not worried about them and I used below.
EXEC master.dbo.sp_dropserver @server=N'SQLAUTHORITY', @droplogins='droplogins'
After adding the additional parameter, I was able to drop linked server. Well, sometimes there are simple solutions to complex problems. Let me know if you have ever faced such error with your production environment.
Reference: Pinal Dave (https://blog.sqlauthority.com)