Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I want to change my SQL Server's name.

Currently I am connecting to SERVER1\SQLSERVER. SERVER1 is the machine name. I want to change it so I could connect to SERVER2\SQLSERVER and keep SERVER1 as the machine name.

I tried:

sp_dropserver 'SERVER1\SQLSERVER'
sp_addserver 'SERVER2\SQLSERVER', local

Then I restarted the server.

If I verify I get the new server name:

select @@servername

Looks like the name was changed but i cant connect to SERVER2\SQLSERVER while the SERVER1\SQLSERVER connection still works.

What am I missing here ... and is this even possible?

share|improve this question
1  
what happens if you run the following DOS command: nslookup SERVER2 –  Stuart Moore Feb 5 '13 at 12:47
    
says "unknown server" in both examples SERVER1 or SERVER2. –  no9 Feb 5 '13 at 12:50
1  
Is your DNS server working? Server1 should be your current name and should be translated to something like: "domain server name + IP | current server name + IP". –  Marian Feb 5 '13 at 13:03
    
Well, according to the official documentation it should work. Now see if there's any exception or error that you need to check. –  Marian Feb 5 '13 at 13:23
1  
I don't have a similar machine to test with, but have you tried with server aliases? –  Marian Feb 5 '13 at 13:39
show 1 more comment

1 Answer 1

If you aren't changing the physical server's name you'll need to change the name that SQL Server knows back.

sp_dropserver 'SERVER2\SQLSERVER'
sp_addserver 'SERVER1\SQLSERVER', local

You then just need to put an alias in DNS so that when people try to connect to SERVER2 then are redirected to SERVER1 without knowing about it. Specifically you'll want (or you'll want your sysadmin) to put a CNAME record into DNS pointing SERVER2 to SERVER1.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.