Creating an error class

You can define a single error class to use with all databases managed by the same type of data server. For example, you can use the default Adaptive Server error class, rs_sqlserver_error_class, with any Adaptive Server database. There is no need to create another error class unless a database has special error-handling requirements.

An error class is a name used to group error action assignments. Use create error class, the set template to option, and another error class as a template to create your own error classes. create error class copies the error actions from the template error class to the new error class.

NoteWhen you create a connection using a connection profile, the error class is assigned by the connection profile. The connection profile predefines the error class for a specific data server. See “Connection profiles” on page 183 in Chapter 7, “Managing Database Connections” in the Replication Server Administration Guide Volume 1.

Syntax

create [replication server] error class error_class
[set template to template_error_class]

Example

This example creates an error class named pubs2_error_class without a template error class:

create error class pubs2_error_class

This example creates the my_rs_err_class Replication Server error class based on rs_repserver_error_class, which is the default Replication Server error class:

create replication server error class my_rs_err_class
set template to rs_repserver_error_class

This example creates the my_error_class error class for an Oracle database based on rs_oracle_error_class as a template:

create error class my_error_class
set template to rs_oracle_error_class

Initially, rs_sqlserver_error_class and the other default non-ASE error classes, do not have a primary site. Since you can only create server-wide error classes at a primary site for a class, you need to designate one of the Replication Servers as a primary site for an error class.

You must specify a primary site before you can modify a default error class. You can designate a site as primary by executing the create error class command for an error class at that site. For Adaptive Server for example, execute create error class rs_sqlserver_error_class at the primary site. Verify that all other Replication Servers have direct or indirect routes from the primary site.

The default error action for all errors returned by a data server is stop_replication. This is also the most serious action: it suspends replication for the database, as if you entered the suspend connection command. To assign less severe actions to errors you want to handle differently, use the assign action command. See “Assigning actions to data server errors” for more information.