If you go and change the SQL server name wher it has Linked server and logins associated with it. In such cases, if you attempt to drop the old server name for renaming SQL server, then you will get below error.
Server: Msg 15190, Level 16, State 1, Procedure sp_dropserver, Line 44 There are still remote logins or linked logins for the server 'SERVER A'
In this scenario, first you need to find out which are logins associated with Linked server. Below stored procedure will help you to check this.
EXEC sp_helplinkedsrvlogin
In the result of this Stored Procedure you will get the list of logins associated with linked server. Now you need to drop these logins one by one.
To drop these logins, please use below query.
sp_droplinkedsrvlogin 'old_name', 'linked_login';
After successful removal of these logins, you can drop the old server easily. Now go ahead and rename the SQL server. You can perform below steps to do this.
- If the server hosts the default instance of SQL Server then, execute below queries.
sp_dropserver <old_name>; GO sp_addserver <new_name>, local; GO
To get these changes effective you need to restart the SQL Services.
2. If the server hosts the named instance of SQL Server then, execute below queries.
sp_dropserver <old_name\instancename>; GO sp_addserver <new_name\instancename>, local; GO
To get these changes effective you need to restart the SQL Services.
2 Comments »