Share via


Itme abonelik silme

Bu konuda bir itme Abonelik silmek açıklar SQL Server 2012kullanarak SQL Server Management Studio, Transact-SQL, ya da Çoğaltma Yönetimi Nesneleri'ni (rmo).

Bu Konuda

  • Bir itme Abonelik silmek için kullanma:

    SQL Server Management Studio

    Transact-SQL

    Çoğaltma Yönetimi Nesneleri'ni (rmo)

SQL Server Management Studio Kullanarak

Yayımcı itme Abonelik silmek (dan Yerel yayınları klasöründe SQL Server Management Studio) veya abone (dan Yerel Abonelikleri klasörü). Bir abonelik silme nesnelerini veya veri abonelik kaldırmaz; onlar el ile kaldırılması gerekir.

Yayımcı itme Abonelik silmek için

  1. Yayımcı bağlanmak SQL Server Management Studiove sonra sunucu düğümünü genişletin.

  2. Genişletme çoğaltma klasörünü ve ardından Yerel yayınları klasörü.

  3. Silmek istediğiniz abonelik ile ilişkilendirilmiş yayın genişletin.

  4. Abonelik sağ tıklatın ve ardından silmek.

  5. Onay iletişim kutusunda abonelik bilgilerini silmek için abone bağlanmak seçin. Temizlerseniz abone bağlanma onay kutusu, daha sonra bilgileri silmek için abone bağlanmak.

İtme abonelik abone adresindeki silmek için

  1. Abone bağlanmak SQL Server Management Studiove sonra sunucu düğümünü genişletin.

  2. Genişletme çoğaltma klasörünü ve ardından Yerel Abonelikleri klasörü.

  3. Silin ve ardından istediğiniz abonelik sağ silmek.

  4. Onay iletişim kutusunda abonelik bilgilerini silmek için yayımcı bağlanmak seçin. Temizlerseniz Publisher bağlanma onay kutusunu sonra bilgileri silmek için yayımcı bağlanmak.

Başa Dön bağlantısıyla kullanılan ok simgesi[Top]

Transact-SQL'i Kullanma

Itme abonelikleri çoğaltma depolanmış yordamları kullanarak programsal silinebilir. Kullanılan saklı yordamlar abonelik ait olduğu yayın türüne bağlıdır.

Anlık görüntü veya işlem yayın için itme Abonelik silmek için

  1. Yayını veritabanı üzerinde Yayımcı tarafında idam sp_dropsubscription (Transact-sql). Belirtmek @ yayın ve @ abone. Değeri belirtmeniz tüm için @ makale. (İsteğe bağlı) Dağıtımcı erişilemiyorsa, değeri belirtmeniz 1 için @ ignore_distributor abonelik dağıtımcı ilişkili nesneleri kaldırmadan silmek için.

  2. Abone veritabanı Abone tarafında idam sp_subscription_cleanup (Transact-sql)abonelik veritabanı çoğaltma meta verileri kaldırmak için.

Bir birleştirme yayını itme Abonelik silmek için

  1. Yayımcı tarafında idam sp_dropmergesubscription (Transact-sql), belirtme @ yayın, @ abone ve @ subscriber_db. (İsteğe bağlı) Dağıtımcı erişilemiyorsa, değeri belirtmeniz 1 için @ ignore_distributor abonelik dağıtımcı ilişkili nesneleri kaldırmadan silmek için.

  2. Abone veritabanı Abone tarafında idam sp_mergesubscription_cleanup (Transact-sql). Belirtmek @ publisher, @ publisher_db, ve @ yayın. Bu birleştirme meta verileri abonelik veritabanından kaldırır.

Örnekler (Transact-SQL)

Bu örnek işlem yayınına itme aboneliği siler.

-- 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".

-- This batch is executed at the Publisher to remove 
-- a pull or push subscription to a transactional publication.
DECLARE @publication AS sysname;
DECLARE @subscriber AS sysname;
SET @publication = N'AdvWorksProductTran';
SET @subscriber = $(SubServer);

USE [AdventureWorks2012]
EXEC sp_dropsubscription 
  @publication = @publication, 
  @article = N'all',
  @subscriber = @subscriber;
GO

Bu örnek, bir itme abonelik birleştirme yayınına siler.

-- 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".

-- This batch is executed at the Publisher to remove 
-- a pull or push subscription to a merge publication.
DECLARE @publication AS sysname;
DECLARE @subscriber AS sysname;
DECLARE @subscriptionDB AS sysname;
SET @publication = N'AdvWorksSalesOrdersMerge';
SET @subscriber = $(SubServer);
SET @subscriptionDB = N'AdventureWorks2012Replica';

USE [AdventureWorks2012]
EXEC sp_dropmergesubscription 
  @publication = @publication, 
  @subscriber = @subscriber, 
  @subscriber_db = @subscriptionDB;
