How to remove a subscriber from the 4.8.x LogShipping Plan?
At the meanwhile, there is no auto-procedure for removing one subscriber from a LogShipping Plan. User have to do it manually as following:
FIrst, user need to disable and delete the LogShipping jobs corresponding to this plan from the subscriber manually.
Then, run the following script in the publisher and all the subscribers
use LiteSpeedLocal
go
declare @DBID uniqueidentifier
declare @DBID2 uniqueidentifier
declare @SNID uniqueidentifier
declare @PlanID uniqueidentifier
declare @PubServerName nvarchar (255)
declare @SubServerName nvarchar (255)
declare @PubDBName nvarchar (255)
declare @SubDBName nvarchar (255)
set @PubServerName = '<Publisher server name>' -- Publisher server name
set @SubServerName = '<Subscriber server name>' -- Subscriber server name
set @PubDBName = '<Publisher Database Name>' -- Publisher Database name
set @SubDBName = '<Subscriber Database Name>' -- Subscriber Database name
If @SubServerName = @@ServerName
begin
select @DBID = DBID, @SNID = SNID
from LSDataBase where SNID = (select SNID from LSServer where ServerName = @SubServerName)
AND DataBaseName = @SubDBName
select @PlanID = PlanID from LSDataBasePlans where DBID = @DBID
select * from LSRestoreLog where PlanID = @PlanID
select * from LSBackupLog where PlanID = @PlanID
--select * from LSTrackingLog where PlanID = @PlanID
select * from LSUNC where PlanID = @PlanID
select * from LSServerPlans where PlanID = @PlanID and SNID = @SNID
select * from LSDataBasePlans where DBID = @DBID
select * from LSJobs where PlanID = @PlanID
select * from LSBaseOptions where PlanID = @PlanID
select * from LSPlans where PlanID = @PlanID
select * from LSDataBase where DBID = @DBID
delete from LSRestoreLog where PlanID = @PlanID
delete from LSBackupLog where PlanID = @PlanID
delete from LSTrackingLog where PlanID = @PlanID
delete from LSUNC where PlanID = @PlanID
delete from LSServerPlans where PlanID = @PlanID and SNID = @SNID
delete from LSDataBasePlans where DBID = @DBID
delete from LSJobs where PlanID = @PlanID
delete from LSBaseOptions where PlanID = @PlanID
delete from LSDataBase where DBID = @DBID
select @DBID2 = DBID, @SNID = SNID
from LSDataBase where SNID = (select SNID from LSServer where ServerName = @PubServerName)
AND DataBaseName = @PubDBName
select * from LSDataBasePlans where DBID = @DBID2
select * from LSDataBase where DBID = @DBID2
delete from LSDataBasePlans where DBID = @DBID2
delete from LSDataBase where DBID = @DBID2
delete from LSPlans where PlanID = @PlanID
end
else
begin
select @DBID = DBID, @SNID = SNID
from LSDataBase where SNID = (select SNID from LSServer where ServerName = @SubServerName)
AND DataBaseName = @SubDBName
select @PlanID = PlanID from LSDataBasePlans where DBID = @DBID
select * from LSDataBasePlans where DBID = @DBID
select * from LSServerPlans where PlanID = @PlanID and SNID = @SNID
select * from LSJobs where PlanID = @PlanID and SNID = @SNID
select * from LSDataBase where DBID = @DBID
delete from LSDataBasePlans where DBID = @DBID
delete from LSServerPlans where PlanID = @PlanID and SNID = @SNID
delete from LSJobs where PlanID = @PlanID and SNID = @SNID
delete from LSDataBase where DBID = @DBID
end