How to setup materialization replication envrionment

Purpose

this document help to setup materialization/direct-load test environments. Before you start this document, you should be familiar with RAX end to end test environment setup, or you can refer to: O2O End to End environment setup

High level overview of materialization replication

PDB(ORACLE)----> RA --->RS --->RDB(HANA)

Steps

1. prepare environments

  • PDB (oracle)
database name:  orcl
hostname:10.48.180.142
port:32535
db username:test_user
db passwd: Sybase123
db maint username:rsuser
db maint passwd:Sybase123
  • RA (ra211)
host name:10.48.180.141
username:sa
password:Sybase123
port:8831
  • RS (HEK2_RS)
host name:10.48.180.143
port:11760
username:sa
password:Sybase123
  • ERSSD (HEK2_RS_ERSSD)
host name:10.48.180.143
port:11751
database name:HEK2_RS_ERSSD
rssd username:HEK2_RS_RSSD_prim
  • HANA (H15)
host name:hanahost.sap.corp
port:30215
db username:test_user
db password:Sybase123
db maint user:rsuser
db maint password :Sybase123

2. config environments

  • config RA
ra_config pds_connection_type,ORAJDBC
go
ra_config pds_database_name,orcl
go
ra_config pds_host_name,10.58.180.142
go
ra_config pds_password,Sybase123
go
ra_config pds_port_number,32535
go
ra_config pds_username,test_user
go
ra_config rs_host_name,10.58.180.143
go
ra_config rs_password,Sybase123
go
ra_config rs_port_number,11760
go
ra_config rs_source_db,orcl
go
ra_config rs_source_ds,ra211
go
ra_config rs_use_ssl,false
go
ra_config rs_username,sa
go
ra_config rssd_database_name,HEK2_RS_ERSSD
go
ra_config rssd_host_name,10.58.180.143
go
ra_config rssd_password,Sybase123
go
ra_config rssd_port_number,11751
go
ra_config rssd_username,HEK2_RS_RSSD_prim
go
ra_locator move_truncpt
go
ra_config connect_to_rs,true
go
ra_config use_rssd,true
go
ra_admin deinit,force
go
ra_admin init
go
  • config RS
- If your RS is on linux, open and edit $SYBASE/interfaces file, then add below lines:
     ra211
             master tcp ether 10.58.180.141 8831
            query tcp ether 10.58.180.141 8831
     H15
            master tcp ether hanahost.sap.corp 30215
            query tcp ether hanahost.sap.corp 30215

-If your RS is on windows, open and edit $SYBASE/ini/sql.ini,then add below lines:
      [ra211]
                master=TCP,10.58.180.141,8831
                query=TCP,10.58.180.141,8831
      [H15]
               master=TCP,hanahost.sap.corp,30215
               query=TCP,hanahost.sap.corp,30215

-then restart your RS instance
  • create connection to RA and RDB in RS
create connection to ra211.orcl using profile  rs_rs_to_oracle_ra;standard set username "RSUSER" set password "Sybase123" with log transfer on, dsi_suspended
go
create connection to H15.H15 using profile rs_oracle_to_hanadb;ech set username "RSUSER " set password "Sybase123" set batch to 'off'  set dynamic_sql to 'on'
go

3. create test data and start replication

  • Create test table into PDB and RDB(HANA)
- In PDB (ORACLE):
            create table test_user.chartest(pkey int  primary key,nch nvarchar2(2000));
            insert into chartest values(1,'haaa');
            insert into chartest values(2,'aaaa');
            commit;
- In RDB(HANA):
            create table TEST_USER.chartest(pkey int,nch varchar(2000));
  • mark PDB table in RA
pdb_setreptable test_user.chartest,mark
go
  • auto create table level repdef to RS in RA
rs_create_repdef test_user.chartest
go

- write down the repdef name, in this case is "ra$ra211_orcl_TEST_USER_CHARTEST"
  • create materialization subscription
create subscription sub22  for "ra$ra211_orcl_TEST_USER_CHARTEST" with replicate at H15.H15 without holdlock direct_load user "sa" password "Sybase123"
go

After create materialization subscription. you can query the materialization replication result in HANA:

>*you will get the query result  as the same as from PDB*

##4. clean up environments

-In RS:
drop subscription sub22 for "ra$ra211_orcl_TEST_USER_CHARTEST" with replicate at H15.H15 without purge
go
drop replication definition "ra$ra211_orcl_TEST_USER_CHARTEST"
go

>*If you want to drop connection,just use blow command in RS*
>```
    drop connection to ra211.orcl
    go
    drop connection to H15.H15
    go

5. some common issues

  • How to create user in HANA

sometimes create subscription fails with authorized error

- use system user create test_user and rsuser
        CREATE USER test_user PASSWORD Qazwsx123
        CREATE USER rsuser PASSWORD Qazwsx123
- change password for those two user
        login by those two users in hana, and then the hana studio will recommend you to change your password, we recommend you change to "Sybase123"
- set privilege
       login to hana by user test_user,then execute blow sql:
               GRANT ALTER, CREATE ANY, DELETE, DROP, EXECUTE, INDEX, INSERT, SELECT, UPDATE ON SCHEMA TEST_USER TO RSUSER;
  • how to force drop subscription

if you can't drop one subscription then try this way

- In RS
        connect 
        go
        delete from rs_subscriptions
        go

你可能感兴趣的:(How to setup materialization replication envrionment)