Changing Replicate Databases to Primary Databases

Each primary database must have a Replication Agent that scans the database log and transfers data to the Replication Server for distribution to replicate databases. If you want to change an Adaptive Server database that is designated as replicate-only to be a source of replicated functions or to contain primary data, you must enable the RepAgent thread for the database.

  1. Configuring RepAgent at the Replication Server
    1. Create a RepAgent user so that RepAgent can log in to Replication Server. Use the create user command where ra_user_name is the name of the RepAgent user and ra_password is the RepAgent password:
      create user ra_user_name
      set password {ra_password | null}
    2. Grant this user connect source permission, using the grant command:
      grant connect source to ra_user_name

      If the Replication Server already manages a primary database, you can use the “RepAgent user” that already exists for the new primary database.

    3. Execute alter connection using the log transfer on option:
      alter connection to data_server.database
      set log transfer to 'on'
  2. Configuring RepAgent at the Adaptive Server database
    1. If the name of the Adaptive Server has not yet been defined, you must define it using the following command where lname is the Adaptive Server name:
      sp_addserver lname, local
    2. If RepAgent threads have not been enabled for the Adaptive Server, you must enable them:
      sp_configure 'enable rep agent threads'
    3. Configure RepAgent for the database with sp_config_rep_agent:
      sp_config_rep_agent dbname, 'enable', 'rs_name',
              'rs_user_name', 'rs_password'
      Note: The value for rs_user_name and rs_password configured at the Adaptive Server must be the same for ra_user_name and ra_password created at the Replication Server in step 1.
    4. Create the rs_marker stored procedure and set its replicate status to “true”, using the sp_setreplicate system procedure.

      You can find the rs_marker stored procedure in the file rs_install_primary.sql or rsinssys.sql in the scripts directory of the Sybase release directory.

    5. Start RepAgent:
      sp_start_rep_agent dbname
Related tasks
Configuring RepAgent