Reset SQL Server name after VM cloning

If you're reading this, I bet that you are working heavily with VMs, and like in my case, they are cloned from a base machine. The base machine that I am cloning has already SQL Server installed on it. Today I stumbled across a problem that made me realize that I still have some settings to change after cloning.

The problem in my case was trying to enable Change Data Capture on my SQL Server instance. When running the SP needed to enable the CDC on a specific table I got an error and looking for that I discovered that the SQL Server name is the old machine (I knew that, but it hasn't caused any problems with AX so it was left like this).

So, changing the SQL Server name properly can be done like this:

-- query for the current name


-- drop the old name and add it back as local

sp_dropserver 'OldName';

sp_addserver 'NewName', local;

No comments:

Post a Comment