Aracılığıyla paylaş


sp_addpublication (Transact-SQL)

Anlık görüntü veya işlem oluşturur yayın.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_addpublication [ @publication = ] 'publication'
    [ , [ @taskid = ] tasked ]
    [ , [ @restricted = ] 'restricted' ]
    [ , [ @sync_method = ] 'sync_method' ]
    [ , [ @repl_freq = ] 'repl_freq' ]
    [ , [ @description = ] 'description' ]
    [ , [ @status = ] 'status' ]
    [ , [ @independent_agent = ] 'independent_agent' ]
    [ , [ @immediate_sync = ] 'immediate_sync' ]
    [ , [ @enabled_for_internet = ] 'enabled_for_internet' ]
    [ , [ @allow_push = ] 'allow_push'
    [ , [ @allow_pull = ] 'allow_pull' ]
    [ , [ @allow_anonymous = ] 'allow_anonymous' ]
    [ , [ @allow_sync_tran = ] 'allow_sync_tran' ]
    [ , [ @autogen_sync_procs = ] 'autogen_sync_procs' ]
    [ , [ @retention = ] retention ]
    [ , [ @allow_queued_tran= ] 'allow_queued_updating' ]
    [ , [ @snapshot_in_defaultfolder= ] 'snapshot_in_default_folder' ]
    [ , [ @alt_snapshot_folder= ] 'alternate_snapshot_folder' ]
    [ , [ @pre_snapshot_script= ] 'pre_snapshot_script' ]
    [ , [ @post_snapshot_script= ] 'post_snapshot_script' ]
    [ , [ @compress_snapshot= ] 'compress_snapshot' ]
    [ , [ @ftp_address = ] 'ftp_address' ]
    [ , [ @ftp_port= ] ftp_port ]
    [ , [ @ftp_subdirectory = ] 'ftp_subdirectory' ]
    [ , [ @ftp_login = ] 'ftp_login' ]
    [ , [ @ftp_password = ] 'ftp_password' ]
    [ , [ @allow_dts = ] 'allow_dts' ]
    [ , [ @allow_subscription_copy = ] 'allow_subscription_copy' ]
    [ , [ @conflict_policy = ] 'conflict_policy' ]
    [ , [ @centralized_conflicts = ] 'centralized_conflicts' ] 
    [ , [ @conflict_retention = ] conflict_retention ]
    [ , [ @queue_type = ] 'queue_type' ]
    [ , [ @add_to_active_directory = ] 'add_to_active_directory' ]
    [ , [ @logreader_job_name = ] 'logreader_agent_name' ]
    [ , [ @qreader_job_name = ] 'queue_reader_agent_name' ]
    [ , [ @publisher = ] 'publisher' ] 
    [ , [ @allow_initialize_from_backup = ] 'allow_initialize_from_backup' ]
    [ , [ @replicate_ddl = ] replicate_ddl ]
    [ , [ @enabled_for_p2p = ] 'enabled_for_p2p' ]
    [ , [ @publish_local_changes_only = ] 'publish_local_changes_only' ]
    [ , [ @enabled_for_het_sub = ] 'enabled_for_het_sub' ]
    [ , [ @p2p_conflictdetection = ] 'p2p_conflictdetection' ]
    [ , [ @p2p_originator_id = ] p2p_originator_id
    [ , [ @p2p_continue_onconflict = ] 'p2p_continue_onconflict'
    [ , [ @allow_partition_switch = ] 'allow_partition_switch'
    [ , [ @replicate_partition_switch = ]'replicate_partition_switch'

Bağımsız değişkenler

  • [ @publication=] 'publication'
    Is the name of the publication to create.publication is sysname, with no default.Adı veritabanı içinde benzersiz olmalıdır.

  • [ @taskid=] taskid
    Yalnızca geriye dönük uyumluluk için desteklenir; use sp_addpublication_snapshot (Transact-SQL).

  • [ @restricted=] 'restricted'
    Yalnızca geriye dönük uyumluluk için desteklenir; use default_access.

  • [ @sync_method=] 'sync_method**'**
    Is the synchronization mode.sync_method is nvarchar(13), and can be one of the following values.

    Değer

    Açıklama

    doğal

    Yerel mod toplu kopyalama program çıktı tüm tabloları oluşturur.Oracle yayımcılar için desteklenen değil.

    karakter

    Karakter modu toplu kopyalama program çıktı tüm tabloları oluşturur.Bir Oracle Yayımcı için karakter yalnızca anlık görüntü çoğaltması çoğaltması çoğaltma için geçerli olan.

    eş zamanlı

    Yerel mod toplu kopyalama program çıktı tüm tabloları oluşturur ancak yok kilit anlık görüntü sırasında tablolar.Yalnızca işlem yayınlar için desteklenir.Oracle yayımcılar için desteklenen değil.

    concurrent_c

    Karakter modu toplu kopyalama program çıktı tüm tabloları oluşturur ancak yok kilit anlık görüntü sırasında tablolar.Yalnızca işlem yayınlar için desteklenir.

    veritabanı anlık görüntü görüntüsü görüntüsü

    Yerel mod toplu kopyalama program tüm tabloları veritabanı anlık görüntü görüntüsü görüntüsü çıkışını üretir.Bu seçenek gerektirir SQL Server kuruluş.

    veritabanı anlık görüntü görüntüsü karakter

    Tüm tabloları veritabanı anlık görüntü görüntüsü karakter modu toplu kopyalama program çıktısını üretir.Bu seçenek gerektirir SQL Server kuruluş.

    Null(default)

    Defaults to native for Microsoft SQL Server Publishers.İçin olmayan-SQL Server Yayımcılar, varsayılan olarak karakter zaman değerini repl_freq olan anlık görüntü ve concurrent_c diğer durumlarda.

  • [ @repl_freq=] 'repl_freq'
    Çoğaltma sıklığı türü repl_freq olan nvarchar(10), aşağıdaki değerler. olabilir ve

    Değer

    Açıklama

    sürekli (varsayılan)

    Yayımcı tüm günlük tabanlı işlemler çıktı sağlar.İçin olmayan-SQL Server Publishers, bu gerektirir, sync_method olması küme için concurrent_c.

    anlık görüntü

    Yayımcı yalnızca zamanlanmış eşitleme olayları oluşturur.İçin olmayan-SQL Server Publishers, bu gerektirir, sync_method olması küme için karakter.

  • [ @description=] 'description'
    Is an optional description for the publication.description is nvarchar(255), with a default of NULL.

  • [ @status=] 'status'
    Specifies if publication data is available.status is nvarchar(8), and can be one of the following values.

    Değer

    Açıklama

    Etkin

    Yayının veri aboneleri için hemen kullanılabilir.

    Etkin olmayan (varsayılan)

    Yayının veri aboneleri için mevcut değil yayın oluşturulduğunda (abone olmak olmak olabilirsiniz, ancak abonelikleri işlenmez).

    Oracle yayımcılar için desteklenen değil.

  • [ @independent_agent=] 'independent_agent'
    Specifies if there is a stand-alone Distribution Agent for this publication.independent_agent is nvarchar(5), with a default of FALSE.If true, there is a stand-alone Distribution Agent for this publication.If false, the publication uses a shared Distribution Agent, and each Publisher database/Subscriber database pair has a single, shared Agent.

  • [ @immediate_sync=] 'immediate_synchronization'
    Specifies if the synchronization files for the publication are created each time the Snapshot Agent runs.immediate_synchronization is nvarchar(5), with a default of FALSE.If true, the synchronization files are created or re-created each time the Snapshot Agent runs.Abonelerine anlık görüntü Aracısı abonelik oluşturmadan önce tamamlanmışsa eşitleme dosyaları hemen elde edebilirsiniz.New subscriptions get the newest synchronization files generated by the most recent execution of the Snapshot Agent.independent_agent must be true for immediate_synchronization to be true.If false, the synchronization files are created only if there are new subscriptions.Çağırması gerekir sp_addsubscription , yeni bir makale varolan ekleyebilme her abonelik için yayın.Anlık Görüntü Aracısı başlatıldı ve tamamlanan kadar aboneler sonra abonelik eşitleme dosyaları alamaz.

  • [ @enabled_for_internet=] 'enabled_for_internet'
    Specifies if the publication is enabled for the Internet, and determines if file transfer protocol (FTP) can be used to transfer the snapshot files to a subscriber.enabled_for_internet is nvarchar(5), with a default of FALSE.If true, the synchronization files for the publication are put into the C:\Program Files\Microsoft SQL Server\MSSQL\MSSQL.x\Repldata\Ftp directory.Kullanıcı Ftp dizini oluşturmanız gerekir.

  • [ @allow_push=] 'allow_push'
    Specifies if push subscriptions can be created for the given publication.allow_push is nvarchar(5), with a default of TRUE, which allows push subscriptions on the publication.

  • [ @allow_pull=] 'allow_pull'
    Specifies if pull subscriptions can be created for the given publication.allow_pull is nvarchar(5), with a default of FALSE.If false, pull subscriptions are not allowed on the publication.

  • [ @allow_anonymous=] 'allow_anonymous'
    Specifies if anonymous subscriptions can be created for the given publication.allow_anonymous is nvarchar(5), with a default of FALSE.If true, immediate_synchronization must also be küme to true.If false, anonymous subscriptions are not allowed on the publication.

  • [ @allow_sync_tran=] 'allow_sync_tran'
    Specifies if immediate-updating subscriptions are allowed on the publication.allow_sync_tran is nvarchar(5), with a default of FALSE.true is Not supported for Oracle Publishers.

  • [ @autogen_sync_procs=] 'autogen_sync_procs'
    Specifies if the synchronizing stored procedure for updating subscriptions is generated at the Publisher.autogen_sync_procs is nvarchar(5), and can be one of the following values.

    Değer

    Açıklama

    TRUE

    Abonelikleri güncelleştirme etkinleştirildiğinde otomatik olarak ayarlayın.

    yanlış

    Abonelikleri güncelleştirme etkin olduğunda veya Oracle yayımcılar için otomatik olarak ayarlayın.

    Null(default)

    Varsayılan olarak doğru abonelikleri güncelleştirme etkinleştirildiğinde için ve yanlış ne zaman abonelikleri güncelleştirme etkin değildir.

    Not

    The user supplied value for autogen_sync_procswill be overridden depending on the values specified for allow_queued_tran and allow_sync_tran.

  • [ @retention=] retention
    Is the retention period in hours for subscription activity.retention is int, with a default of 336 hours.Bir abonelik saklama dönemi içinde etkin değilse, zaman aşımına uğrar ve kaldırılır.Bu değer en fazla saklama dönemi büyük olabilir dağıtım veritabanı yayımcı tarafından kullanılan.If 0, well-known subscriptions to the publication will never expire and be removed by the Expired Subscription Cleanup Agent.

  • [ @allow_queued_tran= ] 'allow_queued_updating'
    Enables or disables queuing of changes at the Subscriber until they can be applied at the Publisher.allow_queued_updating is nvarchar(5) with a default of FALSE.If false, changes at the Subscriber are not queued.true is Not supported for Oracle Publishers.

  • [ @snapshot_in_defaultfolder= ] 'snapshot_in_default_folder'
    Specifies if snapshot files are stored in the default folder.snapshot_in_default_folder is nvarchar(5) with a default of TRUE.If true, snapshot files can be found in the default folder.If false, snapshot files have been stored in the alternate location specified by alternate_snapshot_folder.Farklı yerler, başka bir sunucu, bir ağ sürücüsüne veya çıkarılabilir medya (örneğin, cd-rom veya Kaldırılabilir disk) olabilir.Ayrıca anlık görüntü dosyaları, bir sonraki adresindeki abone tarafından ulaşım için bir ftp sitesine kaydedebilirsiniz saat.Not Bu parametre true ve hala bir konuma sahip @ alt_snapshot_folder parametresi.Bu bileşim, anlık görüntü dosyaları hem varsayılan hem de diğer konumlarda depolanan olduğunu belirtir.

  • [ @alt_snapshot_folder= ] 'alternate_snapshot_folder'
    Specifies the location of the alternate folder for the snapshot.alternate_snapshot_folder is nvarchar(255) with a default of NULL.

  • [ @pre_snapshot_script= ] 'pre_snapshot_script'
    Specifies a pointer to an .sql file location.pre_snapshot_script is nvarchar(255),with a default of NULL.Herhangi bir çoğaltılan nesne komut dosyası anlık görüntü bir abone adresindeki uygularken çalıştırmadan önce Dağıtım Aracısı pre-anlık görüntü görüntü komut dosyasını çalıştırın.Bağlanırken Dağıtım Aracısı tarafından kullanılan güvenlik bağlamında komut dosyası yürütülür abonelik veritabanı.

  • [ @post_snapshot_script= ] 'post_snapshot_script'
    Specifies a pointer to an .sql file location.post_snapshot_script is nvarchar(255), with a default of NULL.Bir ilk eşitleme sırasında diğer tüm çoğaltılan nesne komut dosyaları ve verileri uygulandıktan sonra Dağıtım Aracısı post-anlık görüntü görüntü komut dosyası çalıştırılır.Bağlanırken Dağıtım Aracısı tarafından kullanılan güvenlik bağlamında komut dosyası yürütülür abonelik veritabanı.

  • [ @compress_snapshot= ] 'compress_snapshot'
    Specifies that the snapshot that is written to the @alt_snapshot_folder location is to be compressed into the Microsoft CAB format.compress_snapshot is nvarchar(5), with a default of FALSE.false specifies that the snapshot will not be compressed; true specifies that the snapshot will be compressed.Anlık görüntü dosyaları 2 gigabayttan (gb) daha büyük olan sıkıştırılamaz.Sıkıştırılmış anlık görüntü dosyaları Distribution Agent'in nerede konumda sıkıştırılmamış durumdadır; dosyalar sıkıştırılmamış Abone tarafında olan çekme abonelikleri ile sıkıştırılmış anlık kullanılır.Anlık görüntü varsayılan klasör içinde sıkıştırılamaz.

  • [ @ftp_address = ] 'ftp_address'
    Is the network address of the FTP service for the Distributor.ftp_address is sysname, with a default of NULL.yayın anlık görüntü dosyaları için dağıtım aracısını veya Birleştirme Aracısı abone çekmek için yerleştirildiği belirtir.Bu özellik her yayın için depolanan bu yana her yayında farklı bir sahip olabilir ftp_address.yayın ftp kullanarak yayılıyor anlık görüntüler desteklemesi gerekir.

  • [ @ftp_port= ] ftp_port
    Is the port number of the FTP service for the Distributor.ftp_port is int, with a default of 21.yayın anlık görüntü dosyaları için dağıtım aracısını veya Birleştirme Aracısı abone çekmek için yerleştirildiği belirtir.Bu özellik her yayın için depolanan bu yana, her birinin kendi olabilir ftp_port.

  • [ @ftp_subdirectory = ] 'ftp_subdirectory'
    Specifies where the snapshot files will be available for the Distribution Agent or Merge Agent of subscriber to pick up if the publication supports propagating snapshots using FTP.ftp_subdirectory is nvarchar(255), with a default of NULL.Bu özellik her yayın için depolanan bu yana, her birinin kendi olabilir ftp_subdirctory veya sahip hiçbir alt, belirtilen bir null değeri.

  • [ @ftp_login = ] 'ftp_login'
    Is the username used to connect to the FTP service.ftp_login is sysname, with a default of ANONYMOUS.

  • [ @ftp_password = ] 'ftp_password'
    Is the user password used to connect to the FTP service.ftp_password is sysname, with a default of NULL.

  • [ @allow_dts = ] 'allow_dts'
    Belirleyen yayın veri dönüşümleri izin verir.You can specify a DTS package when creating a subscription.allow_transformable_subscriptions is nvarchar(5) with a default of FALSE, which does not allow DTS transformations.Zaman allow_dts doğruysa, sync_method olması küme için ya da character veya concurrent_c.

    doğru olan desteklenmeyen Oracle yayımcılar için.

  • [ @allow_subscription_copy = ] 'allow_subscription_copy'
    Enables or disables the ability to copy the subscription databases that subscribe to this publication.allow_subscription_copy isnvarchar(5), with a default of FALSE.

  • [ @conflict_policy = ] 'conflict_policy'
    Specifies the conflict resolution policy followed when the queued updating subscriber option is used.conflict_policy is nvarchar(100) with a default of NULL, and can be one of the following values.

    Değer

    Açıklama

    pub WINS

    Yayımcı, çakışmayı kazanır.

    yeniden başlatmayı sub

    Yeniden abonelik.

    Sub WINS

    Abone çakışmayı kazanır.

    Null(default)

    null ve yayın anlık görüntü yayın ise, varsayılan ilke haline sub yeniden başlatmayı.Varsayılan değer null ve yayın ise bir anlık görüntü yayın, olur pub WINS.

    Oracle yayımcılar için desteklenen değil.

  • [ @centralized_conflicts = ] 'centralized_conflicts'
    Specifies if conflict records are stored on the Publisher.centralized_conflicts is nvarchar(5), with a default of TRUE.If true, conflict records are stored at the Publisher.If false, conflict records are stored at both the publisher and at the subscriber that caused the conflict.Oracle yayımcılar için desteklenen değil.

  • [ @conflict_retention = ] conflict_retention
    Çakışma saklama dönemi gün içinde belirtir.This is the period of time that conflict metadata is stored for peer-to-peer transactional replication and queued updating subscriptions.conflict_retention is int, with a default of 14.Oracle yayımcılar için desteklenen değil.

  • [ @queue_type = ] 'queue_type'
    Specifies which type of queue is used.queue_type is nvarchar(10), with a default of NULL, and can be one of these values.

    Değer

    Açıklama

    SQL

    Use SQL Server saklamak hareketleri.

    Null(default)

    Varsayılan olarak sql, kullanılacağını belirten SQL Server saklamak hareketleri.

    Not

    Kullanma desteği Microsoft Message Queuing ermiştir.Değeri belirterek msmq uyarı olarak neden olur ve çoğaltma otomatik olarak küme değer sql.

    Oracle yayımcılar için desteklenen değil.

  • [ @add_to_active_directory = ] 'add_to_active_directory'
    Bu parametre onaylanmaz ve yalnızca komut dosyaları geriye dönük uyumluluk için desteklenir.Artık yayın bilgileri ekleme Microsoft Active Directory.

  • [ @logreader_job_name = ] 'logreader_agent_name'
    Is the name of an existing agent job.logreader_agent_name is sysname, with a default value of NULL.Günlük Okuyucu Aracısı var olan iş bir bir yeni oluşturulan yerine olarak kullandığınızda, bu parametreyi yalnızca belirtildi.

  • [ @qreader_job_name = ] 'queue_reader_agent_name'
    Is the name of an existing agent job.queue_reader_agent_name is sysname, with a default value of NULL.Queue Reader Agent var olan iş bir bir yeni oluşturulan yerine olarak kullandığınızda, bu parametreyi yalnızca belirtildi.

  • [ @publisher = ] 'publisher'
    Specifies a non-SQL Server publisher.publisher is sysname, with a default of NULL.

    Not

    Yayımcı eklerken kullanılmamalıdır bir yayın için bir SQL Server Yayımcı.

  • [ @allow_initialize_from_backup = ] 'allow_initialize_from_backup'
    Indicates if Subscribers can initialize a subscription to this publication from a backup rather than an initial snapshot.allow_initialize_from_backup is nvarchar(5), and can be one of these values:

    Değer

    Açıklama

    TRUE

    Bir yedek başlatma etkinleştirir.

    yanlış

    Bir yedek başlatma devre dışı bırakır.

    Null(default)

    Varsayılan olarak doğru için bir yayın bir eşler arası çoğaltma topolojisi içinde ve yanlış tüm diğer yayıns.

    Daha fazla bilgi için bkz: Bir anlık görüntü olmadan bir işlemsel abonelik başlatılıyor.

  • [ @replicate_ddl = ] replicate_ddl
    Indicates if schema replication is supported for the publication.replicate_ddl is int, with a default of 1 for SQL Server Publishers and 0 for non-SQL Server Publishers.1 belirten veri tanımlama dili (ddl) deyimleri Yayımcı tarafında yürütülen yinelenir ve 0 ddl deyimleri değil çoğaltılır gösterir.*Şema çoğaltma Oracle yayımcılar için desteklenmiyor.*Daha fazla bilgi için bkz: Yayını veritabanları üzerinde şeması değişiklikler yapma.

  • [ @enabled_for_p2p = ] 'enabled_for_p2p'
    Enables the publication to be used in a peer-to-peer replication topology.enabled_for_p2p is nvarchar(5), with a default of FALSE.true indicates that the publication supports peer-to-peer replication.Ayarlarken enabled_for_p2p için doğru, aşağıdaki kısıtlamalar geçerlidir:

    • allow_anonymousolması gereken yanlış.

    • allow_dtsolması gereken yanlış.

    • allow_initialize_from_backupolması gereken doğru.

    • allow_queued_tranolması gereken yanlış.

    • allow_sync_tranolması gereken yanlış.

    • conflict_policyolması gereken yanlış.

    • independent_agentolması gereken doğru.

    • repl_freqolması gereken sürekli.

    • replicate_ddlmust be 1.

    Daha fazla bilgi için bkz: Eşler arası işlem çoğaltma.

  • [ @publish_local_changes_only = ] 'publish_local_changes_only'
    Yalnızca bilgi amaçlı olarak belirtilmiştir. Desteklenmez. Gelecekteki uyumluluk garanti edilmez.

  • [ @enabled_for_het_sub= ] 'enabled_for_het_sub'
    Enables the publication to support non-SQL Server Subscribers.enabled_for_het_sub is nvarchar(5) with a default value of FALSE.Değeri, true yayın olmayan desteklediği anlamına gelir-SQL Server aboneleri.Zaman enabled_for_het_sub olan true, aşağıdaki kısıtlamalar geçerlidir:

    • allow_initialize_from_backupmust be false.

    • allow_pushmust be true.

    • allow_queued_tranmust be false.

    • allow_subscription_copymust be false.

    • allow_sync_tranmust be false.

    • autogen_sync_procsmust be false.

    • conflict_policy null olmalıdır.

    • enabled_for_internetmust be false.

    • enabled_for_p2pmust be false.

    • ftp_address null olmalıdır.

    • ftp_subdirectory null olmalıdır.

    • ftp_password null olmalıdır.

    • pre_snapshot_script null olmalıdır.

    • post_snapshot_script null olmalıdır.

    • replicate_ddl 0 olmalıdır.

    • qreader_job_name null olmalıdır.

    • queue_type null olmalıdır.

    • sync_methodcannot be native or concurrent.

    Daha fazla bilgi için bkz: Olmayan-sql Server aboneleri.

  • [ @p2p_conflictdetection= ] 'p2p_conflictdetection'
    Enables the Distribution Agent to detect conflicts if the publication is enabled for peer-to-peer replication.p2p_conflictdetection is nvarchar(5) with a default value of TRUE.Daha fazla bilgi için bkz: Eşler arası çoğaltma çakışma algılama.

  • [ @p2p_originator_id= ] p2p_originator_id
    Specifies an ID for a node in a peer-to-peer topology.p2p_originator_id is int, with a default of NULL.Bu kimlik için çakışma algılama kullanılır p2p_conflictdetection olan küme için true.Topolojisinde hiç kullanılmamış bir pozitif, sıfır olmayan kimliği belirtin.Zaten kullanılan kimliklerinin listesi için yürütmek sp_help_peerconflictdetection.

  • [ @p2p_continue_onconflict= ] 'p2p_continue_onconflict'
    Determines whether the Distribution Agent continues to process changes after a conflict is detected.p2p_continue_onconflict is nvarchar(5) with a default value of FALSE.

    Dikkat notuDikkat

    Varsayılan değer False kullanmanızı öneririz.Bu seçeneği olduğunda küme true, en yüksek gönderen kimliği olan düğümden çakışan satır uygulayarak topolojiyi veriler yakınsama için Dağıtım Aracısı çalışırBu yöntem yakınsama garanti etmez.Bir çakışma algılandığında sonra topoloji tutarlı olduğundan emin olun.Daha fazla bilgi için "Çakışmalarını işleme" konusuna bakın. in Eşler arası çoğaltma çakışma algılama.

  • [ @allow_partition_switch= ] 'allow_partition_switch'
    Specifies whether ALTER TABLE…SWITCH statements can be executed against the published database.allow_partition_switch is nvarchar(5) with a default value of FALSE.Daha fazla bilgi için bkz: Bölümlenmiş tablolar ve dizinler çoğaltılıyor.

  • [ @replicate_partition_switch= ] 'replicate_partition_switch'
    Specifies whether ALTER TABLE…SWITCH statements that are executed against the published database should be replicated to Subscribers.replicate_partition_switch is nvarchar(5) with a default value of FALSE.Bu seçenek geçerlidir yalnızca allow_partition_switch olan küme için true.

Dönüş Kodu Değerleri

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

Açıklamalar

sp_addpublication anlık görüntü çoğaltması çoğaltması çoğaltma ve işlem çoğaltma kullanılır.

Kendi, birden çok yayınları varsa aynı veritabanı nesnesi, yalnızca yayınları ile yayınlama bir replicate_ddl değeri 1 alter table, alter VIEW, alter procedure, alter işlevi ve alter tetikleyici ddl deyimleri çoğaltılır.Ancak, bir tablo drop sütun ddl alter deyim bırakılan sütun yayımlamakta olduğunuz tüm yayınları tarafından çoğaltılır.

Etkin ddl çoğaltma ile (replicate_ddl = 1) bir yayın olmayan çoğaltılıyor-ddl yapmak için değiştirir yayına sp_changepublication için önce yürütülmelidir küme replicate_ddl için 0.Çoğaltılıyor ddl deyimleri verildikten sonra sp_changepublication ddl çoğaltma yeniden açmak için yeniden çalıştırılabilir.

Örnek

-- To avoid storing the login and password in the script file, the values 
-- are passed into SQLCMD as scripting variables. 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 @publicationDB AS sysname;
DECLARE @publication AS sysname;
DECLARE @login AS sysname;
DECLARE @password AS sysname;
SET @publicationDB = N'AdventureWorks2008R2'; 
SET @publication = N'AdvWorksProductTran'; 
-- Windows account used to run the Log Reader and Snapshot Agents.
SET @login = $(Login); 
-- This should be passed at runtime.
SET @password = $(Password); 

-- Enable transactional or snapshot replication on the publication database.
EXEC sp_replicationdboption 
    @dbname=@publicationDB, 
    @optname=N'publish',
    @value = N'true';

-- Execute sp_addlogreader_agent to create the agent job. 
EXEC sp_addlogreader_agent 
    @job_login = @login, 
    @job_password = @password,
    -- Explicitly specify the use of Windows Integrated Authentication (default) 
    -- when connecting to the Publisher.
    @publisher_security_mode = 1;

-- Create a new transactional publication with the required properties. 
EXEC sp_addpublication 
    @publication = @publication, 
    @status = N'active',
    @allow_push = N'true',
    @allow_pull = N'true',
    @independent_agent = N'true';

-- Create a new snapshot job for the publication, using a default schedule.
EXEC sp_addpublication_snapshot 
    @publication = @publication, 
    @job_login = @login, 
    @job_password = @password,
    -- Explicitly specify the use of Windows Integrated Authentication (default) 
    -- when connecting to the Publisher.
    @publisher_security_mode = 1;
GO

İzinler

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