Wednesday, 27 July 2011

How to change the SQL Server Instance name?




Scenario:

An year back I installed SQL Server 2008 instance (Default) on my machine (Name: HSG-PCS374322C). Two months back I renamed my machine to HSG-PCS-44975 .

Today, when I try to install MOM 2005 on my machine, I was stuck with the below error:


Click to enlarge



From the above error, I had to reinstall. Which is not feasible for me.

Either, I had to RENAME the Name of SQL Instance to match the Machine name or rename the machine name itself.

I would prefer to Rename the SQL Instance.

This is how I found out that the Instance is having the name as the Machine’s OLD NAME :
select @@SERVERNAME
HSG-PCS374322C

So in order to get the machine name and the SQL Server instance name back in sync I had do these steps:
1.Run this in Microsoft SQL Server Management Studio:
sp_dropserver 'HSG-PCS374322C'
go
sp_addserver 'HSG-PCS-44975' , 'local'
go
2.Restart SQL Server service.

From Command Prompt run below or you can just do this from Services.msc
net stop mssqlserver
net start mssqlserver
Now running select @@SERVERNAME gives me HSG-PCS-44975.

This is my very first post in this Blog. I know most of you are aware of this, but still this may help the Novice. Wish me good luck... :)

No comments:

Post a Comment