GO

Başa Dön bağlantısıyla kullanılan ok simgesi[Top]

Çoğaltma Yönetimi Nesneleri'ni (rmo) kullanarak

İtme Abonelik silmek için kullanılan rmo sınıflar için itme abonelik abone yayın türüne bağlıdır.

Anlık görüntü veya işlem yayın için itme Abonelik silmek için

  1. Abone bir bağlantı kullanarak oluşturmak ServerConnectionsınıf

  2. Örneğini TransSubscriptionsınıf

  3. Set the PublicationName, SubscriptionDBName, SubscriberName, and DatabaseName properties.

  4. Set ServerConnectionadım için 1'den ConnectionContextözellik.

  5. Kontrol IsExistingObjectözelliği abonelik bulunduğunu doğrulamaktır. Bu özelliğin değeri ise false, adım 2 Abonelik özellikleri yanlış tanımlanan ya da abonelik yok.

  6. Arama Removeyöntemi.

Bir birleştirme yayını itme Abonelik silmek için

  1. Abone bir bağlantı kullanarak oluşturmak ServerConnectionsınıf

  2. Örneğini MergeSubscriptionsınıf

  3. Set the PublicationName, SubscriptionDBName, SubscriberName, and DatabaseName properties.

  4. Set ServerConnectionadım için 1'den ConnectionContextözellik.

  5. Kontrol IsExistingObjectözelliği abonelik bulunduğunu doğrulamaktır. Bu özelliğin değeri ise false, adım 2 Abonelik özellikleri yanlış tanımlanan ya da abonelik yok.

  6. Arama Removeyöntemi.

Örnekler (rmo)

Çoğaltma Yönetimi Nesneleri'ni (rmo) kullanarak program aracılığıyla itme abonelikleri silebilirsiniz.

            // Define the Publisher, publication, and databases.
            string publicationName = "AdvWorksProductTran";
            string publisherName = publisherInstance;
            string subscriberName = subscriberInstance;
            string subscriptionDbName = "AdventureWorks2012Replica";
            string publicationDbName = "AdventureWorks2012";

            //Create a connection to the Publisher.
            ServerConnection conn = new ServerConnection(publisherName);

            // Create the objects that we need.
            TransSubscription subscription;

            try
            {
                // Connect to the Subscriber.
                conn.Connect();

                // Define the pull subscription.
                subscription = new TransSubscription();
                subscription.ConnectionContext = conn;
                subscription.SubscriberName = subscriberName;
                subscription.PublicationName = publicationName;
                subscription.SubscriptionDBName = subscriptionDbName;
                subscription.DatabaseName = publicationDbName;

                // Delete the pull subscription, if it exists.
                if (subscription.IsExistingObject)
                {
                    // Delete the pull subscription at the Subscriber.
                    subscription.Remove();
                }
                else
                {
                    throw new ApplicationException(String.Format(
                        "The subscription to {0} does not exist on {1}",
                        publicationName, subscriberName));
                }
            }
            catch (Exception ex)
            {
                // Implement the appropriate error handling here.
                throw new ApplicationException(String.Format(
                    "The subscription to {0} could not be deleted.", publicationName), ex);
            }
            finally
            {
                conn.Disconnect();
            }
' Define the Publisher, publication, and databases.
Dim publicationName As String = "AdvWorksProductTran"
Dim publisherName As String = publisherInstance
Dim subscriberName As String = subscriberInstance
Dim subscriptionDbName As String = "AdventureWorks2012Replica"
Dim publicationDbName As String = "AdventureWorks2012"

'Create a connection to the Publisher.
Dim conn As ServerConnection = New ServerConnection(publisherName)

' Create the objects that we need.
Dim subscription As TransSubscription

Try
    ' Connect to the Subscriber.
    conn.Connect()

    ' Define the pull subscription.
    subscription = New TransSubscription()
    subscription.ConnectionContext = conn
    subscription.SubscriberName = subscriberName
    subscription.PublicationName = publicationName
    subscription.SubscriptionDBName = subscriptionDbName
    subscription.DatabaseName = publicationDbName

    ' Delete the pull subscription, if it exists.
    If subscription.IsExistingObject Then

        ' Delete the pull subscription at the Subscriber.
        subscription.Remove()
    Else
        Throw New ApplicationException(String.Format( _
         "The subscription to {0} does not exist on {1}", _
         publicationName, subscriberName))
    End If
Catch ex As Exception
    ' Implement the appropriate error handling here.
    Throw New ApplicationException(String.Format( _
        "The subscription to {0} could not be deleted.", publicationName), ex)
Finally
    conn.Disconnect()
End Try

Başa Dön bağlantısıyla kullanılan ok simgesi[Top]

Ayrıca bkz.

Kavramlar

Yayınlara abone

ModeliveÇoğaltma güvenlik en iyi uygulamalar