Friday, March 12, 2021

SQL SERVER RESTORE ERROR Invalid object name 'MSreplication_subscriptions'.

 --Fix


Go back to the original and then disable the subscription

right click and create script

--DISABLE

/****** Begin: Script to be run at Subscriber ******/

use [Worklog]

exec sp_dropmergepullsubscription @publisher = N'PHAILORTSQL05', @publisher_db = N'Worklog', @publication = N'Worklog'

GO


/****** End: Script to be run at Subscriber ******/


/****** Begin: Script to be run at Publisher ******/

/*use [Worklog]

exec sp_dropmergesubscription @subscription_type = N'pull', @publication = N'Worklog', @subscriber = N'HKACPKWUSQL01', @subscriber_db = N'Worklog'

*/

/****** End: Script to be run at Publisher ******/


--ENABLE

-- Adding the merge pull subscription


/****** Begin: Script to be run at Subscriber ******/

use [Worklog]

exec sp_addmergepullsubscription @publisher = N'PHAILORTSQL05', @publication = N'Worklog', @publisher_db = N'Worklog', @subscriber_type = N'Local', @subscription_priority = 0, @description = N'', @sync_type = N'Automatic'

exec sp_addmergepullsubscription_agent @publisher = N'PHAILORTSQL05', @publisher_db = N'Worklog', @publication = N'Worklog', @distributor = N'PHAILORTSQL05', @distributor_security_mode = 1, @distributor_login = N'', @distributor_password = N'', @enabled_for_syncmgr = N'False', @frequency_type = 64, @frequency_interval = 0, @frequency_relative_interval = 0, @frequency_recurrence_factor = 0, @frequency_subday = 0, @frequency_subday_interval = 0, @active_start_time_of_day = 0, @active_end_time_of_day = 235959, @active_start_date = 0, @active_end_date = 0, @alt_snapshot_folder = N'', @working_directory = N'', @use_ftp = N'False', @job_login = N'ecp\reynaldoglennangeles', @job_password = null, @publisher_security_mode = 1, @publisher_login = N'', @publisher_password = N'', @use_interactive_resolver = N'False', @dynamic_snapshot_location = N'', @use_web_sync = 0

GO

/****** End: Script to be run at Subscriber ******/


/****** Begin: Script to be run at Publisher ******/

/*use [Worklog]

exec sp_addmergesubscription @publication = N'Worklog', @subscriber = N'HKACPKWUSQL01', @subscriber_db = N'Worklog', @subscription_type = N'pull', @subscriber_type = N'local', @subscription_priority = 0, @sync_type = N'Automatic'

*/

/****** End: Script to be run at Publisher ******/

No comments:

Post a Comment