Friday, April 15, 2016

How to rename the SQL Server Network Name of a failover cluster

Problem
Sometimes there may be a need to rename the SQL Server Network Name for a failover cluster and in this tip we will walk through the steps needed to successfully rename the SQL Server Network Name for a failover cluster.
Solution
The SQL Server Network Name is used to identify a failover cluster on the network. This was known as the virtual SQL Server name in earlier versions of SQL Server failover clusters. When you connect to SQL Server using this name, this will connect to the current online node.

Rename the SQL Server Network Name

Step 1 - Get the current SQL Server Network Name

The first step is to get the current SQL Server network name of the failover cluster. You can check the name multiple ways. You can run the below T-SQL command to get the SQL Server network name.
Check SQL Server network name
 Or you can launch the Failover Cluster Manager to check the virtual server name as shown below.
Launch failover cluster manager
In both options, we can see the current SQL Server Network Name is MSSQLCLUSTER.

Step 2 - Change the SQL Server Network Name

From with the Failover Cluster Manager, right click on the Server Name and choose Properties as shown in the below screenshot.
Choose properties in FCM
 The SQL Server Network Name property window will appear as shown in the below screenshot. Here you can see the "DNS Name" as MSSQLCLUSTER. This is where you need to change the SQL Server Network Name.
Property Window of network name
I changed my SQL Server Network Name from MSSQLCLUSTER to SQLCLUSTER as shown in the below screenshot. Once you change the name, click the Apply button.
change sql server network name
Once you click the "Apply" button, it will ask you to confirm this change as shown below.  You will get the message "This change requires clients to update the name used to connect to this clustered role. You will also need to manually restart any service or application that depends on this resource. Are you sure that you want to make this change?". Click Yes to accept the change.
Confirmation window
After clicking Yes, this setting will be saved and the process bar will look like the below screenshot.
Saving Properties

Step 3 - Verify the SQL Server Network Name Change

We have renamed our SQL Server Network Name for this failover cluster. You can verify this change by running the following T-SQL command.
Verify the change
Or you can verify the name change in the Failover Cluster Manager as shown below.
Verify the change

Step 4 - Test Old SQL Server Network Name

If you try to connect to SQL Server using the previous name, you will get the following error.
connection error

Step 5 - Cycle Resources and Services

Although you will be able to make a connection using the new SQL Server Network Name, Microsoft recommends taking the SQL Server network resources offline and bringing them back online after the modification. To do so right click on the SQL Server Network Name and click on the "Take Offline" option.
Take Offline
Once the resources are offline, the interface will look like the below screenshot.
Take Offline
Now right click on the Server Name again and click "Bring Online". Once you bring the SQL Server Network Name resource online, SQL Server will not come online automatically because the SQL Server services are set to Manual mode in a failover cluster environment, so you will need to manually bring these services online.
bring online

Step 6 - Validate changes by testing failover

First check the owner node for SQL Server. We can run the following T-SQL command and see that SQL-NODE1 is the current owner node.
failover testing
 Now open the Failover Cluster Manager and initiate a failover. You can right click on the SQL Server instance and choose the "Move" > "Best Possible Node" option. As our cluster is a two-node cluster, it will failover to the second node.
failover testing
Once the failover is successful, again connect to the SQL Server instance by using the new SQL Server Network Name and run the below T-SQL command. We can see that SQL Server is online on SQL-NODE2 from the below screenshot.
validate failover testing
You can also check the active node in the Failover Cluster Manager as shown below.
validate failover testing
Next Steps
  • Now that you have renamed your SQL Server Network Name, you will need to wait a bit for the new name to be propagated across the network and at that point the SQL Server instance will be accessible from other machines on the network as well.
  • Be sure to validate all applications are running properly after the rename and the failover.
  • Make sure connections are changed to connect to the new SQL Server Network Name.
Courtesy and Ref : 
Manvendra Singh
https://www.mssqltips.com/sqlservertip/4208/how-to-rename-the-sql-server-network-name-of-a-failover-cluster/

No comments:

Post a Comment