Loading a Primary Database from Dumps

If you are loading only a primary database in a replication system, load the database to a previous state and resolve any inconsistencies with replicate databases.

  1. Log in to the primary Replication Server to get the database generation number for the primary database:
    admin get_generation, data_server, database

    Make note of this number, which you will need for a later step.

  2. Shut down the RepAgent for the primary database:
    sp_stop_rep_agent database
  3. Suspend the DSI connection to the primary database (for exclusive use).
  4. Load the database to the most recent or previous state.

    This step entails loading the most recent database dump and all subsequent transaction log dumps.

    Refer to the Adaptive Server Enterprise System Administration Guide for instructions.

  5. Resume the DSI connection.
  6. Dump the transaction log.
    Enter:
    use database
    go
    dbcc settrunc('ltm', 'ignore')
    go
    dump tran database with truncate_only
    go
    dbcc settrunc('ltm', 'valid')
    go
  7. Execute the dbcc settrunc command in the restored primary database to set the generation number to the next higher number.
    For example, if the admin get_generation command in step 1 returned 0, enter :
    use database
    go
    dbcc settrunc('ltm', 'gen_id', 1)
  8. Clear the locator information.
    Enter:
    rs_zeroltm data_server, database
  9. Start RepAgent for the primary database. To do this, execute the following command:
    sp_start_rep_agent database
  10. Run the rs_subcmp program for each subscription at the replicate sites. Use the -r flag to reconcile the replicate data with the restored primary data, or drop all the subscriptions and re-create them.

    See Replication Server Administration Guide Volume 1 > Manage Subscriptions > Obtain Subscription Information > Verify Subscription Consistency > Use rs_subcmp To Locate and Correct Inconsistencies, and Replication Server Reference Manual > Executable Programs > rs_subcmp.