首页 > 数据库 >数据库复制订阅问题解决脚本

数据库复制订阅问题解决脚本

时间:2022-09-29 09:34:52浏览次数:58  
标签:订阅 dbo exec -- 数据库 sp 复制 master SQL

--查列表

select * from msdb.dbo.MSdistpublishers
DELETE FROM msdb.dbo.MSdistpublishers
select * from msdb.dbo.MSdistpublishers

--增加
exec sp_droplinkedsrvlogin '1000MES2',null
exec sp_dropserver '1000MES2','droplogins'
exec sp_addserver '5742MES2' , 'LOCAL'

 

select * from master..sysservers
exec sp_helpserver
exec sp_dropserver '5742MES2', droplogins
exec sp_addserver '5742MES2', LOCAL

--重新配置发布服务器
EXEC master.dbo.sp_serveroption @server=N'repl_distributor', @optname=N'dist', @optvalue=N'false'
GO

exec sp_droplinkedsrvlogin 'repl_distributor',null
go
exec sp_dropserver 'repl_distributor'


exec sp_dropdistributiondb @database=N'distribution'
alter database distribution set offline
drop database distribution

exec sp_removedbreplication 'Test'

--删库
USE master;
GO
DECLARE @SQL VARCHAR(MAX);
SET @SQL=''
SELECT @SQL=@SQL+'; KILL '+RTRIM(SPID)
FROM master..sysprocesses
WHERE dbid=DB_ID('Test');
EXEC(@SQL);
GO
ALTER DATABASE Test SET MULTI_USER;

 

标签:订阅,dbo,exec,--,数据库,sp,复制,master,SQL
From: https://www.cnblogs.com/RainbowInTheSky/p/16740285.html

相关文章