For the migration you need to take care of the DB migration and also the media migration. These are completely separate things, so if one is working, it does not mean that the other will work as well.
This blog is about database migration; the next blog will be about media migration.
As a preparation, you should consider cleaning up your database and media before you do the migration.
SAP offers at the time I write this a migration consultant service, that helps you with the Commerce Migration. However in my opinion is the VPN connection the bigger problem, which is not part of the offering.
Code Preparation
For the database migration, you need 1) an SAP Commerce extension called
commerce migration toolkit which can be downloaded from Github (https://github.com/SAP-samples/commerce-migration-toolkit) and 2) a VPN connection from your cloud environment to your onPrem Environment.
I created a separate feature branch just for the migration with this changes.
I added the 2 extensions (commercemigration and commercemigrationhac) to /custom/sap/ and included the extensions as well to the localextension.xml
<extension name="commercemigration" /> <extension name="commercemigrationhac" />
I also need to set the property migration.ds.source.db.url that contains the source (onPrem) database information. Important: use the IP instead of the FQDN, since the cloud environment has no connection to your internal DNS Servers)
I recommend defining a table prefix (.e.g. “cc”) for a dry-run, so you switch between the pre-migration DB data and the migration data.
#db.tableprefix=cc
migration.ds.source.db.url=jdbc:sqlserver://192.168.1.2\dbhyb:12345;databaseName=Hybris;responseBuffering=adaptive;loginTimeout=10
migration.ds.target.db.tableprefix=
You need to have the database initialized if you start with a clean system.
A deployment with your code and the 2 extensions needs be done with the Platform Update mode “Migrate data”.
Please note that when you use the commercemigration extensions, your cronjob triggers are not working (This is a security feature to ensure that the migration is not disturbed by a cronjob).
VPN connection
Setting up the VPN connection was time-consuming in my case. Consider 1-2 weeks and have your network team on standby…
In case you are using in the onPrem environment IPs in the 10.0.0.0/8 range , you need to create under Security > NAT Rules for your onPrem databases first the “remote systems” (e.g. DEV_DB and PRD-DB with their local IPs) and then create “NAT rules”
with the Source system (“Remote System”, onPrem DB ) and the Destination System (Commerce Environment, ccv2 ). A NAT Activation takes about 30 min.
Under Security>VPN Connection you can the create the VPN to your network. you need your gateway IP and the network CIDRs (one or more). This information should be available from your local network team; you also need Security settings .
In our case was only a “Policy-based” Firewall setup successful; the rule-based firewall setup was for us not working.
A test can be done with the following grovy script (IP and DB name must be configured to your environment)
import java.sql.Connection;
import java.sql.DriverManager;
String dbURL = "jdbc:sqlserver://192.168.1.2\dbhyb:12345;databaseName=Hybris;responseBuffering=adaptive;loginTimeout=10";
String user = "hybris_db";
String pass = "itsasecrect";
Connection conn = DriverManager.getConnection(dbURL, user, pass);
if (conn != null) {
println("Connected");
conn.close();
}
The “VPN overview” should then show at “Bytes in/ Bytes out” some bytes.
if not: A reset of the VPN connection by your network team might help in case the bytes are staying at “0/0”. When the VPN Connection is set up and the test connection works, you are ready for the database migration.
Migration
You need to open the HAC (/admin) where you will find a new tab for the DB migration.
First, you will check if a connection to the onPrem database is possible. Then the cloud system will check what are the differences in the database schema.
The result of this comparison will be a script that you need to copy in the field below and then execute.
After that, the table structures are prepared and the actual data migration can start.
In our case, the data migration took less than one hour, since we cleaned up the database and we do not have too many products.
Post- Migration
When everything was successful (including media migration) remove the 2 commercemigration toolkit extensions and clean up the migration.* properties in property files and backoffice services
The media migration will be done in the next part.