Renaming Sql Server

Cloned a sql database server for testing.  Renamed the physical server name to dev.  The SQL Server still has the name of the live server, how do I rename it to Dev?  Microsoft Server 2008 R2 with SQL Server 2008 R2
PDISAsked:
Who is Participating?
 
Aneesh RetnakaranDatabase AdministratorCommented:
1. Rename the physical server and reboot
2. From ssms execute below to drop the current server name
EXEC sp_DROPSERVER 'oldservername'
2. Execute below to add a new server name. Make sure local is specified.
EXEC sp_ADDSERVER 'newservername', 'local'
3. Restart SQL Services.
4. Verify the new name using:
SELECT @@SERVERNAME
SELECT * FROM sys.servers WHERE server_id = 0
0
 
PDISAuthor Commented:
When I run, EXEC sp_DROPSERVER 'oldservername'  I get the following message

(1 row(s) affected)
Msg 15190, Level 16, State 1, Procedure sp_dropserver, Line 56
There are still remote logins or linked logins for the server 'oldservername'
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
try this statement, it works in SQL 2014 not sure it works in SQL 2008

exec sp_dropserver 'oldservername', @droplogins = 'droplogins'
0
 
PDISAuthor Commented:
When I ran that command, it came back with an error, Cannot drop server 'oldservername' because it is used a Publisher in replication.  

On the test server I went into Replications - Local Publications and deleted all entries there but I still receive the same error.  Please advise if I should open this a new question.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.