Aracılığıyla paylaş


sp_addmergesubscription (Transact-SQL)

Oluşturur bir gönderme veya çekme abonelik birleştirme.Bu saklı yordam, yayın veritabanı üzerinde yayımcı adresindeki yürütülür.

Konu bağlantısı simgesiTransact-sql sözdizimi kuralları

Sözdizimi

sp_addmergesubscription [ @publication= ] 'publication'
    [ , [ @subscriber = ] 'subscriber' ]
    [ , [ @subscriber_db= ] 'subscriber_db' ]
    [ , [ @subscription_type= ] 'subscription_type' ]
    [ , [ @subscriber_type= ] 'subscriber_type' ]
    [ , [ @subscription_priority= ] subscription_priority ]
    [ , [ @sync_type= ] 'sync_type' ]
    [ , [ @frequency_type= ] frequency_type ]
    [ , [ @frequency_interval= ] frequency_interval ]
    [ , [ @frequency_relative_interval= ] frequency_relative_interval ]
    [ , [ @frequency_recurrence_factor= ] frequency_recurrence_factor ]
    [ , [ @frequency_subday= ] frequency_subday ]
    [ , [ @frequency_subday_interval= ] frequency_subday_interval ]
    [ , [ @active_start_time_of_day= ] active_start_time_of_day ]
    [ , [ @active_end_time_of_day= ] active_end_time_of_day ]
    [ , [ @active_start_date= ] active_start_date ]
    [ , [ @active_end_date= ] active_end_date ]
    [ , [ @optional_command_line= ] 'optional_command_line' ]
    [ , [ @description= ] 'description' ]
    [ , [ @enabled_for_syncmgr= ] 'enabled_for_syncmgr' ]
    [ , [ @offloadagent= ] remote_agent_activation]
    [ , [ @offloadserver= ] 'remote_agent_server_name' ]
    [ , [ @use_interactive_resolver= ] 'use_interactive_resolver' ]
    [ , [ @merge_job_name= ] 'merge_job_name' ]
    [ , [ @hostname = ] 'hostname'

Bağımsız değişkenler

  • [ @publication=] 'publication'
    Is the name of the publication.publication is sysname, with no default.yayın önceden mevcut olmalıdır.

  • [ @subscriber =] 'subscriber'
    Is the name of the Subscriber.subscriber is sysname, with a default of NULL.

  • [ @subscriber_db=] 'subscriber_db'
    Is the name of the subscription database.subscriber_dbis sysname, with a default of NULL.

  • [ @subscription_type=] 'subscription_type'
    Is the type of subscription.subscription_typeis nvarchar(15), with a default of PUSH.If push, a push subscription is added and the Merge Agent is added at the Distributor.If pull, a pull subscription is added without adding a Merge Agent at the Distributor.

    Not

    Anonim abonelikleri gerek bunu kullanmak saklı yordam.

  • [ @subscriber_type=] 'subscriber_type'
    Is the type of Subscriber.subscriber_typeis nvarchar(15), and can be one of the following values.

    Değer

    Açıklama

    local (varsayılan)

    Yalnızca bilinen abone Yayımcı.

    global

    Tüm sunucular için bilinen abone.

    De SQL Server 2005 ve sonraki sürümleri, yerel abonelikleri bilinir olarak istemci abonelikleri ve genel abonelikleri bilinir olarak sunucu abonelikleri.Daha fazla bilgi için bkz: "Abonelik türleri" Bölüm'de Birleştirme çoğaltması nasıl algıladığı ve çakışmaları giderir.

  • [ @subscription_priority=] subscription_priority
    Is a number indicating the priority for the subscription.subscription_priorityis real, with a default of NULL.Yerel ve anonim abonelikleri 0.0 önceliktir.Genel abonelikleri için öncelik 100.0'den az olmalıdır.

  • [ @sync_type=] 'sync_type'
    Is the subscription synchronization type.sync_typeis nvarchar(15), with a default of automatic.Can be automatic or none.If automatic, the schema and initial data for published tables are transferred to the Subscriber first.If none, it is assumed the Subscriber already has the schema and initial data for published tables.Sistem tablolarını ve veri her zaman transfer edilir.

    Not

    Bir değeri olmayan belirtme öneririz none.Daha fazla bilgi için bkz: Birleştirme aboneliği olmayan bir Snapshot başlatılıyor.

  • [ @frequency_type=] frequency_type
    Is a value indicating when the Merge Agent will run.frequency_type is int, and can be one of the following values.

    Değer

    Açıklama

    1

    Bir kez

    4

    Günlük

    8

    Haftalık

    10

    Aylık

    20

    Frekans aralığı göreli olarak aylık

    40

    Zaman SQL Server Agent başlatır

    Null(default)

     

  • [ @frequency_interval=] frequency_interval
    The day or days that the Merge Agent runs.frequency_interval is int, and can be one of the following values.

    Değer

    Açıklama

    1

    Pazar

    2

    Pazartesi

    3

    Salı

    4

    Çarşamba

    5

    Perşembe

    6

    Cuma

    7

    Cumartesi

    8

    Günü

    9

    Hafta içi

    10

    Hafta sonu gün

    Null(default)

     

  • [ @frequency_relative_interval=] frequency_relative_interval
    Is the scheduled merge occurrence of the frequency interval in each month.frequency_relative_interval is int, and can be one of these values.

    Değer

    Açıklama

    1

    First

    2

    İkinci

    4

    Üçüncü

    8

    Dördüncü

    16

    Last

    Null(default)

     

  • [ @frequency_recurrence_factor=] frequency_recurrence_factor
    Is the recurrence factor used by frequency_type.frequency_recurrence_factoris int, with a default of NULL.

  • [ @frequency_subday=] frequency_subday
    Is the unit for frequency_subday_interval.frequency_subday is int, and can be one of the following values.

    Değer

    Açıklama

    1

    Bir kez

    2

    İkinci

    4

    Dakika

    8

    Saat

    Null(default)

     

  • [ @frequency_subday_interval=] frequency_subday_interval
    Is the frequency for frequency_subday to occur between each merge.frequency_subday_interval is int, with a default of NULL.

  • [ @active_start_time_of_day=] active_start_time_of_day
    Is the time of day when the Merge Agent is first scheduled, formatted as HHMMSS.active_start_time_of_day is int, with a default of NULL.

  • [ @active_end_time_of_day=] active_end_time_of_day
    Is the time of day when the Merge Agent stops being scheduled, formatted as HHMMSS.active_end_time_of_day is int, with a default of NULL.

  • [ @active_start_date=] active_start_date
    Is the date when the Merge Agent is first scheduled, formatted as YYYYMMDD.active_start_date is int, with a default of NULL.

  • [ @active_end_date=] active_end_date
    Is the date when the Merge Agent stops being scheduled, formatted as YYYYMMDD.active_end_date is int, with a default of NULL.

  • [ @optional_command_line=] 'optional_command_line'
    Is the optional command prompt to execute.optional_command_lineis nvarchar(4000), with a default of NULL.Bu parametreyi belirtmek için ya da bir dosyaya kaydeder ve çıkış yakalayan bir komut eklemek için kullanılan bir yapılandırma dosyası veya öznitelik.

  • [ @description=] 'description'
    Is a brief description of this merge subscription.descriptionis nvarchar(255), with a default of NULL.Bu değer tarafından çoğaltma İzleyicisi'nde görüntülenen Kolay ad izlenen yayın aboneliklerinin sıralamakta kullanılan sütun.

  • [ @enabled_for_syncmgr=] 'enabled_for_syncmgr'
    Specifies if the subscription can be synchronized through Microsoft Windows Synchronization Manager.enabled_for_syncmgr is nvarchar(5), with a default of FALSE.If false, the subscription is not registered with Synchronization Manager.If true, the subscription is registered with Synchronization Manager and can be synchronized without starting Microsoft SQL Server Management Studio.

  • [ @offloadagent= ] remote_agent_activation
    Specifies that the agent can be activated remotely.remote_agent_activation is bit with a default of 0.

    Not

    Bu parametre onaylanmaz ve yalnızca komut dosyaları geriye dönük uyumluluk için korunur.

  • [ @offloadserver= ] 'remote_agent_server_name'
    Specifies the network name of server to be used for remote agent activation.remote_agent_server_nameis sysname, with a default of NULL.

  • [ @use_interactive_resolver= ] 'use_interactive_resolver'
    Allows conflicts to be resolved interactively for all articles that allow interactive resolution.use_interactive_resolver is nvarchar(5), with a default of FALSE.

  • [ @merge_job_name= ] 'merge_job_name'
    Name of the Merge Agent job that is added for this subscription.merge_job_name is sysname, with a default of NULL.Bu parametre, böylece bu işlemi daha sonra yönetilebilir sağlanacak bir Birleştirme Aracısı iş adı sağlar.

  • [ @ hostname=] 'hostname'
    Overrides the value returned by HOST_NAME when this function is used in the WHERE clause of a parameterized filter.Hostname is sysname, with a default of NULL.

    Önemli notÖnemli

    Performansı düşürmemek için işlev parametreli satır filtresi yan tümcesi, sütun adları için gibi uyguladığınız değil öneririz LEFT([MyColumn]) = SUSER_SNAME().Kullanırsanız, host_name filtre yan tümce tümce tümce ve geçersiz kılma host_name değer veri türleri kullanarak dönüştürmek gerekli olabilir DÖNÜŞTÜRMEK.Bunun için en iyi yöntemler hakkında daha fazla bilgi için durum, "host_name() değeri geçersiz kılma" bölümüne bakın konudaki Parametreli satır filtreleri.

Dönüş Kodu Değerleri

0 (başarılı) veya 1 (başarısız)

Açıklamalar

sp_addmergesubscription birleştirmede kullanılan çoğaltma.

Zaman sp_addmergesubscription üye tarafından yürütülen sysadmin sabit sunucu rolü oluşturmak için bir gönderme temelli abonelik, Birleştirme Aracısı iş örtük olarak oluşturulur ve altında çalışan SQL Server Agent hizmet hesabı.Öneririz, yürütmek sp_addmergepushsubscription_agent farklı, özel aracı Windows hesabı için kimlik bilgileri bilgilerini belirtin ve @ job_login ve @ job_password.Daha fazla bilgi için bkz: Çoğaltma aracısı güvenlik modeli.

Örnek

-- This script uses sqlcmd scripting variables. They are in the form
-- $(MyVariable). For information about how to use scripting variables  
-- on the command line and in SQL Server Management Studio, see the 
-- "Executing Replication Scripts" section in the topic
-- "Programming Replication Using System Stored Procedures".

DECLARE @publication AS sysname;
DECLARE @subscriber AS sysname;
DECLARE @subscriptionDB AS sysname;
DECLARE @hostname AS sysname;
SET @publication = N'AdvWorksSalesOrdersMerge';
SET @subscriber = $(SubServer);
SET @subscriptionDB = N'AdventureWorks2008R2Replica'; 
SET @hostname = N'adventure-works\david8'

-- Add a push subscription to a merge publication.
USE [AdventureWorks2008R2]
EXEC sp_addmergesubscription 
  @publication = @publication, 
  @subscriber = @subscriber, 
  @subscriber_db = @subscriptionDB, 
  @subscription_type = N'push',
  @hostname = @hostname;

--Add an agent job to synchronize the push subscription.
EXEC sp_addmergepushsubscription_agent 
  @publication = @publication, 
  @subscriber = @subscriber, 
  @subscriber_db = @subscriptionDB, 
  @job_login = $(Login), 
  @job_password = $(Password);
GO

İzinler

Yalnızca üyeleri sysadmin sabit sunucu rolü veya db_owner sabit veritabanı rolü olabilir yürütmek sp_addmergesubscription.