Заметки сисадмина » How to fix @@SERVERNAME in SQL Server 2005

Заметки сисадмина о интересных вещах из мира IT, инструкции и рецензии. Настраиваем Компьютеры/Сервера/1С/SIP-телефонию в Москве

How to fix @@SERVERNAME in SQL Server 2005

2012-11-11 · Posted in SQL

It seems to happen from time to time: your network engineers decide on a new network topology or naming scheme and they want to rename one or more of your SQL Server machines or worse your desktop machine!

Renaming a SQL Server instance is not as simple as renaming the computer in My Computer Properties. After you’ve restarted windows, you will find that while the instance is now available on the network with the new machine name, internally @@SERVERNAME will probably still be using the old name. This will upset a number of features within SQL Server and Management Studio and some 3rd party tools.

Using the following sql, you can see if @@SERVERNAME has the incorrect value:

Both @@SERVERNAME and RealInstanceName should be identical. After a recent name change my results looked like this:

@@SERVERNAME RealInstanceName ——————————— ——————————— IAUTO-124F92 JKUITERS-DEV
To correct @@SERVERNAME for a default instance use the following commands:

exec sp_dropserver old_name

To correct @@SERVERNAME for a named instance:

Leave a Reply