Loading a primary database from dumps

Use this procedure if you are loading only a primary database in a replication system. To load the database to a previous state and resolve any inconsistencies with replicate databases, follow this procedure:

  1. Log in to the primary Replication Server and use the admin get_generation command to get the database generation number for the primary database:

    admin get_generation, data_server, database
    

    Write down the generation number so you have it for step 7.

  2. Shut down the RepAgent for the primary database. To do this execute sp_stop_rep_agent system procedure.

    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. Enter the following commands to dump the transaction log:

    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 the following commands:

    use database
    go
    dbcc settrunc('ltm', 'gen_id', 1)
    
  8. Run the following command to clear the locator information:

    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 Chapter 11, “Managing Subscriptions” in the Replication Server Administration Guide Volume 1 for more information on using rs_subcmp. Also refer to Chapter 7, “Executable Programs,” in the Replication Server Reference Manual for more information about rs_subcmp command.