Fix Commerce Server 2007 After Renaming Machine Name

 

There are time you have to change your machine name post a Commerce Server 2007 installation and after doing so you render your Commerce Server in operable. No matter what your scenario is I will give you two solutions. These solutions are recommended for single server deployments only.

Supported Solution

The supported solution only works for a very few scenarios for example, your Enterprise images Development Systems to prepare a computer for doing imaging and customization. Install Commerce Server but do not configure it, then make an image of the system. After installing the imaged system on to a computer run the Commerce Server Configuration.

Non Supported Solution

The non supported solution is exactly as it is, you will not get any support if you follow these steps. Now that I have made that disclaimer lets get down and dirty.

MSCS_Admin Database

Commerce Server holds all site configuration in MSCS_Admin database. This Database is created when you first configure your site and every time you unpackaged a site all it's configuration data will be stored in MSCS_Admin database. So how is it that MMC Console or Commerce Server knows where this database resides? That's a good question. Commerce Server holds the connection string for MSCS_Admin database in the registry key ADMINDBPS, this key is encrypted.

The Commerce Server MMC and the Configuration objects get the connection string from this location, to find the MSCS_Admin database. After configuration Commerce Server and un-packaging one more site(s), Server names and connection strings for a Commerce Site is held in this database. Hence if the machine name is changed post installation, the connections between resources might break and these connection strings needs to be changed manually.

Recovering Commerce Server After Machine Name Change

  1. Change the Commerce Server Administration database connection string. You can do by running CSConfig.exe command with /f command line to re-configure Commerce Server. This will also reset Service accounts for Commerce Server.

  2. Some global resources such as the Data Warehouse, Commerce Server Direct Mailer, and Profiles may have display names containing the server name on which they were created. So we need to fix this by updating the MSCS_Admin database and replace the old server name with a new one. Then we need to change all the connection strings.

    Before doing any changes lets understand a few tables relevant to our updates in MSCS_Admin database. The Commerce Site information is held in several tables. The Site Table holds the Site Name and by joining to SiteResources and Resources Table we can get a list of Resources associated with a particular site. To see the detail properties of the Resource we need to join to ResourceProps Table. So most of the data is held in Resources table and ResourcesProps and these are the two table we need to modify. First we need to update the Resources Table's s_Computer column. This columns holds the global display name which are server names. Next We need to update the ResourceProps Table s_Value column this table holds all of the connection strings and for some resources it holds server names as well.
     
    The following scripts is to be executed under the MSCS_Admin database:

    DECLARE @OldMachineName nvarchar(255)DECLARE @NewMachineName nvarchar(255)

    SET @OldMachineName = null -- name of your old computer SET @NewMachineName = null -- name of your new computer

    IF @OldMachineName is not null AND @NewMachineName is not nullBEGIN     UPDATE ResourceProps     SET s_value=REPLACE(CONVERT(nvarchar(4000),s_value),@OldMachineName,@NewMachineName )

        UPDATE Resources     SET s_DisplayName = REPLACE(s_DisplayName,@OldMachineName,@NewMachineName ) ,    s_Computer = REPLACE(s_Computer,@OldMachineName,@NewMachineName) END

  3. Next we need to fix the profiles global connection strings. The following statement needs to be executed under the <SiteName>_Profiles database.

    DECLARE @OldMachineName nvarchar(255) DECLARE @NewMachineName nvarchar(255)

    SET @OldMachineName = null -- name of your old computer SET @NewMachineName = null -- name of your new computer

    IF @OldMachineName is not null AND @NewMachineName is not nullBEGIN     Update SourceDef     SET ConnStr = REPLACE(ConnStr,@OldMachineName,@NewMachineName) END

  4. Also run the following SQL statement for Direct Mailer if you have it installed.

    DECLARE @NewMachineName nvarchar(255)

    SET @NewMachineName = null -- name of your new computer

    IF @NewMachineName is not nullBEGIN 

        UPDATE Resources    SET s_Computer = @NewMachineName    WHERE (s_Type = 'DirectMailer') AND (f_IsGlobal = 'true')

    END

  5. Update all of your Business User Management Applications so that they are pointing to the new machine name.

  6. Also update local SQL accounts from OldMachineName\UserName with NewMachineName\UserName.

Summary

So you now have two solutions you can test in your Enterprise to ease you deployment pains.