Assigning actions to data server errors

The assign action command specifies the action to take for errors that a data server can return to Replication Server. The syntax for the assign action command is:

assign action
  {ignore | warn | retry_log | log | retry_stop | stop_replication}
  for error_class
  to server_error1 [, server_error2]...

For example, to instruct Replication Server to ignore Adaptive Server errors 5701 and 5703:

assign action ignore
 for rs_sqlserver_error_class
 to 5701, 5703

The default error class provided for Adaptive Server databases is rs_sqlserver_error_class, and the default error classes for non-ASE datbases are listed in Table 6-3. You must create a default error class at a primary site before you can use the assign action command to change default error actions. The data_server_error parameter is the data server error number.

You can assign error classes to specific connections on replication databases using the create connection and alter connection commands.

Enter one of the six possible error actions at the Replication Server where the error class was created. These actions are listed in Table 6-4, in order of severity: ignore is the least severe action and stop_replication is the most severe.

When a transaction causes multiple errors, Replication Server chooses just one action—the most severe action assigned to any of the errors that occurred. To return an error to the default error action, stop_replication, you must reassign it explicitly.

Table 6-4: Replication Server actions for data server errors

Action

Description

ignore

Assume that the command succeeded and that there is no error or warning condition to process. This action can be used for a return status that indicates successful execution.

warn

Log a warning message, but do not roll back the transaction or interrupt execution.

retry_log

Roll back the transaction and retry it. The number of retry attempts is set with the configure connection command. If the error continues after retrying, write the transaction into the exceptions log, and continue, executing the next transaction.

log

Roll back the current transaction and log it in the exceptions log; then continue, executing the next transaction.

retry_stop

Roll back the transaction and retry it. The number of retry attempts is set with the configure connection command. If the error recurs after retrying, suspend replication for the database.

stop_replication

Roll back the current transaction and suspend replication for the database. This is equivalent to using the suspend connection command. This action is the default.

Since this action stops all replication activity for the database, it is important to identify the data server errors that can be handled without shutting down the database connection, and assign them to another action.

You can also specify how Replication Server responds to SQLDML row count errors that may occur during SQL statement replication. In SQLDML row count errors, the number of rows changed in the primary and replicate databases do not match after SQL statement replication. The Replication Server default error action is to stop replication. The default Replication Server error class is rs_repserver_error_class.

If there is a row count error, this is an example of the error message that displays:

DSI_SQLDML_ROW_COUNT_INVALID 5186
Row count mismatch for the SQL Statement Replication
command executed on 'mydataserver.mydatabase'. The
command impacted 10 rows but it should impact 15 rows.