Migrate the WebSphere Commerce Version 8 live database

Migrate your live WebSphere Commerce Version 8 database by pointing the WebSphere Commerce Version 9 environment to the live WebSphere Commerce Version 8 database. Then, run the premigration checker and migration utility, all while serving live traffic.


Before beginning

  1. Ensure that the data in your KEYS table is valid. In particular, ensure that any rows you added for custom tables have valid data.

  2. Update the WebSphere Commerce Version 9 configuration center in the database connection settings for our version of live WebSphere Commerce Version 8 database.

  3. Redeploy our custom containers to the WebSphere Commerce application.

    By redeploying your containers, the database connection settings you added to your configuration center are included in the deployment. Once the deployment is complete, the WebSphere Commerce Version 9 environment points to the WebSphere Commerce Version 8 live database. We can validate the database connection details by reviewing the following file:

    • /opt/WebSphere/AppServer/profiles/default/config/cells/localhost/nodes/localhost/servers/server1/resources.xml

    Look for the following block of code, and validate the database properties.

      <factories xmi:type="resources.jdbc:DataSource" xmi:id="DataSource_1511481976537" name="WCDataSource" jndiName="jdbc/WCDataSource" 
          description="Data source template" authMechanismPreference="BASIC_PASSWORD" authDataAlias="WCDataSource_alias" relationalResourceAdapter="builtin_rra" 
          statementCacheSize="50" datasourceHelperClassname="com.ibm.websphere.rsadapter.DB2UniversalDataStoreHelper">
            <propertySet xmi:id="J2EEResourcePropertySet_1511481976543">
              <resourceProperties xmi:id="J2EEResourceProperty_1511481976548" name="databaseName" type="java.lang.String" value="mall"/>
              <resourceProperties xmi:id="J2EEResourceProperty_1511481976553" name="driverType" type="java.lang.Integer" value="4"/>
              <resourceProperties xmi:id="J2EEResourceProperty_1511481976558" name="serverName" type="java.lang.String" value="db"/>
              <resourceProperties xmi:id="J2EEResourceProperty_1511481976565" name="portNumber" type="java.lang.Integer" value="50000"/>
            </propertySet>
            <connectionPool xmi:id="ConnectionPool_1511481976569" connectionTimeout="180" maxConnections="55" minConnections="0" reapTime="180" 
              unusedTimeout="1800" agedTimeout="0" purgePolicy="EntirePool"/>
            <mapping xmi:id="MappingModule_1511481976574" mappingConfigAlias="DefaultPrincipalMapping" authDataAlias="WCDataSource_alias"/>
          </factories>


