Home / Repstance User Guide / PROCESS CONTROL COMMANDS / Run any Capture or Apply Processes

Run any Capture or Apply Processes

The run command starts a Capture Process or an Apply Process, all the processes of one kind, or all the processes. Without parameters it starts every process that is not running. The parameters process and id, the states in which a process accepts the command and the HTTP codes are explained on PROCESS CONTROL COMMANDS.

Command line (repcli)

repcli run [process=capture|apply [id=processID]]
ParameterDescription
processcapture for the Capture Processes, apply for the Apply Processes. Without it the command is sent to all the processes.
idThe identifier of the process. It needs process. Without it the command is sent to all the processes of that kind.

repcli prints a line for every process the command is meant for: the status in brackets and the message.

StatusMeaning
In ProcessThe command has been sent to the process. The process starts a moment later, use the status command to monitor it.
FailedThe command has not been sent. The message tells why: the process is running already (Command [RUN] is not valid for this status), the id does not exist, or a parameter is wrong (see the messages on PROCESS CONTROL COMMANDS).

Run all the processes. The Capture Process 1 and the Apply Process 1 were stopped:

repcli run
[In Process]: Command [RUN] has been sent. Use [status] command to monitor the Capture 1 process
[In Process]: Command [RUN] has been sent. Use [status] command to monitor the Apply 1 process

Run the same command again while the processes are running. Nothing is sent, and each process says why:

repcli run
[Failed]: Capture 1 Process status is [In Process]. Command [RUN] is not valid for this status
[Failed]: Apply 1 Process status is [In Process]. Command [RUN] is not valid for this status

Run one process:

repcli run process=capture id=1
[In Process]: Command [RUN] has been sent. Use [status] command to monitor the Capture 1 process

A process that does not exist:

repcli run process=capture id=9
[Failed]: Process id=9 does not exist

A process that has failed can be run again after the cause has been removed. Repstance also runs a failed process again by itself, see Stop/Run Replication Processes.

REST API

  • Endpoint: https://repstance_url/control/process
  • Method: POST
  • Header: Content-Type: application/json and X-Token: token

The body of the request. The element parameters is optional: without it the command is sent to all the processes. The pairs are in the same order as in repcli, process first and then id:

{
  "command": "run",
  "parameters": [
    ["process", "capture"],
    ["id", "1"]
  ]
}

The body of the answer is an array with an element for every process the command is meant for. The element names the process in its message:

[
  {
    "command": "RUN",
    "status": "In Process",
    "message": "Command [RUN] has been sent. Use [status] command to monitor the Capture 1 process"
  }
]
HTTP codeMeaning
200The request is valid. The body has an element for every process the command is meant for, with the status In Process or Failed.
401The token is invalid.
422The request is invalid: the JSON, the command, a parameter, or the process does not exist. The body has one element with the status Failed and the message.

What happens when a process runs

  • Checks. Before a process starts, Repstance checks that the Source and the Target Databases are configured for the replication. If they are not, the process fails and its message lists the inconsistencies. To check a process in advance see Validate Process.
  • First run of a Capture Process. For a SQL Server Source Database it creates the CDC tables it needs and starts from the first LSN that is available in them. For an Oracle Source Database it starts from the current SCN of the database. A transaction that is active at that SCN and is committed after it is captured completely, so the tables stay consistent and no change is lost.
  • First run of an Apply Process. It starts from the first transaction in the trail files of its Capture Process. It fails if the Capture Process is not configured or has never been run. To start from another transaction use reset (see Reset Process).
  • Changed configuration. A change of the replication objects (see Capture Objects Specification) or of the transformation rules (see Objects Mapping and Possible Transformations) is put into effect when the process is run: the DDL and DML changes are captured with the new criteria. For a SQL Server Source Database CDC is turned off for the objects that are not replicated any more, and they are no longer written to the trail files; for new objects it is turned on.

Web UI

Click “Run All Processes” on the dashboard to run all the processes, or “Run” on the card of a process to run that process. Both ask for a confirmation. The buttons, the confirmations and the state of the cards are shown in Stop/Run Replication Processes.