We have a SQL Server 2008 server that I successfully migrated to a new computer with SQL Server 2019.
The SQL Server 2008 server name is 18.104.22.168.
It has two instances named: 22.214.171.124 and 126.96.36.199ABC.
The SQL Server 2019 server name is CMP123456.
The instances are named: CMP123456 and CMP123456ABC.
I would like to use aliases on the 2019 server because unfortunately some programmers hardcoded the instance names into their code.
I created two aliases:
[188.8.131.52 TCP 1433 localhost] [184.108.40.206ABC TCP 1433 localhostABC]
When I use SSMS to login, however both aliases connect me to CMP123456. I am unable to create an alias that will connect me to CMP123456ABC.
These are the aliases I have tried.
They all fail as “server not found” errors:
[220.127.116.11ABC TCP 1434 localhostABC] [18.104.22.168ABC TCP 1433 CMP123456ABC] [22.214.171.124ABC TCP 1433 ABC]
[(No Alias) In this case I was hoping the one localhost alias would work for both instances.]
Any ideas? Is not allowing two aliases a bug/feature of SQL Server 2019?
For the first two aliases you point both to 1433, which is the default instance. That explains why both of then goes to the default instance (the port number takes precedence over the instance name).
In your alias config, either specify a backslash with the instance name or specify the port name for the alias which is to point to the named instance.
Also, remember that SSMS is a 32 bit app, so SSMS check the 32 bit alias configs (not the 64 bit configs).
Aliases is a client config, so you will have do this on all your client machines (that need these aliases). The info is in the registry, so you could push out those registry entries by some automated means. Note that you probably want to push out both the 32 and 64 bit registry entries (so the aliases exists for both types of apps). The 32 and 64 bit registry entries are in different places in the registry.
DNS won’t help you here, since a DNS entry can’t have an Instance name. That is why some people have each instances have a separate IP adress and then have all instances listning on port 1433 (on their IP), to facilitate “rerouting” through DNS config. That won’t help you here since you already have clients including the instance name in the connection string.
There is a naming convention
in your case
NetBIOS computer names can't contain the following characters: backslash () slash mark (/) colon (:) asterisk (*) question mark (?) quotation mark (") less than sign (<) greater than sign (>) vertical bar (|)
Also don’t name a computer localhost it is really really bad, as you don’t folow the the convention
The name localhost is reserved for loopback purposes by RFC 6761 (Special-Use Domain Names), which achieved the Proposed Standard maturity level in February 2013. The standard sets forth a number of special considerations governing the use of the name in the Domain Name System
in short localhost is bad and the second name is against naming and will not work