Procedure

  1. Run the premigration database check against your live database.

    1. Run docker ps to verify that the containers are running.

    2. Locate the utility container name in the NAMES column. For example, myproject_utils_1.

    3. Start a bash shell.with the utility container name.

      • docker exec -it <utility_container_name> bash

    4. Go to the bin directory.

      • cd /opt/WebSphere/CommerceServer90/bin

    5. Check the database.

      • wcim_ant.sh -tier db -action check -from 80 -instanceName instance_name -isStaging true|false [-defaultTablespace yes | no] [-logLevel Error | Warning | Info | Verbose | Debug]

      Where:

        tier
        Specifies the tier of the WebSphere Commerce topology that we are migrating. The only available option is db.

        action
        Specifies the action to perform when the command runs. The supported actions are as follows:

          check
          Runs the database premigration checker to check the status of the database before you migrate it. Run the database premigration checker before you migrate the database.

        from
        Specifies the version of the WebSphere Commerce database from which we are migrating. The only available option is 80.

        instanceName
        Specifies the name of the WebSphere Commerce Version 8 instance.

        isStaging
        Specifies whether we are checking the staging database.

          true
          You are checking a staging database.

          false
          You are not checking a staging database.

        defaultTablespace
        Optional: Specifies whether to use a default table space for the database.

          yes
          Sets a default table space.

          no
          A non-default table space can be used. You are prompted to pass a table space name later in the migration.

        logLevel
        Optional: Specifies the amount of information about the database tier migration that is logged. The valid log levels are as follows:

          Error
          Only error messages are logged.

          Warning
          All warning and error messages are logged.

          Info
          All error, warning, and event messages are logged.

          Verbose
          All errors, events, and other information are logged, including all SQL statement information. It requires 1-2 MB of storage for most migrations. Verbose is set by default.

          Debug
          Similar to the Verbose option, but includes some additional debug information. This value is helpful if you encounter errors and need to debug them. It requires 1-2 MB of storage for most migrations.

      The following snippet is an example of the database check interactions:

        /opt/WebSphere/CommerceServer90/bin>wcim_ant.sh -tier db -action check -from 80 -instanceName demo -isStaging true -logLevel Verbose
        Database type? 
        db2
        
        Database name?
        mall
        
        Is the database backup completed? [ Yes ] (Yes,No,)
        Yes
        
        Is the database restore completed? [ Yes ] (Yes,No,)
        Yes

      When the check completes successfully, you see the following message:

        INFO:   WCIM has completed the job(s) successfully.

    6. If the database check fails, review the following log file: /opt/WebSphere/CommerceServer90/logs/WCIM/wcim.server.yyyy.mm.dd_hh.mm.ss.log. Address the failure message, and rerun the database check.

  2. Migrate the live database.

    1. Open a new command prompt, or use the same prompt that we used to run the database check.

    2. Migrate the database.from the utility container:

      • wcim_ant.sh -tier db -action migrate -from 80 -instanceName instance_name -isStaging true|false [-defaultTablespace yes | no] [-logLevel Error | Warning | Info | Verbose | Debug]

      Where:

        tier
        Specifies the tier of the WebSphere Commerce topology that we are migrating. The only available option is db.

        action
        Specifies the action to perform when the command runs. The supported actions are as follows:

          migrate
          Migrates the database to WebSphere Commerce Version 9.

        from
        Specifies the version of the WebSphere Commerce database from which we are migrating. The only available option is 80.

        instanceName
        Specifies the name of the WebSphere Commerce Version 8 instance.

        isStaging
        Specifies whether we are checking the staging database.

          true
          You are checking a staging database.

          false
          You are not checking a staging database.

        defaultTablespace
        Optional: Specifies whether to use a default table space for the database.

          yes
          Sets a default table space.

          no
          A non-default table space can be used. You are prompted to pass a table space name later in the migration.

        logLevel
        Optional: Specifies the amount of information about the database tier migration that is logged. The valid log levels are as follows:

          Error
          Only error messages are logged.

          Warning
          All warning and error messages are logged.

          Info
          All error, warning, and event messages are logged.

          Verbose
          All errors, events, and other information are logged, including all SQL statement information. It requires 1-2 MB of storage for most migrations. Verbose is set by default.

          Debug
          Similar to the Verbose option, but includes some additional debug information. This value is helpful if you encounter errors and need to debug them. It requires 1-2 MB of storage for most migrations.

      The following snippet is an example of how to run the database migration check:

        /opt/WebSphere/CommerceServer90/bin>wcim_ant.sh -tier db -action migrate -from 80 -instanceName demo -isStaging true -logLevel Verbose
        Database type? 
        db2 
        
        Database name?
        mall
        
        Is the database backup completed? [ Yes ] (Yes,No,)
        Yes
        
        Is the database restore completed? [ Yes ] (Yes,No,)
        Yes

      When the database migration completes successfully, you see the following message:

        INFO:   WCIM has completed the job(s) successfully.

    3. If the database migration fails, review and correct any errors that might be found in the following log file: /opt/WebSphere/CommerceServer90/logs/WCIM/wcim.server.yyyy.mm.dd_hh.mm.ss.log.

      Note: If the database migration fails while it enables content versioning, you need to restore the database before you rerun the migration. To determine whether the migration failed while it enabled content versioning, review the /opt/WebSphere/CommerceServer90/logs/WCIM/wcim.server.yyyy.mm.dd_hh.mm.ss.log file and the /opt/WebSphere/CommerceServer90/logs/content.version.update.messages_yyyy.mm.dd_hh.mm.ss.log file. Check the logs to see whether the failure occurs while it runs the createVersion task from the configureContentVersionComponent.xml file.

    4. After the migration completes successfully, review any warnings in the /opt/WebSphere/CommerceServer90/logs/WCIM/wcim.server.yyyy.mm.dd_hh.mm.ss.log, and then determine whether any actions are needed.

Previous topic: Migrate an offline version of our production database.