How To: Stop and Start the HVR Scheduler within a Linux/UNIX batch script
Scenario:
There are situations in which you may want to stop one or more replication jobs (by channel name) and then start them again after a certain dependent task has been completed. There are also times when you want to stop the entire HVR Scheduler altogether which then gracefully stops all replication jobs controlled by that scheduler. Uses cases vary but include situations such as; the need to run reports at a specific point-in-time, running backups or other batch processes that prefer a stable database, or if you have defined a workflow of tasks that must all execute in a specific order without continuous changes being applied on the target. These are only a sample of situations in which you want a to stop/start the HVR scheduler.
The following example focuses only on stopping/starting the scheduler (e.g. all jobs) within a batch script on UNIX or Linux. The commands to run the same set of instructions on Windows might use slightly different runtime arguments.
Overview:
There are several ways that you may control stopping and starting either individual HVR replication jobs or stop/start the entire HVR Scheduler itself. For example, you may:
- Add a Scheduling action on a channel that controls when a job (Capture, Integrate, Refresh, or Compare) starts which can be set at channel or location levels.
- Use the utility commands hvrsuspend or hvrstart to control stopping/starting specific jobs
- On demand using the HVR Scheduler in the HVR Console
- Define an HVR Maintenance task that stops/starts the entire scheduler
- Use the utility commands hvrscheduler to stop/start the scheduler process which affects all replication jobs and stops the scheduler itself
The steps below show an example for item 5, stopping/starting the scheduler with in batch script using the hvrscheduler command on Linux/UNIX.
Steps:
A] To STOP the scheduler you use, on the hub:
On Linux/UNIX> hvrscheduler -k <hub name>
On Windows> hvrscheduler -ah -h <repository class> -k <hub schema>
B] To START the scheduler you use, on the hub:
On Linux/UNIX> hvrscheduler -h <repository class> <hub schema>
On Windows> hvrscheduler -as -h <repository class> <hub schema>
For example, here we have a hub on Linux with an Oracle database with hub schema hvrrepo. [oracle@oel7-ora12c sql]$ ps -ef |grep hvr
oracle 3829 1 0 14:17 ? 00:00:00 hvrremotelistener -dN 4343
oracle 3854 3829 0 14:17 ? 00:00:00 hvr -r -N
oracle 3863 3829 0 14:17 ? 00:00:00 hvr -r -N
oracle 3914 3829 0 14:18 ? 00:00:00 hvr -r -N
oracle 3948 1 0 14:18 ? 00:00:00 hvrscheduler -h oracle hvrrepo/<password>
oracle 3949 3948 0 14:18 ? 00:00:00 hvrscheduler -swork -Rhvr_scheduler -horacle hvrrepo/<password>
[oracle@oel7-ora12c sql]$ hvrscheduler -k hvrrepo hvrscheduler -k: No more active jobs:- HVR Scheduler shutting down. hvrscheduler -k: Previous HVR Scheduler for database ‘hvrrepo’ has shut down.
[oracle@oel7-ora12c sql]$ ps -ef |grep hvr oracle 3829 1 0 14:17 ? 00:00:00 hvrremotelistener -dN 4343
oracle 3854 3829 0 14:17 ? 00:00:00 hvr -r -N
oracle 3863 3829 0 14:17 ? 00:00:00 hvr -r -N [oracle@oel7-ora12c sql]$ hvrscheduler -h oracle hvrrepo/<password> [oracle@oel7-ora12c sql]$ ps -ef |grep hvr
oracle 3829 1 0 14:17 ? 00:00:00 hvrremotelistener -dN 4343
oracle 3854 3829 0 14:17 ? 00:00:00 hvr -r -N
oracle 3863 3829 0 14:17 ? 00:00:00 hvr -r -N
oracle 4140 3829 0 14:20 ? 00:00:00 hvr -r -N
oracle 4179 1 0 14:21 ? 00:00:00 hvrscheduler -h oracle hvrrepo/<password>
oracle 4181 4179 1 14:21 ? 00:00:00 hvrscheduler -swork -Rhvr_scheduler -horacle hvrrepo/<password>
Note: Depending on the shell you are using, you might have to put quotes around the password.