Changing the character set and sort order

If you change the character set or sort order of Adaptive Server, you must also change the character set or sort order of:

If you change the sort order of Adaptive Server, you must also change the sort order of the replicate Replication Server and replicate data server to ensure that subscriptions are processed consistently.

After changing the character set or sort order, subscription semantics may change. Sort order changes can have obvious consequences. Suppose a subscription contains the clause “where last_name = MacGregor.” If the sort order is changed from dict to binary, for example, “MacGregor” no longer qualifies for sorting.

Synchronize the primary and replication databases

You must make sure that the primary and replicate databases are resynchronized after you change the character set or sort order. Sybase recommends that you use one of these methods:

NoteUse the purge and rematerialize method if any subscriptions contain character clauses. Only this method ensures that subscriptions with character clauses are resynchronized.

StepsChanging the character set or sort order

All replicated transactions originating from Adaptive Server must arrive at the replicate data server before the character set or sort order is modified. In addition to changing the sort order or character set, this procedure ensures that no data corruption occurs resulting from changing the character set or sort order.

  1. Identify all Replication Servers and Adaptive Servers that are associated with the primary Adaptive Server—including all RSSDs for associated Replication Servers.

    NoteIf you are changing the character set: look up the character set of all Adaptive Servers in the Replication Server domain to ascertain if their character sets must also be changed. Sybase supports alternate character sets for servers in the same domain, but the implication for users is significant.

    If you are changing the sort order: Sybase recommends that all data servers in the Replication Server domain share the same sort order. This ensures that data and identifiers are ordered consistently throughout the replication system.

  2. Quiesce all primary updates and make sure that they have been processed by Replication Server.

    NoteIf you are changing the character set, make sure that there are sufficient empty transactions to span a page in Adaptive Server. This ensures that after the Adaptive Server transaction log is emptied (see step 9), there will be no data still in the old character set.

  3. Quiesce all associated Replication Servers.

  4. Shut down all associated Replication Servers, RepAgents, and Replication Agents.

  5. Change the character set and/or sort order in configuration files for the Replication Servers and, if applicable, for the Replication Agents.

  6. Follow Adaptive Server procedures for changing the default character set and/or sort order of each associated Adaptive Server. See “Configuring Character Sets, Sort Orders, and Languages” in the Adaptive Server Enterprise System Administration Guide Volume 1.

  7. Shut down all associated Adaptive Servers.

  8. Start up the associated Adaptive Servers in single-user mode—unless you can guarantee that there will be no activity at the primary and replicate databases.

  9. Remove the secondary truncation point from each associated Adaptive Server. This step allows Adaptive Server to truncate log records that the RepAgent has not yet transferred to the Replication Server. From the Adaptive Server, enter:

    dbcc settrunc('ltm', 'ignore')
    
  10. Truncate the transaction log. From the Adaptive Server, enter:

    dump transaction db_name with truncate_only
    
  11. Reset the secondary truncation point. From the Adaptive Server, enter:

    dbcc settrunc('ltm', 'valid')
    
  12. Reset the locator value for the primary database to zero. This step instructs Replication Server to get the new secondary truncation point from Adaptive Server and set the locator to that value. From the Adaptive Server, enter:

    rs_zeroltm data_server, db_name
    
  13. Shut down and restart Adaptive Server in normal mode.

  14. Restart the associated Replication Servers.

  15. Allow RepAgents (or Replication Agents) to reconnect to Replication Servers by resuming log transfer. From the Replication Server, enter:

    resume log transfer from data_server.db_name
    
  16. Start up RepAgents.

  17. Restart replication.