In previous version of SQL server (around about version 7) if you changed the hostname of the Windows server you had to execute a SP so that the SQL Server instance would start up. This is not necessarily the case in modern versions of the product but I have found that Log Shipping doesn’t work unless you do so.
If you don’t bother to make any changes to SQL after changing the hostname you will find the value returned by SELECT @@SERVERNAME returns the old name and not the new one, which explains the issue with log shipping as it seems to depend on this.
In order to rename the SQL instance you have to execute a stored procedure that is normally related to adding or dropping a linked server – Microsoft’s website says that sp_dropserver, “Removes a server from the list of known remote and linked servers on the local instance of SQL Server.”
But it turns out we also need to execute it if we change the name of the Windows host. Don’t worry, there is no impact in running the SP, it executes very quickly, but you won’t find the value returned by SELECT @@SERVERNAME changes until you restart the service or boot the box.
The command is:
sp_dropserver @server='OldDBServerName'
GO
sp_addserver 'NewDBServerName',local
GO
[This piece of code is ideal for a Snippet]
If you don’t bother to make any changes to SQL after changing the hostname you will find the value returned by SELECT @@SERVERNAME returns the old name and not the new one, which explains the issue with log shipping as it seems to depend on this.
In order to rename the SQL instance you have to execute a stored procedure that is normally related to adding or dropping a linked server – Microsoft’s website says that sp_dropserver, “Removes a server from the list of known remote and linked servers on the local instance of SQL Server.”
But it turns out we also need to execute it if we change the name of the Windows host. Don’t worry, there is no impact in running the SP, it executes very quickly, but you won’t find the value returned by SELECT @@SERVERNAME changes until you restart the service or boot the box.
The command is:
sp_dropserver @server='OldDBServerName'
GO
sp_addserver 'NewDBServerName',local
GO
[This piece of code is ideal for a Snippet]
Comments
Post a Comment