Renaming a SQL instance gotcha

Just a quick post about an issue I ran across this morning. As part of a disaster recovery test I have to rename a SQL instance. Not the instance, but rather the machine name. This is a SQL 2008 Standard Edition named instance

The machine name is 1234567890123-DR. The old instance was called 1234567890123\Reporting, so I wanted to change it to 1234567890123-DR\Reporting. Simple enough, I wrote an earlier post about it here.

However when I renamed it, I couldn’t connect through SSMS by name. When I did connect and looked at @@SERVERNAME I saw 1234567890123-DR\Reporting, which is what it should be. But looking at the host name in the SQL Server Configuration Manager I saw 1234567890123-D as the host name. The last R was being truncated.

So I renamed the SQL server again, this time to match the host name. And after stopping and restarting the service I could now connect to 1234567890123-D\Reporting, and that’s what @@SERVERNAME returned.

What happened? The name of the computer is16 characters, and \Reporting fits the limit (also 16 characters) for a named instance (See Books On-Line). But the last character was clearly being cut off.

I’m guessing because I haven’t Bingled it yet, but I think that the slash between the machine host name and the name of the instance is counted as part of the host name. So when I renamed the server and it looked correct inside SQL, SQL itself didn’t like it and cut the last R off without warning me.

I don’t think it will affect my DR testing, but it is something to be aware for the future.

m4s0n501