Problem Summary:  How to Create a Refresh Job and Run via HVR Scheduler

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #18180
    Donna Zehl
    Keymaster

    Problem Summary:  How to Create a Refresh Job and Run via HVR Scheduler

     

    Tag: 5.5 (28528)

     

    Description:

    Create a simple shell script to kick off a refresh of a table job from the HVR scheduler. It will check if current date = date in the file, then run the refresh job.

     

    Answer:

    So lets take this file  ‘Myplans.csv’  with the example contents

    2019-02-02
    2019-02-09
    2019-02-16
    2019-02-23

     

    And we have this script created

    #!/bin/bash
    currentdate=$(date "+%Y-%m-%d")
    export HVR_HOME=/opt/hvr/hvr_home
    export HVR_CONFIG=/opt/hvr/hvr_config
    file="/home/oracle/Myplans.csv"
    echo $file
    if [ ! -f "$file" ]
      then
        echo "$0: File '${file}' not found."
      else
       dbdate=$(grep "$(date +"%Y-%m-%d")" $file)
       if [ "${currentdate}" = "${dbdate}" ]; then
            $HVR_HOME/bin/hvrrefresh -s -rMysource -lMytarget hubdb/password chn1      
       else
            echo "Refresh did not start"
       fi
    fi

     

     

            Note : The above script uses the -s parameter which will only create the refresh job in the scheduler but won’t start it.  If you run this script without the ‘-s’ parameter to start job immediately or you can keep this parameter to keep the job suspended then start the refresh job with hvrstart command.

     

    Here is a snippet from the hvrrefresh wiki page@ https://www.hvr-software.com/docs/Hvrrefresh  with more details:

    Schedule invocation of refresh scripts using the HVR Scheduler. Without this option the default behavior is to perform the refresh immediately. The jobs created by this option are named chnrefrl1l2. These jobs are initially created in SUSPEND state. They can be invoked using command hvrstart as in the following example:

         $ hvrstart –u –w hubdb chn–refr

    The previous command unsuspends the jobs and instructs the scheduler to run them. Output from the jobs is copied to the hvrstart command’s stdout and the command finishes when all jobs have finished. Jobs created are cyclic which means that after they have run they go back to PENDING state again. They are not generated by a trig_delay attribute which means that once they complete they will stay in PENDING state without getting retriggered. Once a refresh job has been created with option –s then it can only be run on the command line (without HVR Scheduler) as follows:

     $ hvrstart –i hubdb chn–refr–loc1–loc2

     

     

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.

© 2020 HVR

Test drive Contact us