Restoring replicate databases

If the database is a replicate database, issue the following commands to alter rs_lastcommit and rs_threads, because they are dependent on the logical page size.

To alter rs_lastcommit, issue:

 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

To alter rs_threads, issue:

 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