Postmigration procedures

After migration, restore the replication information in the database. These steps can be generated by the repl report.

If the page size changes between the source and target, you must also follow directions in “Amending system tables when the logical page size changes”.

Replication Server identifies all connections by server_name.database_name. After migration, you must change the name of the target server (the server you are migrating to) to that of the source server (the server you are migrating from).

StepsRestoring primary databases

Follow this procedure for all primary databases, including the RSSD, if it is a primary database.

If the page size changes during the migration, you must also alter the rs_lastcommit and rs_threads system tables as described in “Amending system tables when the logical page size changes”.

  1. If the original primary database had warm standby on, restore the standby status. Enter:

    sp_reptostandby database_name, status
    

    sybmigrate saves the standby status in the migration log of the source database.

  2. Increase the generation ID by 1. Enter:

    dbcc settrunc ("ltm", "gen_id", gen_id)
    

    You can view the current generation ID in the migration log of the source database.

  3. Reset the secondary truncation point:

    dbcc settrunc ("ltm", "valid")
    
  4. Zero the Replication Server locator value for this database. Enter:

    rs_zeroltm server, database_name
    
  5. If this database is an active connection in a warm standby configuration, rematerialize the standby database by dumping the primary and loading the dumps into the standby. See the Replication Server documentation for instructions.

  6. Start the RepAgent on the primary database. Enter:

    sp_start_rep_agent database_name
    
  7. Log in to the Replication Server and restart log transfer:

    resume log transfer from server.database
    

StepsRestoring the RSSD

  1. If the RSSD is a primary database, follow the procedure in “Restoring primary databases”.

    If the page size changes, make sure you alter the rs_lastcommit and rs_threads system tables as instructed.

  2. Turn off hibernation for the Repliction Server. Log in to Replication Server and enter:

    sysadmin hiberate_off replication_server
    

StepsAmending system tables when the logical page size changes

If the logical page size changes during migration, you must alter the rs_lastcommit and rs_threads system tables to account for the change.

Follow this procedure for all databases in which the page size has changed.

  1. Alter the rs_lastcommit table. Enter:

     declare @pad8_size integer
     declare @alter_cmd varchar(200)
    
     select @pad8_size = (@@maxpagesize / 2)
     - (select sum(A.length) from
     syscolumns A, sysobjects B
     where A.id = B.id
     and B.name = 'rs_lastcommit')
     + (select A.length from
     syscolumns A, sysobjects B
     where A.id = B.id
     and B.name = 'rs_lastcommit'
     and A.name = 'pad8')
    
     select @alter_cmd = "alter table rs_lastcommit "
     + "modify pad8 char("
     + convert(varchar(100), @pad8_size)
     + ")"
     execute (@alter_cmd)
     go
    
  2. Alter the rs_threads table. Enter:

     declare @pad4_size integer
     declare @alter_cmd varchar(200)
    
     select @pad4_size = (@@maxpagesize / 2)
     - (select sum(A.length) from
     syscolumns A, sysobjects B
     where A.id = B.id
     and B.name = 'rs_threads')
     + (select A.length from
     syscolumns A, sysobjects B
     where A.id = B.id
     and B.name = 'rs_threads'
     and A.name = 'pad4')
    
     select @alter_cmd = "alter table rs_threads "
     + "modify pad4 char("
     + convert(varchar(100), @pad4_size)
     + ")"
     execute (@alter_cmd)
     go