Skip to Content
Technical Articles
Author's profile photo Aravind Raghavan

HANA DB Migration from Neo to Cloud Foundry

In this post, I am sharing my experience on migration of HANA DB artifacts on HANA as a Service (HaaS) on SAP Cloud Platform Neo to Cloud Foundry environment. The basic difference between both the environment for HaaS is that Cloud Foundry only supports HANA 2.0 (XS Advance) whereas Neo works with HANA 1.0 (XS Classic). So in general, this blog is applicable for HANA DB upgrade / migration from XSC to XSA.

 

Introduction

The high-level steps for the migration are:

    1. Prepare for Migration
    2. Configure SAP Cloud Connector
    3. Run XS Migration Assistant Tool
    4. Post-Migration Activities

XS Migration Assistant is a tool that exports, analyses and migrates the objects from the provided delivery unit (XSC) and writes into an XS Advanced folder structure. There are some pre & post-migration steps that needs to be carried out for successful migration, which will be explained in detail.

 

Prepare for Migration

As the first step for migrating to XS Advance environment, you would have to manually convert the XS classic objects, that XS Migration Assistant cannot migrate automatically. These are your:

    • Scripted (text-based) calculation views (*.calculationview)
    • Attribute views (*.attributeview)
    • Analytic views (*.analyticview)
    • Application Function Library (AFL) models (*.aflpmml)
    • Decision tables (*.hdbruldec)
    • XML-based analytic privileges (*.analyticprivilege)

Note: If you do not have any of the above XS Classic artifacts, you can skip this step and prepare Delivery Unit (DU).

In SAP HANA Studio / Eclipse:

SAP HANA Modeler prospective > Migrate     (also available in quick view)

Follow the wizard to complete the conversion:

Select system > Choose migration type > Select objects > Impacted objects > Finish

Once you have manually converted the deprecated artifacts, you can prepare the DU in HANA Studio / Eclipse:

SAP HANA Modeler prospective > Delivery Unit     (also available in quick view)

Add the objects you want to migrate to XS Advance environment into a Delivery Unit. Follow the wizard to complete setting up the DU:

Select system > Assign packages in delivery units > Finish

 

Configure SAP Cloud Connector

If your HANA DB is a service on SAP Cloud Platform (Neo), then you will need to install & configure SAP Cloud Connector (SCC) to be able to run the migration. Follow the steps in my other blog: Connecting XS Migration Assistant tool to HANA service on SCP (Neo), to establish a service channel to your HANA service.

If your source system for migration is on-premise, then you can directly connect XS Migration Assistant tool to your HANA DB using the Host Name and Port Number. You can skip this step.

 

Run XS Migration Assistant Tool

 

Step 1: Download and extract XS Migration Assistant from SAP Software Download Center. Search for the component “XSAC MIGRATION 1” in Downloads.

Note: The tool does not need an installation, but we can run the extracted files via command prompt.

Step 2: Run the below commands in command prompt to connect to your XS Classic system via XS Migration Assistant:

CD <location of extracted xs migration assistant tool>
set HANA_HOST = localhost
set HANA_SQL_PORT = <port configured in SCC>
set HANA_USER = <hana db user>
set HANA_PASSWD = <password>

Sample Code:

CD C:\SAP\XS_MIGRATION_00_22-70002351\xs-migration

set HANA_HOST = localhost

set HANA_SQL_PORT = 39915

set HANA_USER = SYSTEM

Note: Use an administrator user or system user to avoid privilege issues.

 

Step 3: Run the below code to start the migration process of the Delivery Unit

xs-migration --zip --target-dir <target directory> <DU name>

sample code: xs-migration –zip –target-dir C:\SAP\xs-migration\migrated_to_xsa APP_1

Note: you will have to enter a target directory that doesn’t exists. The tool will create a folder with the name specified and write the migrated filed in it.

The optional parameter “–zip” creates a zip file of the migrated content.

 

Post-Migration Activities

  • Evaluate Migration Report The generated migration report lists all the items migrated from the specified delivery unit and additional steps required are mentioned as identified by the tool. Evaluate the migration report in the target directory and re-run the migration, if required.
  • It is recommended to import the zip file to a dummy project in your workspace and then copy the required files to your main project.
  • Note that NOT all the folder & files in the imported archive is required for a successful build. HANA DB migrated atifacts will be under the folder “db > src”. XS objects (ex: .xsjob, .xsjs, .xsodata) will be written in a separate module “xsjs” of type “nodejs”.
  • You will have to verify and make changes to the mta.yaml file generated by the tool to include the additional parameters you need for your project.
  • Namespace for all the artifacts have to be maintained properly and references adjusted before building.
  • For calculation views, data sources have to be replaced with the run-time objects built in XSA and column mapping must be re-established.

