The following examples show how to use twbcmd job-level commands to accomplish these job management objectives:
- Take a checkpoint
- Take a checkpoint and then terminate a job
- Pause and resume a job
- View and log the status of a job
Force a job to take an immediate checkpoint
An active job can be directed to take a checkpoint using the external command interface. Upon receiving the checkpoint request, each operator instance immediately takes a checkpoint rather than waiting for the checkpoint interval to expire. After the checkpoint completes, the job continues to process data.
Use the following command to force a job to take a checkpoint, where job ID is the name of the target Teradata PT job (determined by using the twbstat command).
twbcmd <job ID> job checkpoint
Force a job to take an immediate checkpoint and then terminate
When the twbkill command is used to terminate a job, it does not automatically take a checkpoint, which means that restarting the terminated job reprocesses everything done after the last scheduled checkpoint. This can cause errors, such as the reinsertion of rows.
To avoid the problems caused by such reprocessing, use the following twbcmd option instead, which creates a checkpoint and then terminates the job.
Do the following, where job ID is the name of the target Teradata PT job (determined by using the twbstat command):
twbcmd <job ID> job terminate
Pausing and then resuming a job
Sometimes resources are tied up, tables are locked, or jobs get out of sync. External commands allow you to avoid terminating jobs under these conditions. Use the following procedure to temporarily suspend the flow of data to control job timing and system resources.
- Do the following to pause a job, where job ID is the name of the target Teradata PT job (determined by using the twbstat command):
twbcmd <job ID> job pause
- To resume the job, do the following:
twbcmd <job ID> job resume
Determining the status of all active jobs
Issue one of the following commands, where job ID is the name of the target Teradata PT job, to determine the status of all active jobs:
- Issue the following command, where job ID is the name of the target Teradata PT job (determined by using the twbstat command):
twbcmd <job ID> job status
- The following will happen:
- All active operators write a status record to the TWB_STATUS log.
- The console displays the current count for rows sent and received.