Data Replication

Expand all | Collapse all

CHCLP script to automate table mappings

  • 1.  CHCLP script to automate table mappings

    Posted Thu June 17, 2021 12:56 PM
    Hi Community,

    We have a large no of tables to map the subscriptions in CDC and there are several schemas.
    Is there a CDC CHCLP batch script to use that can easily do the mapping when I key in the schema name and the name of the subscription I want to use?

    Thanks,
    Siva

    ------------------------------
    Sivakumar Anbazhagan
    ------------------------------


  • 2.  RE: CHCLP script to automate table mappings

    Posted Fri June 25, 2021 01:02 AM
    Hello

    What you can do is have a shell script that reads in the list of tables from a file and then generates a chcclp script from it. You can then run the chcclp script you have generated:

    chcclp=$HOME/map.chcclp
    echo "chcclp session set to cdc;" > $CHCCLP
    echo "connect server username admin password secret;" >> $CHCCLP
    echo "connect datastore name mysource context source"; >> $CHCCLP
    echo "connect datastore name mytarget context target"; >> $CHCCLP
    echo "select subscription name mysub" >> $CHCCLP
    while read line do
    # Line is in format sourceSchema,sourceTable,targetSchema, targetTable
      sourceSchema=$(echo $line | cut -f1 -d ",")
     ...
     echo "map table sourceSchema $sourceSchema targetSchema $targetSchema sourceTable $sourceTable targetable $targetTable;" >> $CHCCLP
    done < $HOME/map_tables
    echo "exit;" >> $CHCCLP







    ------------------------------
    Robert Philo
    ------------------------------



  • 3.  RE: CHCLP script to automate table mappings

    Posted Fri June 25, 2021 08:59 AM
    Thanks! That helps.

    ------------------------------
    Sivakumar Anbazhagan
    ------------------------------