Please note that these are just some common post-migration activities required for successful build & deploy of migrated HANA DB artifacts, but you might require additional steps based on the type of objects you have migrated from XSC. Here is a list of all the XSA database objects and the actions performed by the tool for each of them.

Reference SAP HANA XS Advanced Migration Guide

 


With the growing number of customer moving from Neo to Cloud Foundry, I hope this information was useful in migrating your existing application on Neo to Cloud Foundry space.

Knowledge shared is knowledge squared!  #KeepSharing 

Aravind

Assigned Tags

      10 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Massimo Tuscano
      Massimo Tuscano

      Very useful, thank you Aravind

      Author's profile photo Vishnupriya Varadharajan
      Vishnupriya Varadharajan

      Hi Aravind,

      Thanks for the blog. I have followed these steps and am able to create the migrated content.

      When I try to import it to Web IDE or BAS and build the db folder - I am getting the below error while processing the synonym-grantor-service. I have created this file using web ide and also through CF CLI with the command :

      cf cups synonym-grantor-service -p "{\"host\":\"<hostname>\",\"port\":\"<port>\",\"user\":\"<hanauser>\",\"password\":\"<hanapwd>\", \"tags\":[\"hana\"]}"

      Where would be pick this hostname from?

      Thanks in advance

      Author's profile photo Aravind Raghavan
      Aravind Raghavan
      Blog Post Author

      Hi VishnuPriya,

       

      As explained in blog, building the DB folder directly would cause issue that you cannot identify. Try to copy & paste the folder one-by-one into the DB folder and build them separately. The exact error you are facing is coming from .hdbgrant file, which could be auto-generated by XSA migration assistant tool, you can delete this file if you don't need any synonym grantor service for now. If required, It can be created by yourself later on in a successfully deployed project.

       

      Best Regards,

      Aravind

      Author's profile photo Vishnupriya Varadharajan
      Vishnupriya Varadharajan

      Thanks for that quick response Aravind.

      I am able to deploy the db folder in BAS after I deleted the .hdbgrant file(which was automatically generated using the migration tool) and the synonym grantor service which I created.

      Am able to see the tables in the new environment. I am getting some errors in Calculation Views deployment. Am checking on the same.

      Thanks again

      Author's profile photo FABIO FERRARI
      FABIO FERRARI

      Hi,

      I am facing an issue when running the xs-migration script. At the first encountered .hdbtablefunction (it's there because I migrated some SQL scripted calculation views) it returns an authorization error. Do you have any idea why?

      Thanks and BR,

      Fabio

      Error%20screenshot

      Author's profile photo Aravind Raghavan
      Aravind Raghavan
      Blog Post Author

      Hi Fabio,

      There are certain authorizations required to run the XS migration assistant tool. In my case, there were clear error messages of the authorizations missing, so I was able to add them to SYSTEM user and run the xs-migration assistant. Can you try using the SYSTEM user?

      Regards,

      Aravind

      Author's profile photo FABIO FERRARI
      FABIO FERRARI

      Hi Aravind,

      thanks for the suggestion. Yes, all images have been taken by me and there are no copyright issues whatsoever. Thanks for noticing that the blog link at the end was not the right one! I changed it!
      Thanks and BR,

      Fabio

      Author's profile photo Aravind Raghavan
      Aravind Raghavan
      Blog Post Author

      Happy to hear that Fabio. Hope the blog was of some help 🙂

       

      Best Regards,

      Aravind

      Author's profile photo Sachin Baral Ramesh
      Sachin Baral Ramesh

      Hi Aravind Raghavan ,

      Thanks for your blog and sharing your knowledge.

      I have tried to migrate xsodata service using xs-migration tool but getting error,

      peg_xsodata_parser.js:5326

      "peg$buildException(null, peg$maxFailExpected, peg$mayFailPos);"

      syntax error: expected "/*", "//",[\n\r] or [\t\x0B\f \xA0\uFEFF] but "m" found.

      Could you please suggest me how i can migrate xs odata services?

       

      Thanks,
      Sachin

      Author's profile photo Aravind Raghavan
      Aravind Raghavan
      Blog Post Author

      Hi Sachin,

      If the xsodata code is not complex, Why don't you try copy pasting the code into a new xsodata file in your XSA environment (target). I personally had followed that approach for xsodata. Removed it from the DU in source environment, migrated all the remaining context & manually copied the xsodata code to target environment. Worked well for me, but it depends on the complexity of your xsodata.

      Thanks,

      Aravind