Solved

Renaming a sql server

Posted on 2008-10-02
9
554 Views
Last Modified: 2012-05-05
I installed SQL Server 2005 on a machine named "hardName" and then tested the install.   We then made a DNS alias so the machine could be referenced as "easyName."  I have corrected @@servername via
    a) select @@servername
    b) sp_dropserver oldName
    c) sp_addserver newName,local
    d) Bounce the server.
    e) select @@servername  

The question is, how can I correct serverproperty('servername') without changing the machine's physical name?  The system administrators want to reference the computer via "hardName" but the users prefer "easyName."

One of the reasons for this process was because an old machine "easyName" was up during the install and during the migration of databases from "easyName" to "hardName."  Now that the migration is complete, I want to finish renaming the database instance.
0
Comment
Question by:AikiRyu
  • 5
  • 3
9 Comments
 
LVL 39

Expert Comment

by:BrandonGalderisi
ID: 22627137
except for clusters, serverproperty("servername") is the machines PHYSICAL COMPUTER NAME.


http://msdn.microsoft.com/en-us/library/ms174396.aspx

MachineName:
Windows computer name on which the server instance is running.
For a clustered instance, an instance of SQL Server running on a virtual server on Microsoft Cluster Service, it returns the name of the virtual server.
NULL = Input is not valid, or an error.
Base data type: nvarchar(128)
0
 
LVL 11

Expert Comment

by:Serge Fournier
ID: 22627192
dfs name resolution work fine here for us:

sql.corp.stas.local is our sql

before that i was using an environnement variable to point to my sql server
0
 

Author Comment

by:AikiRyu
ID: 22628571
Brandon,
Is there any way to change what the SQL server sees as the physical machine name?  Is there a registry change that could be made?
Aiki
0
 
LVL 39

Expert Comment

by:BrandonGalderisi
ID: 22628637
No.  That reads the computer name.  But your users don't need to see this so why bother?
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Author Comment

by:AikiRyu
ID: 22629046
One of my colleagues had a problem setting up replication on the new server.  Apparently the rep install process reads both @@servername and serverproperty('servername').  As yet, these two don't match and the replication install fails.
0
 
LVL 39

Expert Comment

by:BrandonGalderisi
ID: 22629662
Correct'ish.  The servername comes from srvname in sysservers.  It doesn't have to match, but the srvname has to be valid for replication (no . or - etc.).  That's where srvnetname comes in to play.  You can call the server something else (except "local") in sysservers other than the physical computer name.
0
 
LVL 39

Expert Comment

by:BrandonGalderisi
ID: 22629664
@@servername pulls from sysservers where srvid=0.
0
 

Author Comment

by:AikiRyu
ID: 22635027
select @@servername                       -- Looks ok
select * from sysservers                     -- Looks ok
select serverproperty ('servername')  -- Does not give what I want
0
 
LVL 39

Accepted Solution

by:
BrandonGalderisi earned 500 total points
ID: 22635086
Then use @@Servername, which pulls from sysservers.  serverproperty('machinename') will return the physical machine name, that's it.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now