diff --git a/tutorials/hana-cloud-migration/compatability-check-result.png b/tutorials/hana-cloud-migration/compatability-check-result.png index bf4734e9a..4f8724c40 100644 Binary files a/tutorials/hana-cloud-migration/compatability-check-result.png and b/tutorials/hana-cloud-migration/compatability-check-result.png differ diff --git a/tutorials/hana-cloud-migration/compatability-check.png b/tutorials/hana-cloud-migration/compatability-check.png index 0a03e5b84..6922e2ec9 100644 Binary files a/tutorials/hana-cloud-migration/compatability-check.png and b/tutorials/hana-cloud-migration/compatability-check.png differ diff --git a/tutorials/hana-cloud-migration/create-migration.png b/tutorials/hana-cloud-migration/create-migration.png index a4d1293f3..4fdeced5c 100644 Binary files a/tutorials/hana-cloud-migration/create-migration.png and b/tutorials/hana-cloud-migration/create-migration.png differ diff --git a/tutorials/hana-cloud-migration/hana-cloud-migration.md b/tutorials/hana-cloud-migration/hana-cloud-migration.md index ee83a2108..279e683e9 100644 --- a/tutorials/hana-cloud-migration/hana-cloud-migration.md +++ b/tutorials/hana-cloud-migration/hana-cloud-migration.md @@ -7,51 +7,59 @@ primary_tag: software-product-function>sap-hana-cloud--sap-hana-database --- # Migrate to SAP HANA Cloud from SAP HANA Platform + This tutorial demonstrates a migration from an on-premise SAP HANA database to an SAP HANA Cloud database. ## Prerequisites - - Access to, and administrative rights on, an on-premise SAP HANA database that you wish to migrate to SAP HANA Cloud such as an SAP HANA, express edition database - - Access to, and administrative rights on, an SAP HANA Cloud instance such as a free-tier instance + +- Access to, and administrative rights on, an on-premise SAP HANA database that you wish to migrate to SAP HANA Cloud +- Access to, and administrative rights on, an SAP HANA Cloud instance such as a free-tier instance ## You will learn - - About resources available to help prepare and plan for a migration - - How the Self-Service Migration tool can be used to perform a compatibility check - - Examples of how to identify and migrate schema objects, data, and HDI projects + +- About resources available to help prepare and plan for a migration +- How the Self-Service Migration tool can be used to perform a compatibility check +- Examples of how to identify and migrate schema objects, data, and HDI projects ## Overview -SAP HANA Cloud is a database-as-a service and it is one of the many services of the [SAP Business Technology Platform](https://help.sap.com/docs/btp). "Database-as-a-service" means that SAP manages updates, hardware, backups, etc. One of the benefits of SAP HANA Cloud is that it that it can be easily resized, as described at [Managing SAP HANA Database Instances](https://help.sap.com/docs/hana-cloud/sap-hana-cloud-administration-guide/managing-sap-hana-database-instances). New features are released quarterly. For further details, see [Introduction to SAP HANA Cloud](https://help.sap.com/docs/hana-cloud/sap-hana-cloud-getting-started-guide/introduction-to-sap-hana-cloud). +SAP HANA Cloud is a database-as-a service and it is one of the many services of the [SAP Business Technology Platform](https://help.sap.com/docs/btp). "Database-as-a-service" means that SAP manages updates, hardware, backups, etc. One of the benefits of SAP HANA Cloud is that it that it can be easily resized, as described at [Managing SAP HANA Database Instances](https://help.sap.com/docs/hana-cloud/sap-hana-cloud-administration-guide/managing-sap-hana-database-instances). New features are released quarterly. For further details, see [Introduction to SAP HANA Cloud](https://help.sap.com/docs/hana-cloud/sap-hana-cloud-getting-started-guide/introduction-to-sap-hana-cloud). This tutorial will illustrate steps taken to migrate a small sample dataset from an [on-premise SAP HANA database](https://help.sap.com/docs/SAP_HANA_PLATFORM) to [SAP HANA Cloud](https://help.sap.com/docs/HANA_CLOUD). It does not cover the migration of content from XS Classic, which was deprecated in July 2017 with the release of SAP HANA 2.0 SPS02. If you need to migrate XS Classic applications, please see [SAP HANA XS Advanced Migration Guide](https://help.sap.com/docs/SAP_HANA_PLATFORM/58d81eb4c9bc4899ba972c9fe7a1a115/2aa5aa246a704e199cd06ca5c84d1155.html). --- ### Planning and preparation + Planning and preparation are key to a successful migration. Migration can be an iterative process done initially in a test environment. A migration should be run during a planned downtime for production databases. SAP HANA Cloud provides an [SAP HANA Cloud, data lake Relational Engine](https://help.sap.com/docs/hana-cloud-data-lake/welcome-guide/sap-hana-cloud-data-lake-welcome-guide) that is a columnar disk-based store that can be used to store less-frequently accessed data. This may be a good time to evaluate if some of your data that is not accessed as frequently may be well suited to be stored in SAP HANA Cloud data lake, Relational Engine or SAP HANA Cloud, data lake Files. The following topics may be of help when planning a migration to SAP HANA Cloud: -* [SAP HANA Cloud Migration Guide (product documentation)](https://help.sap.com/docs/hana-cloud/sap-hana-cloud-migration-guide/sap-hana-cloud-migration-guide) +- [SAP HANA Cloud Migration Guide (product documentation)](https://help.sap.com/docs/hana-cloud/sap-hana-cloud-migration-guide/sap-hana-cloud-migration-guide) + +- [Migration to SAP HANA Cloud (sap.com)](https://www.sap.com/products/technology-platform/hana/cloud-migration./) -* [Migration to SAP HANA Cloud (sap.com)](https://www.sap.com/products/technology-platform/hana/cloud-migration./) +- [SAP Learning Journey - Migrating SAP HANA to SAP HANA Cloud](https://learning.sap.com/courses/migrating-sap-hana-to-sap-hana-cloud) -* [Migrating your SAP HANA on-premise to SAP HANA Cloud (video)](https://www.sap.com/assetdetail/2023/01/8a0f1b28-597e-0010-bca6-c68f7e60039b.html) +- [Migrating your SAP HANA on-premise to SAP HANA Cloud (video)](https://www.youtube.com/watch?v=7EgXyqNHAUI) -* [Migrate your SAP HANA Services for BTP (on Cloud Foundry) to SAP HANA Cloud using Self-Service Migration Tool (blog post)](https://community.sap.com/t5/technology-blogs-by-sap/migrate-your-sap-hana-services-for-btp-on-cloud-foundry-to-sap-hana-cloud/ba-p/13571116) +- [SAP Migration Factory for SAP BTP (sap.com)](https://www.sap.com/documents/2024/08/c637a2fb-d07e-0010-bca6-c68f7e60039b.html) -* [SAP HANA Database Upgrades and Patches (product documentation)](https://help.sap.com/docs/hana-cloud/sap-hana-cloud-administration-guide/sap-hana-database-upgrades-and-patches) +- [Migrate your SAP HANA Services for BTP (on Cloud Foundry) to SAP HANA Cloud using Self-Service Migration Tool (blog post)](https://community.sap.com/t5/technology-blogs-by-sap/migrate-your-sap-hana-services-for-btp-on-cloud-foundry-to-sap-hana-cloud/ba-p/13571116) -* [SAP HANA Database Size (product documentation)](https://help.sap.com/docs/hana-cloud/sap-hana-cloud-administration-guide/sap-hana-database-size) +- [SAP HANA Database Upgrades and Patches (product documentation)](https://help.sap.com/docs/hana-cloud/sap-hana-cloud-administration-guide/sap-hana-database-upgrades-and-patches) -* [System Limitations (product documentation)](https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-sql-reference-guide/system-limitations) +- [SAP HANA Database Size (product documentation)](https://help.sap.com/docs/hana-cloud/sap-hana-cloud-administration-guide/sap-hana-database-size) -* [SAP HANA Cloud: A Customer Perspective on Migration Success - SAP TechEd DA104 (video)](https://www.youtube.com/watch?v=ReJ_8lG98zs) +- [System Limitations (product documentation)](https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-sql-reference-guide/system-limitations) -* [All-New Webinar: NHL shares a success story of migration to SAP HANA Cloud (webinar)](https://blogs.sap.com/2022/11/16/all-new-webinar-nhl-shares-a-success-story-of-migration-to-sap-hana-cloud/) +- [SAP HANA Cloud: A Customer Perspective on Migration Success - SAP TechEd DA104 (video)](https://www.youtube.com/watch?v=ReJ_8lG98zs) +- [All-New Webinar: NHL shares a success story of migration to SAP HANA Cloud (webinar)](https://blogs.sap.com/2022/11/16/all-new-webinar-nhl-shares-a-success-story-of-migration-to-sap-hana-cloud/) ### Select an on-premise database to migrate -This tutorial uses an [SAP HANA, express edition](https://help.sap.com/docs/SAP_HANA,_EXPRESS_EDITION) instance that has been populated with the HOTEL sample schema. The steps to create the objects in the HOTEL sample schema are described in the tutorial group [Get Started with the SAP HANA Database Explorer](group.hana-cloud-get-started) and include steps to create tables, views, functions, procedures, a scheduled job, a graph workspace, a JSON document store, remote sources, as well as steps to create an HDI container. A few of the tables are shown below. + +This tutorial uses an [SAP HANA, on-premise](https://help.sap.com/docs/SAP_HANA,_EXPRESS_EDITION) instance that has been populated with the HOTELS sample schema. The steps to create the objects in the HOTELS sample schema are described in the tutorial group [Get Started with the SAP HANA Database Explorer](group.hana-cloud-get-started) and include steps to create tables, views, functions, procedures, a scheduled job, a graph workspace, a JSON document store, remote sources, as well as steps to create an HDI container. A few of the tables are shown below. ![source database to be migrated](source-database.png) @@ -65,30 +73,31 @@ SELECT DATABASE_NAME, HOST, SQL_PORT, SERVICE_NAME WHERE SQL_PORT != 0; ``` -In this tutorial, the content from a tenant database (HXE), will migrated. When migrating from a multi-tenant database, each tenant database is migrated to a dedicated SAP HANA Cloud database instance. +In this tutorial, the content from a tenant database (HXE), will be migrated. When migrating from a multi-tenant database, each tenant database is migrated to a dedicated SAP HANA Cloud database instance. ### Select an SAP HANA Cloud database + This tutorial uses an SAP HANA Cloud free tier instance as the migration target. The following tutorials cover how to sign up for and create a free-tier SAP HANA Cloud instance. - * [Help Thomas Get Started with SAP HANA](hana-trial-advanced-analytics) (Only the first 3 steps of this tutorial are needed for basic setup of SAP HANA Cloud.) +- [Help Thomas Get Started with SAP HANA](hana-trial-advanced-analytics) (Only the first 3 steps of this tutorial are needed for basic setup of SAP HANA Cloud.) - * [Set Up Your SAP HANA Cloud, SAP HANA Database (free tier or trial) and Understand the Basics](group.hana-cloud-get-started-1-trial) +- [Set Up Your SAP HANA Cloud, SAP HANA Database and Understand the Basics](group.hana-cloud-get-started-1-trial) - * [SAP Learning Journey - Provisioning and Administration with SAP HANA Cloud](https://learning.sap.com/learning-journeys/provision-and-administer-databases-in-sap-hana-cloud) +- [SAP Learning Journey - Provisioning and Administration with SAP HANA Cloud](https://learning.sap.com/learning-journeys/provision-and-administer-databases-in-sap-hana-cloud) - * [SAP Discovery Center - Learn the fundamentals of SAP HANA Cloud, SAP HANA database](https://discovery-center.cloud.sap/protected/index.html#/missiondetail/3643/) +- [SAP Discovery Center - Learn the fundamentals of SAP HANA Cloud, SAP HANA database](https://discovery-center.cloud.sap/protected/index.html#/missiondetail/3643/) - * [SAP HANA Cloud Getting Started Guide](https://help.sap.com/docs/hana-cloud/sap-hana-cloud-getting-started-guide/sap-hana-cloud-getting-started-guide) +- [SAP HANA Cloud Getting Started Guide](https://help.sap.com/docs/hana-cloud/sap-hana-cloud-getting-started-guide/sap-hana-cloud-getting-started-guide) Before proceeding, ensure that you have access to a running SAP HANA Cloud instance as shown below. ![SAP HANA Cloud provisioned](HANA-Cloud-instances-other.png) - ### SAP HANA compatibility + The version of an SAP HANA database can be found in the Database Information card in SAP HANA cockpit, or through a SQL query against the `M_DATABASE` view. The version of both the source and target database should be checked. The Self-Service Migration tool requires the source database to be 2.00.053 or higher while certain features such as the ability of the [EXPORT INTO](https://help.sap.com/docs/hana-cloud/sap-hana-cloud-administration-guide/sap-hana-cloud-administration-guide) statement that supports cloud storage providers requires a 2.0 SPS 06 database. -SAP HANA, express edition 2.0 SPS06. +SAP HANA, on-premise 2.0 SPS06. ![database version 2.0](database-version.png) @@ -98,25 +107,15 @@ SAP HANA Cloud Different versions of SAP HANA databases will have slightly different features. This topic is covered in detail at [Compatibility with Other SAP HANA Versions](https://help.sap.com/docs/hana-cloud/sap-hana-cloud-migration-guide/compatibility-with-other-sap-hana-versions). - ### Self-Service Migration tool -The Self-Service Migration tool can be used when performing a migration. It automates the migration process and can reduce the cost and effort of a migration. It is a free service and SAP manages the temporary storage used during the migration. This tool is accessed from SAP HANA Cloud Central, the main tool for creating and configuring SAP HANA Cloud instances. For more information about SAP HANA Cloud Central, see [SAP HANA Cloud Administration Guide](https://help.sap.com/docs/hana-cloud/sap-hana-cloud-administration-guide/sap-hana-cloud-administration-guide). - -![Migrations in SAP HANA Cloud Central](migrations.png) - ->The Self-Service Migration tool is supported in free tier but not in trial. - -![List of migrations](self-service-migration.png) -The Self-Service Migration tool supports migration to SAP HANA Cloud from SAP HANA 2.0 databases, as shown below. - -![create migration dialog](create-migration.png) +The Self-Service Migration tool can be used when performing a migration. It automates the migration process and can reduce the cost and effort of a migration. It is a free service, and SAP manages the temporary storage used during the migration. In order to connect from the Self-Service Migration tool running in the public internet to an on-premise SAP HANA database, you need to install and configure the [SAP Cloud Connector](https://help.sap.com/docs/CP_CONNECTIVITY/cca91383641e40ffbe03bdc78f00f681/e54cc8fbbb571014beb5caaf6aa31280.html). ![SAP Cloud Connector](cloud-connector.png) -The cloud connector provides connectivity from a public internet where SAP HANA Cloud is running to an on-premise SAP HANA database. Step-by-step instructions are provided at [Connect from SAP HANA Cloud to SAP HANA, express edition via the Cloud Connector](hana-dbx-remote-sources). +The cloud connector provides connectivity from a public internet where SAP HANA Cloud is running to an on-premise SAP HANA database. Follow steps 1-6 in [Connect from SAP HANA Cloud to SAP HANA, express edition via the Cloud Connector](hana-dbx-remote-sources) for detailed instructions. Once the cloud connector has been installed and configured to connect to a BTP subaccount, it will appear as shown below in the SAP BTP Cockpit. @@ -126,7 +125,20 @@ The Self-Service Migration tool requires connectivity_proxy plan entitlement to ![connectivity proxy](connectivity-proxy.png) -The Self-Service Migration tool also requires a migration user. For additional details on how to create the migration user, see [Create the Migration User in the Source Database](https://help.sap.com/docs/hana-cloud/sap-hana-cloud-migration-guide/create-migration-user). +The Self-Service Migration tool also requires the source database to have a migration user. For additional details on how to create the migration user, see [Create the Migration User in the Source Database](https://help.sap.com/docs/hana-cloud/sap-hana-cloud-migration-guide/create-migration-user). + +After the migration user has been created, it must be granted sufficient privileges to read and transfer data associated with these accounts. For this tutorial, we are migrating the users USER1 and USER2 and the schema HOTELS. You can grant the required access using statements such as the following: + +```SQL +CONNECT USER1 PASSWORD Password1; +SELECT CURRENT_USER FROM DUMMY; +GRANT SELECT ON SCHEMA "USER1" TO MIG; +GRANT SELECT ON SCHEMA "HOTELS" TO MIG; + +CONNECT USER2 PASSWORD Password2; +SELECT CURRENT_USER FROM DUMMY; +GRANT SELECT ON SCHEMA "USER2" TO MIG; +``` The Self-Service Migration tool can now be used to assist with a migration such as an SAP HANA on-premise migration to SAP HANA Cloud. @@ -138,10 +150,29 @@ CREATE TABLE TEST( ); ``` +The Self-Service Migration tool is accessed from SAP HANA Cloud Central, the main tool for creating and configuring SAP HANA Cloud instances. For more information about SAP HANA Cloud Central, see [SAP HANA Cloud Administration Guide](https://help.sap.com/docs/hana-cloud/sap-hana-cloud-administration-guide/sap-hana-cloud-administration-guide). + +![Migrations in SAP HANA Cloud Central](migrations.png) + +![List of migrations](self-service-migration.png) + +The Self-Service Migration tool supports migration to SAP HANA Cloud from SAP HANA 2.0 databases, as shown below. + +![create migration dialog](create-migration.png) The first step on the Plan tab in the tool is a compatibility check. ![compatibility report](compatability-check.png) +In SAP HANA Cloud Central, you can choose from multiple migration patterns depending on your requirements and how much of your source system you want to move. Each option provides a different level of control over what gets migrated: + +- Full Database Migration: Migrates the entire source database, including all schemas and objects. This is the recommended option for complete system moves where no filtering is required. You can optionally choose to exclude database users if you prefer to manage users separately in the target system. + +- Selective Migration: Allows you to migrate only specific database objects based on your needs. This helps reduce migration time and effort by excluding unnecessary data. When using this option, ensure that any required database users already exist in the target system, as they are not automatically created. + +- Data-only Migration: Migrates only the data for selected database objects. This option assumes that the corresponding schemas and tables already exist in the target system, so you must prepare the structure in advance before running the migration. + +![migration options](migration-options.png) + The presence of the previously created table is flagged during the compatibility check because the SYSTEM user is not accessible in SAP HANA Cloud. ![migration report](compatability-check-result.png) @@ -154,15 +185,18 @@ A completed migration is shown below. For further details see: - * [Migration Scenarios Supported by the Self-Service Migration for SAP HANA Cloud Tool](https://help.sap.com/docs/hana-cloud/sap-hana-cloud-migration-guide/migration-scenarios-supported-by-self-service-migration-for-sap-hana-cloud-tool) +- [Migration Scenarios Supported by the Self-Service Migration for SAP HANA Cloud Tool](https://help.sap.com/docs/hana-cloud/sap-hana-cloud-migration-guide/migration-scenarios-supported-by-self-service-migration-for-sap-hana-cloud-tool) - * [Checks Performed by the Migration Tool](https://help.sap.com/docs/hana-cloud/sap-hana-cloud-migration-guide/checks-performed-by-migration-tool) +- [Checks Performed by the Migration Tool](https://help.sap.com/docs/hana-cloud/sap-hana-cloud-migration-guide/checks-performed-by-migration-tool) - * [SAP HANA Cloud Migration: Setup your on-premise HANA system for the Self-Service Migration tool](https://community.sap.com/t5/technology-blogs-by-sap/sap-hana-cloud-migration-setup-your-on-premise-hana-system-for-the-self/ba-p/13549100) +- [SAP HANA Cloud Migration: Setup your on-premise HANA system for the Self-Service Migration tool](https://community.sap.com/t5/technology-blogs-by-sap/sap-hana-cloud-migration-setup-your-on-premise-hana-system-for-the-self/ba-p/13549100) If you wish to perform all or part of a migration manually rather than using the Self-Service Migration tool, the following are some steps to consider. ### Database configuration + +The following steps offer some insights into steps that could be performed should you wish to manually migrate your database. + SAP HANA databases enable configuration through a set of `ini` files. These files can be modified through multiple methods including the SAP HANA cockpit database configuration app and ALTER SQL statements. ![database configuration app](database-configuration.png) @@ -205,7 +239,6 @@ SELECT * FROM M_INIFILE_CONTENT_HISTORY; --ALTER SYSTEM CLEAR INIFILE CONTENT HISTORY; ``` - The [SAP Note: 1969700 - SQL Statement Collection for SAP HANA](https://launchpad.support.sap.com/#/notes/1969700) provides multiple queries that can be used to examine configuration settings. One example is the HANA configuration parameters check shown below. ![example of a mini check](hana-configuration-parameters.png) @@ -214,19 +247,19 @@ When migrating a database, it is important to review any non-default settings an Additional details on configuration parameters can be found at the links below: - * [Configuring SAP HANA System Properties (INI Files) (On-Prem)](https://help.sap.com/docs/SAP_HANA_PLATFORM/6b94445c94ae495c83a19646e7c3fd56/3f1a6a7dc31049409e1a9f9108d73d51.html) +- [Configuring SAP HANA System Properties (INI Files) (On-Prem)](https://help.sap.com/docs/SAP_HANA_PLATFORM/6b94445c94ae495c83a19646e7c3fd56/3f1a6a7dc31049409e1a9f9108d73d51.html) - * [SAP HANA Configuration Parameter Reference (On-Prem)](https://help.sap.com/docs/SAP_HANA_PLATFORM/009e68bc5f3c440cb31823a3ec4bb95b/4b4d88980622427ab2d6ca8c05448166.html) +- [SAP HANA Configuration Parameter Reference (On-Prem)](https://help.sap.com/docs/SAP_HANA_PLATFORM/009e68bc5f3c440cb31823a3ec4bb95b/4b4d88980622427ab2d6ca8c05448166.html) - * [Configuring SAP HANA System Properties (INI Files) (SAP HANA Cloud)](https://help.sap.com/docs/HANA_CLOUD_DATABASE/f9c5015e72e04fffa14d7d4f7267d897/3f1a6a7dc31049409e1a9f9108d73d51.html) +- [Configuring SAP HANA System Properties (INI Files) (SAP HANA Cloud)](https://help.sap.com/docs/HANA_CLOUD_DATABASE/f9c5015e72e04fffa14d7d4f7267d897/3f1a6a7dc31049409e1a9f9108d73d51.html) - * [SAP HANA Configuration Parameter Reference (SAP HANA Cloud)](https://help.sap.com/docs/HANA_CLOUD_DATABASE/138dcf7d779543608917a2307a6115f2/4b4d88980622427ab2d6ca8c05448166.html) +- [SAP HANA Configuration Parameter Reference (SAP HANA Cloud)](https://help.sap.com/docs/HANA_CLOUD_DATABASE/138dcf7d779543608917a2307a6115f2/4b4d88980622427ab2d6ca8c05448166.html) - * [SAP Note: 2186744 - FAQ: SAP HANA Parameters](https://launchpad.support.sap.com/#/notes/2186744) +- [SAP Note: 2186744 - FAQ: SAP HANA Parameters](https://launchpad.support.sap.com/#/notes/2186744) -### Exporting and importing users and roles +### Export and import users and roles -In the sample [HOTEL dataset](hana-dbx-create-schema) used in this tutorial, two users and two roles were created. +In the sample [HOTELS dataset](hana-dbx-create-schema) used in this tutorial, two users and two roles were created. 1. Identify the users that have been created in the source database. Note that you can also view when a user last successfully connected. You may wish to review users that have not connected to the database in a while to decide if you want to include them in the migration. @@ -265,12 +298,13 @@ In the sample [HOTEL dataset](hana-dbx-create-schema) used in this tutorial, two ![Users in a role](users-in-a-role.png) -### Exporting and importing table data (optional) +### Export and import table data (optional) + The [EXPORT INTO](https://help.sap.com/viewer/4fe29514fd584807ac9f2a04f6754767/latest/en-US/6a6f59bbfbb64ade84d83d7f87789753.html) statement can be used to export the data from a table or view into a CSV file on the on-premise SAP HANA file system or to a cloud storage provider. The tutorial [Export and Import Data and Schema with SAP HANA Database Explorer](hana-dbx-export-import) details the required steps to configure the an SAP HANA database to be able to connect to SAP HANA Cloud, Data Lake Files, or a cloud storage provider. ->The next step in this tutorial, exporting and importing catalog objects, explains how to export and import multiple objects in one operation. The catalog export/import statements support additional output types such as binary and parquet, in addition to CSV, and would be a better choice for most migrations. +>The next step in this tutorial, export and import catalog objects, explains how to export and import multiple objects in one operation. The catalog export/import statements support additional output types such as binary and parquet, in addition to CSV, and would be a better choice for most migrations. 1. The below SQL exports the data from the HOTEL table into a CSV file in a Microsoft Azure blob container. @@ -299,13 +333,12 @@ The tutorial [Export and Import Data and Schema with SAP HANA Database Explorer] "STATE" NVARCHAR(2) NOT NULL, "ZIP" NVARCHAR(6), "LOCATION" ST_POINT(4326), - PRIMARY KEY( - "HNO" - ) + PRIMARY KEY( + "HNO" + ) ); IMPORT FROM CSV FILE 'azure://dansblobcont/hotel.csv' INTO HOTEL WITH CREDENTIAL 'Azure'; - ``` ![create table and import data](import-data.png) @@ -317,19 +350,20 @@ The tutorial [Export and Import Data and Schema with SAP HANA Database Explorer] CALL PUBLIC.CHECK_REMOTE_SOURCE('REMOTE_HC'); - CREATE VIRTUAL TABLE VT_CUSTOMER AT "REMOTE_HC"."HC_HDB".HOTEL."CUSTOMER"; - INSERT INTO VT_CUSTOMER SELECT * FROM HOTEL.CUSTOMER;" + CREATE VIRTUAL TABLE VT_CUSTOMER AT "REMOTE_HC"."HC_HDB".HOTELS."CUSTOMER"; + INSERT INTO VT_CUSTOMER SELECT * FROM HOTELS.CUSTOMER;" ``` There are other options to move data from one SAP HANA database to another, such as using Smart Data Integration, that may also be considered. -### Exporting and importing catalog objects +### Export and import catalog objects + The [EXPORT](https://help.sap.com/docs/SAP_HANA_PLATFORM/4fe29514fd584807ac9f2a04f6754767/20da0bec751910148e69c9668ea3ccb8.html) statement can be used to export one or more catalog objects, including the SQL definition required to recreate the object, and optionally the data, in the objects being exported. You can export the content to the on-premise SAP HANA file system, to SAP HANA Cloud data lake Files, or to a cloud storage provider. The tutorial [Export and Import Data and Schema with SAP HANA Database Explorer](hana-dbx-export-import) provides additional details. 1. Export database objects: This example exports database objects from a source database (an SAP HANA, express edition database) to cloud storage (Microsoft Azure). ```SQL - EXPORT ALL HAVING schema_name = 'HOTEL' AS BINARY DATA INTO 'azure://dansblobcont/export/' WITH CREDENTIAL 'Azure'; + EXPORT ALL HAVING schema_name = 'HOTELS' AS BINARY DATA INTO 'azure://dansblobcont/export/' WITH CREDENTIAL 'Azure'; ``` Notice that the data is being exported in a BINARY DATA format, which is more efficient than CSV format. It is also possible to export the schema only by adding CATALOG ONLY to the end of the above export statement. @@ -346,10 +380,9 @@ The [EXPORT](https://help.sap.com/docs/SAP_HANA_PLATFORM/4fe29514fd584807ac9f2a0 In the SAP HANA release used in this tutorial, scheduled jobs are not included in the catalog export. +2. Import the database objects: This example imports the previously exported schema objects and data into the target database (an SAP HANA Cloud database). `GUEST_NOTES` is excluded because the JSON document store is not supported in the free tier service. -2. Import the database objects: This example imports the previously exported schema objects and data into the target database (an SAP HANA Cloud database). `GUEST_NOTES` is exculded because the JSON document store is not supported in free tier or trial environments. - - ```SQL Free Tier or Trial + ```SQL Free Tier IMPORT ALL HAVING OBJECT_NAME != 'GUEST_NOTES' FROM 'azure://dansblobcont/export/' WITH CREDENTIAL 'Azure'; ``` @@ -371,8 +404,8 @@ The [EXPORT](https://help.sap.com/docs/SAP_HANA_PLATFORM/4fe29514fd584807ac9f2a0 It is also possible to use the Export and Import Catalog wizards in the SAP HANA database explorer with zip files that are downloaded and uploaded through the browser with smaller datasets. For larger datasets it is recommended to use SAP HANA Cloud, data lake Files or a cloud storage provider such as Microsoft Azure, Amazon, or Google. +### Export and import SAP HANA Deployment Infrastructure (HDI) projects -### Exporting and importing SAP HANA Deployment Infrastructure (HDI) projects HDI containers contain both design time and runtime artifacts. In addition to objects such as tables and views, they can contain additional advanced SAP HANA artifacts such as calculation views, flow graphs, and replication tasks. The list of HDI container groups and containers can be seen by executing the below SQL statements. @@ -428,10 +461,16 @@ The recommended tool for native application development with SAP HANA Cloud is t ![Bind project](bind.png) + Click on the Bind icon. + ![Bind to the default instance](bind2.png) + Select "Bind to the default instance: " + ![progress dialog](bind3.png) + Wait for the operation to complete. + ![binding success](bind4.png) The details of the binding are contained in `db/.env` file. If the `.env` file does not appear, perform the bind operation a second time. @@ -450,9 +489,11 @@ The recommended tool for native application development with SAP HANA Cloud is t ![open the HDI container in the SAP HANA database explorer](open-dbx.png) + Select Open HDI conatiner. + ![open data in the SAP HANA database explorer](open-data.png) -12. A similar set of steps to those followed in the exporting and importing catalog objects steps can be followed to move the data. +12. A similar set of steps to those followed in the export and import catalog objects steps can be followed to move the data. In the source and destination HDI containers, the RT (runtime user) will need to be given sufficient privileges. The RT user's name can be seen by executing the below SQL when connected to an HDI container. This user name is needed for the subsequent steps. @@ -488,8 +529,8 @@ The recommended tool for native application development with SAP HANA Cloud is t The data for the tables in the HDI container should now be available in the SAP HANA Cloud HDI container. +### Connect applications to SAP HANA Cloud -### Connect from applications to SAP HANA Cloud When connecting to an SAP HANA Cloud database, an encrypted connection must be used. By default, the [SAP HANA Client](https://help.sap.com/docs/SAP_HANA_CLIENT) enables encrypted connections when the port is 443. The port for SAP HANA Cloud SQL is always 443. The host name (and port) can be obtained from SAP HANA Cloud Central as shown below. @@ -500,23 +541,23 @@ To connect to SAP HANA Cloud, the SAP HANA Client is used. The same client is u A few examples of connections to an SAP HANA Cloud database are shown below. The essential parts of a connection are the host, port, user ID and password. -* SAP HANA database explorer +- SAP HANA database explorer ![SAP HANA database explorer connection](dbx-connection.png) -* HDBSQL +- HDBSQL ![HDBSQL connection](hdbsql.png) For additional details see [Connect to SAP HANA using HDBSQL](hana-clients-hdbsql). -* ODBC +- ODBC ![odbc connection](odbc.png) For additional details, see [Connect Using the SAP HANA ODBC Driver](hana-clients-odbc). -* HDI +- HDI The connection details to an HDI container can be found in the service binding. @@ -532,12 +573,8 @@ A few examples of connections to an SAP HANA Cloud database are shown below. Th To see details of additional connections including JDBC, Node.js, Python, Go, and .NET, see [Use Clients to Query an SAP HANA Database](mission.hana-cloud-clients). - - - ### Knowledge check Congratulations! You now have an overview of some of the tasks involved with a migration from an on-premise SAP HANA database to an SAP HANA Cloud instance. - --- diff --git a/tutorials/hana-cloud-migration/login-cf.png b/tutorials/hana-cloud-migration/login-cf.png index bf29d857e..ce0d9cc42 100644 Binary files a/tutorials/hana-cloud-migration/login-cf.png and b/tutorials/hana-cloud-migration/login-cf.png differ diff --git a/tutorials/hana-cloud-migration/migration-options.png b/tutorials/hana-cloud-migration/migration-options.png new file mode 100644 index 000000000..97665c743 Binary files /dev/null and b/tutorials/hana-cloud-migration/migration-options.png differ diff --git a/tutorials/hana-cloud-migration/migration-phases.png b/tutorials/hana-cloud-migration/migration-phases.png index cdc5f8ffc..8d510988f 100644 Binary files a/tutorials/hana-cloud-migration/migration-phases.png and b/tutorials/hana-cloud-migration/migration-phases.png differ diff --git a/tutorials/hana-cloud-migration/odbc.png b/tutorials/hana-cloud-migration/odbc.png index 76557b1d9..5ec91e82b 100644 Binary files a/tutorials/hana-cloud-migration/odbc.png and b/tutorials/hana-cloud-migration/odbc.png differ diff --git a/tutorials/hana-cloud-migration/self-service-migration.png b/tutorials/hana-cloud-migration/self-service-migration.png index c9b012b0a..fb9eea317 100644 Binary files a/tutorials/hana-cloud-migration/self-service-migration.png and b/tutorials/hana-cloud-migration/self-service-migration.png differ diff --git a/tutorials/hana-dbx-remote-sources/cloud-connector-subaccount.png b/tutorials/hana-dbx-remote-sources/cloud-connector-subaccount.png index 0d2459dd5..b958d5eab 100644 Binary files a/tutorials/hana-dbx-remote-sources/cloud-connector-subaccount.png and b/tutorials/hana-dbx-remote-sources/cloud-connector-subaccount.png differ diff --git a/tutorials/hana-dbx-remote-sources/cloud-foundry-sub-account.png b/tutorials/hana-dbx-remote-sources/cloud-foundry-sub-account.png index 9422c68a1..bade07be7 100644 Binary files a/tutorials/hana-dbx-remote-sources/cloud-foundry-sub-account.png and b/tutorials/hana-dbx-remote-sources/cloud-foundry-sub-account.png differ diff --git a/tutorials/hana-dbx-remote-sources/hana-dbx-remote-sources.md b/tutorials/hana-dbx-remote-sources/hana-dbx-remote-sources.md index c1b4b4ad1..2617fa595 100644 --- a/tutorials/hana-dbx-remote-sources/hana-dbx-remote-sources.md +++ b/tutorials/hana-dbx-remote-sources/hana-dbx-remote-sources.md @@ -7,18 +7,22 @@ primary_tag: software-product>sap-hana-cloud --- # Access Remote Sources with SAP HANA Database Explorer + Use SAP HANA federation capabilities to query data from other SAP HANA and SAP HANA Cloud, data lake Relational Engine databases using SAP HANA smart data access (SDA) and the Cloud Connector. ## Prerequisites - - You have completed the first 3 tutorials in this group - - Two SAP HANA databases and an SAP HANA Cloud, data lake instance + +- You have completed the first 3 tutorials in this group +- Two SAP HANA databases and an SAP HANA Cloud, data lake instance ## You will learn - - How to use SAP HANA smart data access (SDA) to create connections (remote sources) to other databases - - How to create virtual tables from a remote source - - How to setup the Cloud Connector to enable a remote source from SAP HANA Cloud to an on-premise SAP HANA database + +- How to use SAP HANA smart data access (SDA) to create connections (remote sources) to other databases +- How to create virtual tables from a remote source +- How to setup the Cloud Connector to enable a remote source from SAP HANA Cloud to an on-premise SAP HANA database ## Intro + Remote sources are connections to other databases. Virtual tables use a remote source to create a local table that points to data stored in another database. Federated queries make use of virtual and non virtual tables. To illustrate these concepts, a table will be created in the remote database that contains fictitious review data from some of the top tourist sites near a given hotel. There is likely a correlation between hotel stays and the desire for customers to visit nearby tourist attractions or restaurants. @@ -31,13 +35,14 @@ For additional details on SAP HANA smart data access (SDA) and SAP HANA Smart Da The example in step 1 demonstrates connectivity from an on-premise, SAP HANA, express edition database to an SAP HANA Cloud, SAP HANA  database. The example in step 2 demonstrates a connection from an SAP HANA Cloud, SAP HANA  database to an SAP HANA Cloud, data lake Relational Engine. The example in step 3 demonstrates connecting from SAP HANA Cloud, data lake Relational Engine to an SAP HANA Cloud, SAP HANA  database. The example in step 4 demonstrates connecting from one SAP HANA Cloud, data lake Relational Engine to another. The example in step 5 demonstrates connecting from SAP HANA Cloud, database via the Cloud Connector to an SAP HANA, express edition database. - --- ### Connect from SAP HANA, express edition to SAP HANA Cloud, SAP HANA database + 1. From SAP HANA Cloud Central, select an SAP HANA database instance (HDB), open the SAP HANA database explorer, and execute the following SQL statements to create the `tourist_reviews` table. >If needed, first create a schema and user. + ```SQL CREATE SCHEMA HOTELS; CREATE USER USER1 PASSWORD Password1 no force_first_password_change; @@ -86,7 +91,6 @@ The example in step 1 demonstrates connectivity from an on-premise, SAP HANA, ex ![Add remote source properties](AddRemoteSource2.png) - Additional details can be found at [CREATE REMOTE SOURCE Statement](https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-sql-reference-guide/create-remote-source-statement-access-control). > The ServerNode can be copied from SAP HANA Cloud Central by choosing **Actions > Copy SQL Endpoint**. @@ -111,9 +115,8 @@ The example in step 1 demonstrates connectivity from an on-premise, SAP HANA, ex ![on-premise to cloud remote connection](onprem-to-cloud-connection.png) - Open the SAP HANA database explorer from the SAP HANA, express edition. - + >If needed, create the HOTELS schema and a user who can access the schema. ```SQL @@ -156,10 +159,10 @@ The example in step 1 demonstrates connectivity from an on-premise, SAP HANA, ex SELECT * FROM HOTELS.VT_TOURIST_REVIEWS; SELECT C.NAME, TR.REVIEW, REVIEW_DATE FROM - HOTELS.RESERVATION AS R JOIN - HOTELS.VT_TOURIST_REVIEWS AS TR - ON TR.REVIEW_DATE = R.ARRIVAL JOIN - HOTELS.CUSTOMER AS C + HOTELS.RESERVATION AS R JOIN + HOTELS.VT_TOURIST_REVIEWS AS TR + ON TR.REVIEW_DATE = R.ARRIVAL JOIN + HOTELS.CUSTOMER AS C ON C.CNO = R.CNO; ``` @@ -178,11 +181,10 @@ The example in step 1 demonstrates connectivity from an on-premise, SAP HANA, ex Notice that the virtual table is editable. - A benefit of a virtual table is that there is no data movement. There is only one location where the data is persisted. As seen above, this can lead to longer query times when accessing remote data. - ### Connect from SAP HANA Cloud, SAP HANA database to a data lake Relational Engine + [SAP HANA Cloud, data lake](https://help.sap.com/docs/hana-cloud-data-lake) can be used to store large amounts of data that is not accessed and updated as frequently as data in an SAP HANA database. The following steps create the table `tourist_reviews` in SAP HANA Cloud, data lake Relational Engine and access the table from the associated HDB instance. 1. If needed, in SAP HANA Cloud Central, add an SAP HANA Cloud, data lake (HDLRE) instance to your SAP HANA Cloud instance, by choosing **Actions > Add Data Lake**. @@ -196,7 +198,7 @@ A benefit of a virtual table is that there is no data movement. There is only o 3. Execute the following SQL to create a table named `tourist_reviews` in the HDLRE. >If needed, first create the required schema and role. - + ```SQL --Create a schema for the sample hotel dataset CREATE SCHEMA HOTELS; @@ -289,6 +291,7 @@ A benefit of a virtual table is that there is no data movement. There is only o > Another approach is to use a relational container. For additional details see [Manage Relational Containers in Data Lake Relational Engine (SAP HANA DB-Managed)](https://help.sap.com/docs/SAP_HANA_DATA_LAKE/9220e7fec0fe4503b5c5a6e21d584e63/0b494fedebb243fc9bd92c87bac7ddd4.html). An example follows. > + ```SQL CALL SYSHDL.CREATE_CONTAINER('HOTELS_CONTAINER', 'DBADMIN'); CREATE VIRTUAL TABLE TOURIST_REVIEWS ( @@ -308,8 +311,8 @@ A benefit of a virtual table is that there is no data movement. There is only o CALL SYSHDL.DELETE_CONTAINER('HOTELS_CONTAINER'); ``` - ### Connect from a data lake Relational Engine to SAP HANA Cloud, SAP HANA database + The first task in preparing the HDLRE instance is creating a remote server that connects the HDLRE to the HDB instance that contains the data you want to access. 1. First, right click the HDB in Database Explorer and select properties. @@ -337,7 +340,7 @@ The first task in preparing the HDLRE instance is creating a remote server that ``` 5. Now that the remote server is created, you must create the `EXTERNLOGIN` that will map your HDLRE user to the HANA user credentials and allow access to the HDB. Notice below in the `CREATE EXTERNLOGIN` statement you are granting your HDLRE user permission to use the HANA user for the `HDB_SERVER` that was created above. - + ```SQL -- Replace `` with the current HDLRE user that is being used and replace `` and `` with the target HANA database user password. @@ -367,19 +370,19 @@ The first task in preparing the HDLRE instance is creating a remote server that SELECT * FROM VT_HDB_TOURIST_REVIEWS; --DROP TABLE VT_HDB_TOURIST_REVIEWS; ``` - ![Test Query Results](test_query.png) - + ![Test Query Results](test_query.png) ### Connect from a data lake Relational Engine to another data lake Relational Engine + When connecting from one HDLRE instance to another, the steps follow a similar pattern to connecting from an HDLRE to an HDB instance (Step 2 of this tutorial). 1. First, right click the HDLRE instance you want to connect to in Database Explorer (your target instance) and select properties. - + ![Target HDLRE Properties](target_hdlre_properties.png) 2. In the properties modal, copy the “Host” value to use when creating a remote server to the HDB. - + ![Host Value of Target HDLRE](target_hdlre_hostID.png) 3. Open your main HDLRE in SAP HANA database explorer and open an SQL Console. @@ -387,7 +390,7 @@ When connecting from one HDLRE instance to another, the steps follow a similar p ![Open HDLRE SQL Console](hdlre_sql_console1.png) 4. Run the following SQL query against the HDLRE instance using a user with the `MANAGE ANY REMOTE SERVER` privilege to create a remote server. Notice, you are naming the remote server HDLRE_SERVER. Replace the `` with the host copied from the properties modal. - + ```SQL CREATE SERVER HDLRE_SERVER CLASS 'IQODBC' USING 'DRIVER=libodbc17_r.so; @@ -409,7 +412,7 @@ When connecting from one HDLRE instance to another, the steps follow a similar p >If you would prefer to use USER1 instead of HDLADMIN, execute the `GRANT MANAGE ANY USER TO USER1;` query as described [here](https://help.sap.com/docs/hana-cloud-data-lake/sql-reference-for-data-lake-relational-engine/create-externlogin-statement-for-data-lake-relational-engine). 6. Do a quick test to ensure everything has been set up successfully. You will create a temporary table that points to your TOURIST_REVIEWS table in your target HDLRE. Then run a select against that table to ensure you are getting data back. - + ```SQL CREATE EXISTING LOCAL TEMPORARY TABLE VT_HDLRE_TOURIST_REVIEWS ( @@ -427,13 +430,14 @@ When connecting from one HDLRE instance to another, the steps follow a similar p ![HDLRE Temporary Table Test](successful_hdlre_table.png) ### Connect from SAP HANA Cloud to SAP HANA, express edition via the Cloud Connector (optional) + The [Cloud Connector](https://help.sap.com/docs/connectivity/sap-btp-connectivity-cf/cloud-connector?version=Cloud) enables communication from the SAP BTP running in the public internet to securely connect to a configured on-premise system such as SAP HANA, express edition. 1. Enable the Cloud Connector connectivity in SAP HANA Cloud Central: Actions > Manage Configuration > Edit. ![Enable the Cloud Connector](enable-cloud-connector.png) -2. [Download the Cloud Connector](https://tools.hana.ondemand.com/#cloud). The software needs to run on a machine that can access your on-premise SAP HANA instance. In this example, the Cloud Connector is running on Windows and is accessing an SAP HANA, express edition database running in a VM on the same machine. +2. [Download the Cloud Connector](https://tools.hana.ondemand.com/#cloud). The software needs to run on a machine that can access your on-premise SAP HANA instance. In this example, the Cloud Connector is running on Windows and is accessing an SAP HANA, express edition database running in a VM on the same machine. 3. As described at [Installation on Microsoft Windows OS](https://help.sap.com/docs/connectivity/sap-btp-connectivity-cf/installation-on-microsoft-windows-os?version=Cloud), a Java JDK is required. @@ -454,18 +458,11 @@ The [Cloud Connector](https://help.sap.com/docs/connectivity/sap-btp-connectivit The initial user name and password are Administrator and manage. -5. Configure the Cloud Connector to connect to the Cloud Foundry subaccount. +5. Configure the Cloud Connector to connect to the Cloud Foundry subaccount using Configure using authentication data. ![subaccount](cloud-connector-subaccount.png) - >The location ID is used when multiple Cloud Connectors are connected to the same subaccount - - >--- - - >If you are an SAP employee, you may need to enter your password + a time-based passcode as the password. - - - The region and subaccount ID can be found in the SAP BTP cockpit. + Authentication Data can be downloaded from the SAP BTP cockpit ![cloud Foundry sub account](cloud-foundry-sub-account.png) @@ -477,7 +474,7 @@ The [Cloud Connector](https://help.sap.com/docs/connectivity/sap-btp-connectivit 6. Configure the Cloud Connector to connect to the on-premise database. - Select **Cloud To On-Premise** and press the **+** icon. + Select **Cloud To On-Premises** and press the **+** icon. Select **SAP HANA** for the back-end type. @@ -505,10 +502,10 @@ The [Cloud Connector](https://help.sap.com/docs/connectivity/sap-btp-connectivit ```SQL CREATE REMOTE SOURCE REMOTE_HANA_EXPRESS - ADAPTER "hanaodbc" - CONFIGURATION 'ServerNode=hxehost:39015;use_haas_socks_proxy=true;driver=libodbcHDB.so;' - WITH CREDENTIAL TYPE 'PASSWORD' - USING 'user=User1;password=Password1'; + ADAPTER "hanaodbc" + CONFIGURATION 'ServerNode=hxehost:39015;use_haas_socks_proxy=true;driver=libodbcHDB.so;' + WITH CREDENTIAL TYPE 'PASSWORD' + USING 'user=User1;password=Password1'; CALL PUBLIC.CHECK_REMOTE_SOURCE('REMOTE_HANA_EXPRESS'); ``` @@ -532,11 +529,8 @@ The [Cloud Connector](https://help.sap.com/docs/connectivity/sap-btp-connectivit For further information, see [Data Replication and Data Virtualization](group.hana-cloud-extend-2-data-replication), and [Getting Started with SAP HANA Cloud | Remote Data Source](https://blogs.sap.com/2020/08/03/getting-started-with-sap-hana-cloud-vii-smart-data-access/). - ### Knowledge check Congratulations! You have now used remote sources to access data running on a different SAP HANA instance and on an SAP HANA Cloud, data lake Relational Engine. - - ---