当前位置: 移动技术网 > IT编程>数据库>MSSQL > distribution 分发数据库 灾难恢复 备份恢复

distribution 分发数据库 灾难恢复 备份恢复

2018年09月21日  | 移动技术网IT编程  | 我要评论

天安门车祸,李宗瑞梁婖婷qvod,游戏机之家

参考:
前提:
    准备一台电脑,主机名和以前的分发数据库一致。并且安装sql server
 
恢复步骤:
在新的distribution服务器上
1.配置distribution,增加之前的publisher
2.使用备份还原distribution数据库
3.创建job,主要是快照agent和logreadagent,可以从老的distribution直接复制
3.修改发布服务器属性
  exec sp_changedistpublisher  'testsyncdbserv', 'active', 'true' 
4.修改[mspublisher_databases]中的publisher_id为publisher服务器在sys.servers中的server_id
update t  set t. publisher_id  = 2  from dbo.[mspublisher_databases]  t where id=2   
5.修改[mspublications]中的publisher_id为publisher服务器在sys.servers中的server_id
update t set t. publisher_id  = 2 from dbo.mspublications  t where publication_id=2
6.修改[msdistribution_agents]中的publisher_id为publisher服务器在sys.servers中的server_id,subscriber_id为订阅服务器在sys.servers中的server_id,如果没有订阅的可以直接创建。
 exec master.dbo.sp_addlinkedserver @server = n'testsyncrptserv', @srvproduct=n'sql server'
 exec master.dbo.sp_addlinkedsrvlogin @rmtsrvname=n'testsyncrptserv',@useself=n'true',@locallogin=null,@rmtuser=null,@rmtpassword=null
 update dbo.msdistribution_agents set publisher_id=2,subscriber_id=3 where id = 4
7.修改[mssubscriptions]中的publisher_id为publisher服务器在sys.servers中的server_id,subscriber_id为订阅服务器在sys.servers中的server_id,如果没有订阅的可以直接创建。
update dbo.mssubscriptions  set publisher_id =2,subscriber_id=3 where publication_id=2
8.修改logreadagent,snapshotagent的publish_id和对应的job信息
 update [mslogreader_agents]  set publisher_id =2  where id = 2
 update [mssnapshot_agents]  set publisher_id =2  where id = 2
 update t
  set t.job_id = sj.job_id, t.job_step_uid = sjs.step_uid
 from dbo.mslogreader_agents t
  left join dbo.msreplication_monitordata   sm on sm.agent_name = t.name
  left join msdb.dbo.sysjobs sj  on sj.name = t.name
  left join msdb.dbo.sysjobsteps sjs on sj.job_id = sjs.job_id and sjs.step_id = 2
 update t
  set t.job_id = sj.job_id, t.job_step_uid = sjs.step_uid
 from dbo.[mssnapshot_agents] t
  left join dbo.msreplication_monitordata   sm on sm.agent_name = t.name
  left join msdb.dbo.sysjobs sj  on sj.name = t.name
  left join msdb.dbo.sysjobsteps sjs on sj.job_id = sjs.job_id and sjs.step_id = 2
 
在发布上运行
修改发布数据库中的syspublications,syssubscriptions中job的id
update [dbo].[syspublications] set snapshot_jobid=0xd2e257afd287304ca2fc14f3d7c1aecf
update [dbo].[syssubscriptions] set distribution_jobid=0x0e79d3a2a36f73409db3f4261723f37a

 

 
 

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网