SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
⤢ Open full site

Remote Table Replication

Use remote table replication after you have established a connection from an SAP HANA on-premise database to SAP HANA Cloud, SAP HANA database with the cloud connector.

Overview

🎓 beginner 5 min. SAP HANA CloudBeginnerSAP HANA CloudSAP HANA DatabaseSAP HANA

You will learn

  • How to establish a remote source
  • How to create a virtual table
  • How to add a replica table and add a remote subscription
Created by August 10, 2021
Contributors

Prerequisites

Prerequisites

Steps

Intro

Once you established a connection between your SAP HANA Cloud, SAP HANA database and SAP HANA on-premise database using the cloud connector following the instructions from the previous tutorial, you can establish a remote source and use remote table replication.

Remote table replication allows you to benefit from transient log-based replication, optimized performance with the SDA ODBC connection and near real-time replication and is also the preferred way to replicate data between SAP HANA Cloud, SAP HANA databases. Learn in this tutorial how to use it.


Step 1 Establish a remote source to replicate data

Once you have established the connection using the cloud connector, you can create a remote source in your SAP HANA Cloud, SAP HANA database instance pointing to the on-premise database.

  1. Open the SAP HANA Database Explorer connected to your SAP HANA Cloud, SAP HANA database instance.

  2. Open a SQL console.

  3. With the following statement, you can create a remote source from SAP HANA Cloud, SAP HANA database to SAP HANA on-premise to then replicate data from the on-premise system to the cloud. See instructions below the code to find out what to insert for the <placeholders>

    SQL

CREATE REMOTE SOURCE ADAPTER “hanaodbc” CONFIGURATION ‘ServerNode=<virtual_host_name>:;use_haas_socks_proxy=true;scc_location_id=’ WITH CREDENTIAL TYPE ‘PASSWORD’ USING ‘user=;password=’;

Code
    -	In that statement, you need to add the host name and port number of the virtual host that you have manually created in the cloud connector. The reason for this is to not reveal the actual hostname and port which might be a breach in security.
    - For on-premise connections, the socks proxy needs to be specified, which is already included in this statement.
	  - Next, in that statement, add the cloud connector location id, which you specified in the beginning.

    > If you want to use remote table replication between two SAP HANA Cloud, SAP HANA database instances, you need to slightly modify this statement. For more technical details on creating the remote source, read more in the [technical documentation](https://help.sap.com/viewer/477aa413a36c4a95878460696fcc8896/LATEST/en-US/20d299d2f5224e8590982e8ad97362a2.html).

4.	Once all your information is included, run the statement. This will create a remote source from SAP HANA Cloud, SAP HANA database to your on-premise system.

5.	The remote source will be established, and you can create virtual tables and use remote table replication just like when connecting different SAP HANA Cloud, SAP HANA database instances. Please note that you are only able to use remote table replication if you are using SAP HANA on-premise SPS05 or higher. Otherwise, only SDA virtual access is available.





### Create a virtual table


1.	In your catalog, click on **Remote Sources**.
2.	Then, double-click on your remote source. A wizard will open.

    ![RTR 01](https://raw.githubusercontent.com/sap-tutorials/Tutorials/master/tutorials/hana-cloud-mission-extend-09/ss-01-RTR-01.png)

3.	In the drop-down menu to select a schema, you can now see the schema information from the remote source system.
4.	Select the schema you would like to replicate a table from and click on **Search**.
5.	You will now see the tables in the schema in your on-premise database.
6.	Next, select a table from the list and create a virtual object that can be included in federated queries.
7.	You can also adjust and execute this SQL statement to create a virtual table:

    ```SQL
CREATE VIRTUAL TABLE "<VT_TABLENAME>" AT "<REMOTESOURCENAME>"."<DATABASE>"."<SCHEMA>"."<TABLE>";
  1. Once you have executed this statement successfully, you can find the virtual table in the catalog in your tables.
  2. You can now query the data in this remote table.

In some cases, a virtual table may not be the best solution. For example, if you need to improve query performance. With Remote Table Replication, you can copy real-time data to your SAP HANA Cloud, SAP HANA database, which makes querying this data faster.

Additionally, if changes in the definitions of the source table of a virtual table occur, for example dropping or adding of columns, querying the virtual table pointing to the source table will result in an error. This can be avoided by setting up a remote subscription, which will not only replicate the data in real-time from the source system, but also the table definitions.

Learn in the next steps how to use remote table replication.

Step 2 Create a table replica
+
Step 3 Test yourself
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 3
1. Establish a remote source to replicate data 2. Create a table replica 3. Test yourself

Learn more →