Configuring Replication Server for Replication to SAP HANA Database

Configure Replication Server for replication from SAP Business Suite running on supported databases to SAP HANA database.

If you are not using the sample Replication Server instance, enter your Replication Server instance name in place of SAMPLE_RS.
  1. Add an entry to your Replication Server interfaces file identifying the replicate SAP HANA database, and then stop and start Replication Server:
    [dataservername]
    master tcp ether hostname port 
    query tcp ether hostname port
    where hostname and port are the host and port number of the SAP HANA database, and dataservername is a label used to identify the host and port number. For information about stopping and starting Replication Server, see the Replication Server Administration Guide Volume 1 > Manage a Replication System.
    Note: Each SAP HANA database installs with a unique instance number, and the port number is the instance number prefixed with 3 and suffixed with 15:
    3in15
    where in is the two-digit instance number. For example, the port number for an SAP HANA database with instance number 1 is 30115.
  2. On SAP HANA database, create a maintenance user:
    1. As the SAP HANA database admin user, create a user ID with a temporary password:
      CREATE USER muser PASSWORD mpwd_temp
    2. Log in to SAP HANA database with the temporary password, and then update the password:
      ALTER USER muser PASSWORD mpwd_new
    3. Log out of SAP HANA database, and log in again with the new password.
  3. Log in to SAP HANA database:
    ./hdbsql -u user -p password -i id
    where user is the SAP HANA database user, password is the user password, and id is the instance number.
  4. On SAP HANA database, grant these authorities to the maintenance user:
    GRANT CREATE ANY, DELETE, DROP, EXECUTE, 
    INDEX, SELECT, UPDATE ON SCHEMA myschema TO muser
    
    where myschema is your SAP HANA database schema, and muser is the maintenance user you just created.
  5. Log in to Replication Server:
    isql –Usa –Psa_pass –SSAMPLE_RS
    If you have not set up the sample Replication Server instance, enter your Replication Server instance name instead of SAMPLE_RS.
  6. Create a connection to the replicate SAP HANA database instance using ExpressConnect for SAP HANA Database.
    For a standard connection:
    create connection to rds.rdb
    using profile connection_profile;ech
    set username muser
    set password mpwd
    go
    where:
    • rds is the replicate SAP HANA database. For a standard connection, this must match the data server name in the interfaces file entry.

    • rdb is a placeholder; you must provide a value, but it is not used.

    • connection_profile is:
      Primary Database Connection Profile Value
      Oracle rs_oracle_to_hanadb
      Microsoft SQL Server rs_msss_to_hanadb
      IBM DB2 UDB rs_udb_to_hanadb
    • muser is the maintenance user for the replicate SAP HANA database instance you have already created.

    • mpwd is the replicate SAP HANA database maintenance user password.

    • auser and apwd are unused values supplied only to satisfy the syntax of the create connection command.

    If you have trouble connecting to the replicate SAP HANA database instance using ExpressConnect for SAP HANA Database, see the Replication Server Troubleshooting Guide > Common Error Messages > Connector Error Messages.
  7. Use admin show_connections, 'replicate' to display the replicate connection you created.
  8. Enable the replication of trailing zeros in varbinary values:
    configure replication server set varbinary_strip_trailing_zeros to 'off'
  9. Set the value of $SAPSYSTEMNAME environment variable for the SAP HANA database <sid>adm user to the sapsystemname configuration parameter:
    alter connection to rds.rdb
    set sapsystemname to 'sid_adm_value'
    
    where:
    • rds.rdb is the connection name for the SAP HANA database.
    • sid_adm_value is the name of the SID (SAP SYSTEM NAME).

      For example, the SYSTEM NAME is D01. You must enter:

      alter connection to rds.rdb set sapsystemname to 'D01'

  10. Map primary schema to replicate schema:
    alter connection to rds.rdb
    set schemamap with decluster from pds.pdb.primary_schema to HANA_schema
    
    where:
    • rds.rdb is the connection name for the SAP HANA database.
    • pds.pdb is the is the connection name used in the create connection command for primary database.
    • primary_schema is the schema name of the primary database.
    • HANA_schema is the schema name of the SAP HANA database.
  11. Connect to Replication Agent through isql, and mark these SAP Data Dictionary (DD) tables—DD16S, DD03L, and DD02L—for replication:
    pdb_setreptable primary_schema.tablename, mark, owner
    go
    

    where, primary_schema.tablename is the SAP table name.

    Note: Make sure that you do not mark the cluster tables CLU4 and VER_CLUSTR for replication. For more information, see SAP Note 902817 – Inconsistencies in cluster tables (log vs phys field name): https://css.wdf.sap.corp/sap/support/notes/902817
  12. In Replication Agent, create a replication definition for each SAP DD table:
    rs_create_repdef primary_schema.tablename
    go

    where, primary_schema.tablename is the name of the SAP DD table.

  13. Create a subscription against the replicate connection to materialize the SAP DD tables on the SAP HANA database.
    create subscription sub_name 
    for table_repdef 
    with replicate at rds.rdb 
    without holdlock 
    direct_load init replicate table 
    with create_or_truncate 
    user username password pass
    go
    where:
    • sub_name is the name of the subscription.
    • table_repdef is the table replication definition the subscription sub_name is for.
    • rds.rdb is the replicate SAP HANA database connection created earlier.
    • username is the user who connects to Replication Agent for your primary database.
    • pass is the password of the username. You must enter a password.
    Note: You can also use other create subscription options such as create, recreate, or truncate.
  14. (Only for SAP Business Suite running on Oracle database) Set sap_trim_len to on to trim the first two bytes for certain SAP columns such as RAW or LRAW whose DDIC type length is greater than 255 bytes:
    alter connection to data_server.database 
    set sap_trim_len to 'on'
    
  15. (Only for SAP Business Suite running on Oracle database or Microsoft SQL Server) Set reblock_ddntf to off to allow Replication Server to disable the FIELDS column length adjustment in the DDNTF table:
    alter connection to rds.rdb 
    set reblock_ddntf to 'off'
    
  16. Connect to Replication Agent through isql, and mark these SAP tables—DDNTT, DDNTF, TADIR, SVERS, DD09L, DD12L, and DD17S:
    pdb_setreptable primary_schema.tablename, mark, owner
    go
    

    where, primary_schema.tablename is the SAP table name.

  17. In Replication Agent, create a replication definition for each SAP table that you marked for replication:
    rs_create_repdef primary_schema.tablename
    go

    where, primary_schema.tablename is the name of the SAP table.

  18. Create a subscription against the replicate connection to materialize the SAP tables on the SAP HANA database.
    create subscription sub_name 
    for table_repdef 
    with replicate at rds.rdb 
    without holdlock 
    direct_load init replicate table 
    with create_or_truncate 
    user username password pass
    go
    where:
    • sub_name is the name of the subscription.
    • table_repdef is the table replication definition the subscription sub_name is for.
    • rds.rdb is the replicate SAP HANA database connection created earlier.
    • username is the user who connects to Replication Agent for your primary database.
    • pass is the password of the username. You must enter a password.
    Note: You can also use other create subscription options such as create, recreate, or truncate.
  19. Create table replication definition and subscription with materialization for all other SAP tables.