Creating a Replication Agent instance using resource files

The ra_admin utility provides two command line parameters that support creating a Replication Agent instance using a resource file, and validating resource files.

Syntax

ra_admin {-vr res_file | -r res_file}

Parameters

-vr res_file

-r res_file

A resource file is an ASCII text file that contains configuration information for the Replication Agent instance to be created by the ra_admin utility.

The ra_admin parameters in the resource file allow you to specify the following options, in addition to creating a Replication Agent instance:

NoteWhen you validate a resource file with ra_admin -vr, no other action is taken, and no Replication Agent instance is created.

The following sections describe how to use a Replication Agent resource file:


Creating a new resource file

Resource file templates, mssql.rs (for Microsoft SQL Server), oracle.rs (for Oracle), and ibmudb.rs (for IBM DB2 Universal Database) are provided in the init subdirectory of the Replication Agent installation directory. For example:

C:\sybase\RAX-15_2\init\mssql.rs

or

C:\sybase\RAX-15_2\init\oracle.rs

or

C:\sybase\RAX-15_2\init\ibmudb.rs

The resource file template contains comments that describe each configuration parameter and its value.

NoteSybase recommends that you validate each resource file before you create a Replication Agent instance using that resource file.

StepsCreating a resource file

  1. Copy the resource file template to another file that you edit to create the new resource file. For example:

    cp oracle.rs pubs2.rs
    

    Here, pubs2.rs is the name of the new resource file you want to create.

    If you have an existing resource file, you can copy that file to create a new resource file, instead of copying the template.

  2. Use your preferred text editor to edit the resource file copy that you created.

After you create a new resource file, you should validate it. See “Validating a resource file”.


Editing a resource file

The ra_admin resource file is an ASCII text file that you can edit using any standard text editor.

Resource file contents must conform to the following:

NoteBlank lines and lines that begin with the # symbol are ignored in the resource file.


Validating a resource file

When you invoke the ra_admin utility with the -vr option, the utility validates the specified resource file and returns information about the validation process.

The ra_admin utility validates resource files by:

If any validation fails, the ra_admin utility returns an error message and information about the failure.

You can repeat the validation process as many times as necessary. No entities are changed or created as a result of this process.

NoteSybase recommends that you validate a new resource file before you create a Replication Agent instance using the new resource file.

StepsValidating a resource file

  1. Invoke the ra_admin utility, specifying the -vr option and the name of the resource file:

    ra_admin -vr res_file
    

    Here, res_file is the name of the resource file you want to validate.

    For example, if the resource file is named pubs2.rs, enter the following at the command prompt:

    ra_admin -vr pubs2.rs
    

    Validation results are returned as either:

    • Response-file processing completed.

      or

    • Response-file processing completed with errors.

    If the validation is successful, you can skip step 2, and use the resource file to create a Replication Agent instance. See “Creating an instance with a resource file”.

    If the validation encounters errors, continue to step 2.

  2. Use the following procedure to correct validation errors:

    1. Review the error messages to determine the cause of the failure.

    2. Edit the resource file to correct the appropriate values.

    3. Invoke ra_admin -vr again, specifying the name of the resource file.

    Repeat this step until the resource file is successfully validated.


Creating an instance with a resource file

When you invoke the ra_admin utility with the -r option, the utility first validates the specified resource file, as described in “Validating a resource file”, except:

After validating the resource file successfully, the ra_admin utility does the following:

The utility also returns information about the instance created and the result.

If instance creation fails, the ra_admin utility returns an error message and information about the failure.

NoteSybase recommends that you validate a new resource file before you create a Replication Agent instance using the new resource file. See “Validating a resource file”.

StepsCreating a Replication Agent instance

  1. Invoke the ra_admin utility, specifying the -r option and the name of the resource file:

    ra_admin -r res_file
    

    Here, res_file is the name of the resource file.

    For example, if the resource file is named pubs2.rs, enter the following at the command prompt:

    ra_admin -r pubs2.rs
    

    Results are returned as either:

    • Response-file processing completed.

      or

    • Response-file processing completed with errors.

If the instance creation is successful, you can begin using the new Replication Agent instance.

If the instance creation fails, you may have to:

NoteIf the instance creation fails, use the following recovery procedure before you attempt to create the instance again.

StepsRecovering from instance creation errors

  1. If the resource file does not specify that the instance user login be created in the primary data server, skip this step and continue with step 2.

    If the resource file specifies that the instance user login be created in the primary data server (that is, create_pds_username=yes), then:

    1. Check the primary database to determine if the instance user was added.

    2. Check that the pds_sa_username has sufficient privileges to create the instance login at the primary database.

    3. Edit the resource file to specify that the instance user login should not be created in the primary data server (create_pds_username=no).

    NoteIf the Replication Agent primary database user login is successfully created before the instance creation fails, you must either:

    • Edit the resource file to set the value of the create_pds_username parameter to no, or

    • Log in to the primary data server and drop the instance login.

  2. Check the Replication Agent base directory on the Replication Agent host to determine if a new instance directory was created. The Replication Agent base directory is:

    %SYBASE%\RAX-15_2
    

    Here, %SYBASE% is the Replication Agent installation directory.

    If you do not find a new instance directory in the Replication Agent base directory, skip step 3 and continue with step 4.

    If you find a new instance directory in the Replication Agent base directory, continue with step 3.

  3. To delete the new instance directory, you have two options:

    • Use the ra_admin utility to delete the instance:

      ra_admin -d inst_name
      

      Here, inst_name is the name of the instance you want to delete, or

    • Use operating system commands to delete all of the files and subdirectories in the new instance directory, and then delete the new instance directory.

  4. Review the error messages to find the cause of the instance creation failure, and if necessary, edit the resource file to correct the appropriate values.

    After editing the resource file, use ra_admin to validate the resource file:

    ra_admin -vr res_file
    

    Here, res_file is the name of the resource file.

    See “Validating a resource file” for more information.

After you complete the recovery procedure, you can retry creating the Replication Agent instance.