Scenario 8

You can materialize a replicate table from a primary table where user and replication activity cannot be stopped and replication to other tables in the replicate database must continue.

In the direct_load method, the replicate SAP Replication Server logs directly into the primary SAP ASE database, and selects the rows to be materialized for the table. Datatype translations and custom function strings are utilized before applying the data to the replicate table. During materialization, replication activity continues from the primary database and the rows for the table are placed into a catchup queue in SAP Replication Server. The data in the catchup queue is automatically applied, once the rows from the initial select are applied at the target. At which time, the subscription is marked VALID, and activities from the primary table are replicated to the replicate table.

This method can only be used if the site version of SAP Replication Server is ‘1571100’ or later. To check for site version:
isql –Usa –Ppassword -Sreplicate_Replication_Server
sysadmin site_version
go
The current site version is 1571100

Before You Begin

  • Ensure that replication is working from the primary table to the replicate table. Direct_load requires a table replication definition and table level subscription.
  • On the replicate database, ensure that the database option, 'select into/bulkcopy/pllsort' is set to true.
  • Ensure that an entry for the ASE server of the primary database, is in the interfaces file of the replicate Replication Server.

Begin the Resynchronization

  1. If the table subscription exists, drop the subscription.
    isql –Usa –Psa_pass –SPRS2
    
    drop  subscription t1_sub
    for  t1_repdef
    with replicate at sunak1505x.rep
    without purge
    go
    
  2. At the replicate table, remove the rows that will be replaced by the materialization.
    isql –Uuser -Ppassword -Sreplicate_ASE_server -Dreplicate_database
    
    truncate table t1
    go
    
  3. Create subscription identifying the materialization type as direct_load.
    isql –Usa –Psa_pass –SPRS2
    
    create subscription t1_sub
    for  t1_repdef
    with replicate at sunak1505x.rep
    without holdlock
    direct_load
    user puser password ppwd
    go
    
    where:
    • sunak1505x.rep is the replicate dataserver and database.
    • puser is the user who selects the data from the table in the primary SAP ASE database.
    • ppwd is the password of the puser. You must enter a password if a user is specified in the subscription.
    Note:
    • The interfaces file that the replicate SAP Replication Server uses must contain an entry for the primary SAP ASE where the initial data resides.
    • The puser must not be the SAP Replication Server maintenance user.
    For information about using the create subscription command in direct_load materialization, see the Reference Manual.
  4. Check the subscription to get a status on the direct_load.
    check subscription t1_sub
    for  t1_repdef
    with replicate at sunak1505x.rep
    go
    

    Message: Subscription t1_sub is VALID at the replicate. This indicates materialization is complete and the catchup queue is drained.

    Message: Subscription t1_sub encountered ERROR. This indicates that the Replication Server encountered an error when completing the direct load. Check the Replication Server and ASE logs to see the problems encountered.

    Messages similar to:
    Subscription t1_sub has been MATERIALIZED at the replicate.
     Subscriptions t1_sub progress: catchup, 0% done, -1 commands remaining.
    Indicates that the direct_load has not completed or that there may be a problem in completing the direct_load process. This also indicates that the replicate DSI has not received the validation marker yet. In this case, make sure the replication path is working.

    If there is an error, drop the subscription and start the direct_load process over.