Amending System Tables When the Logical Page Size Changes

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

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

  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
Related concepts
Postmigration Procedures
Restoring Replicate Databases