Ich habe dieses Beispiel mit SQL Server 2000 (MS2000) als Herausgeber und SQL Server 2008 (MS2008) als Abonnent getestet. Auf dem Herausgeber enthält eine Datenbank namens arp mehrere Tabellen, aber nur die Tabellenbenutzer sind als Artikel in der Veröffentlichung enthalten. In diesem Beispiel wird das Abonnement von beiden Servern entfernt und dann wieder zurückgesetzt.
Auf dem Abonnenten MS2008
Das vorhandene Abonnement wurde aus MS2008 entfernt
USE arp
GO
EXEC sp_droppullsubscription @publisher='MS2000', @publisher_db='arp', @publication='arp_pub'
Auf dem Verlag MS2000
Abonnement gelöscht
-- dropped subscription
exec sp_dropsubscription @publication = N'Arp_pub', @subscriber = N'MS2008', @destination_db = N'arp', @article = N'all'
Der Abonnent wurde gelöscht
-- On MS2000, dropped subscriber from MS2008 after removing it from MS2008
exec sp_dropsubscriber @subscriber = N'MS2008'
Später erstelle ich das Abonnement neu.
Auf dem Publisher MS2000
Fügen Sie im Abonnenten wieder hinzu
use [master]
exec sp_addsubscriber @subscriber = N'MS2008', @type = 0, @description = null, @security_mode = 1, @frequency_type = 64, @frequency_interval = 1, @frequency_relative_interval = 1, @frequency_recurrence_factor = 0, @frequency_subday = 4, @frequency_subday_interval = 5, @active_start_time_of_day = 0, @active_end_time_of_day = 235959, @active_start_date = 0, @active_end_date = 99991231
exec sp_changesubscriber_schedule @agent_type = 1, @subscriber = N'MS2008', @frequency_type = 4, @frequency_interval = 1, @frequency_relative_interval = 1, @frequency_recurrence_factor = 0, @frequency_subday = 8, @frequency_subday_interval = 1, @active_start_time_of_day = 0, @active_end_time_of_day = 235959, @active_start_date = 0, @active_end_date = 99991231
GO
Im Abonnement wieder hinzufügen
use [Arp]
exec sp_addsubscription @publication = N'Arp_pub', @subscriber = N'MS2008', @destination_db = N'arp', @sync_type = N'Automatic', @subscription_type = N'pull', @update_mode = N'read only'
GO
Auf dem Abonnenten MS2008
Erstellen Sie die Datenbank
CREATE DATABASE arp;
GO
Fügen Sie das Pull-Abonnement hinzu
use [arp]
exec sp_addpullsubscription @publisher = N'MS2000', @publication = N'Arp_pub', @publisher_db = N'Arp', @independent_agent = N'False', @subscription_type = N'pull', @description = N'', @update_mode = N'read only', @immediate_sync = 0
Fügen Sie den Agenten hinzu
Das @job_login ist ein ntlm-Benutzer, der Rechte für den Standard-Snapshot-Ordner hat. Dieser Benutzer hat auch Zugriff auf die Veröffentlichung im Verlag
Der Snapshot-Ordner ist ein freigegebener Ordner, auf den sowohl Publisher als auch Subscriber zugreifen können.
exec sp_addpullsubscription_agent @publisher = N'MS2000', @publisher_db = N'Arp', @publication = N'Arp_pub', @distributor = N'MS2000', @distributor_security_mode = 1, @distributor_login = N'', @distributor_password = null, @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 = 20120214, @active_end_date = 99991231, @alt_snapshot_folder = N'', @working_directory = N'', @use_ftp = N'False', @job_login = N'MS2008\replication_user', @job_password = 'test123', @publication_type = 0
GO
Auf dem Publisher MS2000 habe ich den Snapshot-Job ausgeführt
Die replizierte Tabelle war auf MS2008 wieder sichtbar.