Row count validation for SQL statement replication

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

Syntax

Use the assign action command at the primary site for the Replication Server error class to specify other error actions for SQLDML row count errors:

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

Parameters

error_class is the error class name for which the action is being assigned. You can specify Replication Server error classes such as the default rs_repserver_error_class error class.

server_error is the error number. You can specify error numbers for Replication Server:

Table 4-9: Error actions for SQL statement replication

server_error

Error message

Default error action

Description

5186

Row count mismatch for
the command executed on
‘dataserver.database’.
The command impacted x
rows but it should
impact y rows.

stop_replication

Row count verification error for SQL statement replication if the affected number of rows is different from what is expected.

5193

You cannot enable
autocorrection if SQL
Statement Replication
is enabled.  Either
enable SQL Statement
Replication only or
disable SQL
StatementReplication
before you enable
autocorrection.

stop_replication

Cannot enable autocorrection if SQL statement replication is enabled. Either enable SQL statement replication only or disable SQL statement replication before you enable autocorrection

Examples

To assign the warn error action if Replication Server encounters error number 5186, enter:

assign action warn for rs_repserver_error_class to 5186

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 SQLDML command executed on 'mydataserver.mydatabase'.
The command impacted 1000 rows but it should impact 1500 rows.

See “Data server error handling” for row count validation not related to SQL statement replication.