Quick Start for HVR - SapXForm
This quick start guide helps you to get started with HVR for replicating data into Snowflake database.
To proceed with this replication you must have basic understanding about HVR's architecture and terminologies like Hub, Location, Channel, Location Groups, Actions etc.
The example here demonstrates how to set up a SapXForm channel to replicate from an Oracle based SAP system (source location) into a Snowflake database (target location). The tables replicated includes both SAP cluster tables and pool tables and also the transparent tables. The data in the cluster and pool tables are unpacked inside the channel using the action Transform /SapXForm. This channel does not deliver the data into the target in its original packed form, only its unpacked form. For example, the table rfblg from source location is replicated into tables rows for bsec and bseg. HVR uses "SAP Transform Engine" to extract and replicate individual tables from SAP table pools and clusters.
SAP Transform Engine is a special executable shipped as part of the HVR distribution, and requires a separate license.
Before proceeding with this example ensure that the requirements for using HVR with Oracle, SapXForm, and Snowflake are met.
For information about access privileges and advanced configuration changes required for performing replication using Oracle, SapXForm, and Snowflake, see:
This Quick Start Guide assumes that the source and target locations are already created/available.
Create Channel
This section describes how to create a channel (hvrdemo) in HVR.
- In navigation tree pane, right-click Channel Definitions ▶ New Channel.
- Enter Channel name and Description for the channel in New Channel dialog.
- Click OK.
Create Location Groups
This section describes how to create location groups in a channel. The location groups are used for defining action on the location. Typically a channel contains two location groups - one for the source location and one for the target location. Each location group can contain multiple locations.
In this example, create one source location group (SRCGRP) and one target location group (TGTGRP).
- In navigation tree pane, click + next to the channel (hvrdemo).
- Create source location group (SRCGRP):
- Right–click Location Groups ▶ New Group.
- Enter Group Name and Description for the location group.
- Select source location (src) from Group Membership.
- Click OK.
- Create target location group (TGTGRP):
- Right–click Location Groups ▶ New Group.
- Enter Group Name and Description for the location group.
- Select target location (tgt) from Group Membership.
- Click OK.
Select Table(s)
This section describes how to select the unpacked tables (bsec and bseg) from source location for replication. Table Explore allows you to select schema(s) and/or table(s) for replication.
In this example, when the Table Explore is performed with SAP Dictionaries selected, the SAP Transform Engine displays both the packed and unpacked tables.
Right–click Tables ▶ Table Explore.
Select source location (src) from the location list.
Select option SAP Dictionaries in Explore.
If a valid license to use SapXForm is not available in the hvr_home/lib folder then the HVR GUI will not display the option SAP Dictionaries in Table Explore.
Enter SAP schema name in Schema if the SAP Dictionary tables are in different schema other than the cluster/pool/transparent tables.
Because the SAP database has large number of tables, it is recommended to use the table Filter. To filter the tables,
- Click Edit.
- Enter the pattern. For example, bsec and bseg.
- Click OK.
Click Connect.
Select the unpacked tables from Table Explore dialog. Press Shift key to select multiple tables or Ctrl+A to select all tables.
For easier identification of the packed and unpacked tables, HVR makes the following differences between the real table name ('base table') and HVR table name (used for the channels' actions) -
- the packed tables are suffixed with _pack.
- the unpacked tables are prefixed with the name of the packed table to which the unpacked table belongs to packed table name_ and suffixed with _unpack.
However, transparent table names are not changed.
Click Add to add the selected tables.
Click OK in HVR Table Name dialog.
Click Close in Table Explore dialog.
HVR automatically adds the corresponding packed table(s) to the channel.
Define Actions
This section describes how to define actions on the location groups (SRCGRP and TGTGRP). Actions define the behavior of a replication activity.
- Define action Capture to capture from all tables except unpacked tables. Also select parameter /AugmentIncomplete to retrieve the full value from the source database in case HVR receives partial/incomplete values for certain column types.
- Right-click source location group SRCGRP ▶ New Action ▶ Capture.
- Enter !*_unpack in Table.
- Select parameter /AugmentIncomplete and then select option LOB.
- Click OK.
- Define action Integrate with /Burst to integrate all tables except the packed tables.
Right–click target location group TGTGRP ▶ New Action ▶ Integrate.
Enter !*_pack in Table.
To integrate all tables including the packed tables, enter * in Table.
Click OK.
- Define action Transform with /SapXForm for all packed tables. This action performs SAP transformation for all packed tables.
Right–click target location group TGTGRP ▶ New Action ▶ Transform.
Enter *_pack in Table.
Select parameter /SapXForm.
Click OK.
This action can be performed on the HUB or the integrate machine, and it is supported on Linux and Windows.
- Define action LocationProperties with /StagingDirectoryHvr and /StagingDirectoryDb which are required for replicating into Snowflake.
Right–click target location group TGTGRP ▶ New Action ▶ LocationProperties.
Select parameter /StagingDirectoryHvr and click browse to select the directory for bulk load staging files. This directory should be on the machine where HVR connects to the source database
Select parameter /StagingDirectoryDb and enter the local directory on the Snowflake head-node or a URL pointing to /StagingDirectoryHvr.
Select parameter /StagingDirectoryCredentials and enter the credentials for the staging database.
Click OK.
The Actions pane only displays actions related to the object selected in the navigation tree pane. Click on the channel name (hvrdemo) to view actions defined for all location groups in the selected channel.
Optional Action
The following action can be defined optionally for this replication:
Group | Table | Action | Annotation |
---|---|---|---|
TGTGRP | !_pack | ColumnProperties/Extra /SoftDelete | To populate extra 'soft delete' columns in each target table. |
Initialize
This section describes how to initialize the replication. HVR Initialize first checks the channel and creates replication jobs in the HVR Scheduler.
In this example, HVR Initialize creates one capture job (hvrdemo-cap-src) and one integrate job (hvrdemo-integ-tgt).
- Right-click channel hvrdemo ▶ HVR Initialize.
- Select Create or Replace Objects in HVR Initialize dialog.
- Click Initialize.
- Click OK.
- Click Close.
Click Scheduler node in navigation tree pane to view the capture and integrate jobs in Jobs pane.
For more information about initiating replication in HVR, see section Replication Overview.
Start Capture Job
This section describes how to start the job for capturing changes from source location (src). By starting the Capture job in HVR Scheduler, HVR begins capturing all changes since the moment HVR Initialize was executed. This 'capture begin moment' can be modified using the option Capture Rewind available in the Advanced Options tab of HVR Initialize dialog.
Start Scheduler. In the navigation tree pane, right-click Scheduler ▶ Start.
Start capture job. In the Jobs pane, right-click capture job hvrdemo-cap-src ▶ Start.
Click Yes in Start dialog.
On starting the capture job (hvrdemo-cap-src) successfully, the status of the job changes from SUSPEND to RUNNING.
Refresh
This section describes how to perform initial load into the target database. HVR Refresh copies all existing data from source location (src) to the target location (tgt) and optionally creates new tables and keys in target location.
- In the navigation tree pane, right-click channel hvrdemo ▶ HVR Refresh.
- Select Create Absent Tables in HVR Refresh dialog.
- Click Refresh.
- Click Yes to begin HVR Refresh. When the refresh is completed, the Refresh Result dialog displays the total number of rows unpacked from the packed (Pool or Cluster) tables.
- Click Close in Refresh Result dialog and then in HVR Refresh dialog.
Start Integrate Job
This section describes how to start the job to integrate changes into the target location (tgt).
In the navigation tree pane, click Scheduler.
Start integrate job. In the Jobs pane, right-click integrate job hvrdemo-integ-tgt ▶ Start.
Click Yes in Start dialog.
On starting the integrate job (hvr_demo-integ-tgt) successfully, the status of the job changes from SUSPEND to RUNNING.
Verify Replication
This section describes the two methods for verifying HVR's replication activity.
Viewing Log File
HVR creates separate log file for the hub, channel (hvrdemo), and for each replication jobs (hvrdemo-cap-src and hvrdemo-integ-tgt). This log file contains the details of the changes captured and integrated.
To view the replication activity log:
In navigation tree pane, click + next to the Scheduler.
Right-click hvr_demo ▶ View Log to view the output of the jobs.
The log for the channel (hvrdemo) is displayed at the bottom of the screen.
The directory path for HVR log files is displayed in the log tab.
Update the value(s) in source location database.
Using HVR Compare
HVR Compare allows you to verify the replication activity by comparing the data in source and target locations. Only row-wise (Row by Row Granularity) compare is supported for SapXForm channels.
To see how the differences are reported by HVR Compare:
- Stop (suspend) the Integrate job (hvrdemo-integ-tgt),
- In the navigation tree pane, click Scheduler.
- In the Jobs pane, right-click integrate job hvrdemo-integ-tgt ▶ Suspend.
- Click Yes in Suspend dialog.
- Update the value(s) in source location database.
- Execute HVR Compare:
- In the navigation tree pane, right-click channel hvrdemo ▶ HVR Compare.
- Select source location (src) on the left side Location list and target location (tgt) on the right side Location list.
- Select Row by Row Granularity in the Options tab.
- Click Compare.
- On completion, Compare Result dialog is displayed. If the State column displays Different, it indicates the data in source and target locations are not identical.
- Click Close in Compare Result dialog and HVR Compare dialog.
- In the navigation tree pane, right-click channel hvrdemo ▶ HVR Compare.
- Start the Integrate Job (hvrdemo-integ-tgt).
- Execute HVR Compare again. In Compare Result dialog, if the State column displays Identical, it indicates the changes are replicated successfully.