Aracılığıyla paylaş


ReplicationServer.ChangeDistributorPassword Yöntemi (String)

Dağıtıcı parolasını değiştirir.

Ad Alanı:  Microsoft.SqlServer.Replication
Derleme:  Microsoft.SqlServer.Rmo (Microsoft.SqlServer.Rmo içinde.dll)

Sözdizimi

'Bildirim
Public Sub ChangeDistributorPassword ( _
    password As String _
)
'Kullanım
Dim instance As ReplicationServer
Dim password As String

instance.ChangeDistributorPassword(password)
public void ChangeDistributorPassword(
    string password
)
public:
void ChangeDistributorPassword(
    String^ password
)
member ChangeDistributorPassword : 
        password:string -> unit 
public function ChangeDistributorPassword(
    password : String
)

Parametreler

  • password
    Tür: System.String
    Yeni parola dize için distributor_admin oturum açma.
    Güvenlik Notu mümkün olduğunda, güvenlik kimlik bilgileri girmek için komut istemi kullanıcıların çalıştırdığı saat.Kimlik bilgileri saklamanız gerekir, https://go.microsoft.com/fwlink/ kullanılsın mı?LinkId = Windows tarafından sağlanan Şifreleme Hizmetleri 34733.net Framework.

Açıklamalar

DistributorInstalled özellik olmalıdır doğru için küme bu özellik.

ChangeDistributorPassword yöntem arayan üyeleri sysadmin sabit sunucu rolü at dağıtımcı.

ChangeDistributorPassword yöntem için eşdeğer sp_changedistributor_password (Transact-sql)saklı yordam.

Bu ad, sınıf veya üye yalnızca desteklenen sürüm 2.0.net Framework.

Örnekler

          // Set the Distributor and distribution database names.
            string distributionDbName = "distribution";
            string distributorName = publisherInstance;

            ReplicationServer distributor;
            DistributionDatabase distributionDb;

            // Create a connection to the Distributor using Windows Authentication.
            ServerConnection conn = new ServerConnection(distributorName);

            try
            {
                // Open the connection. 
                conn.Connect();

                distributor = new ReplicationServer(conn);

                // Load Distributor properties, if it is installed.
                if (distributor.LoadProperties())
                {
                    // Password supplied at runtime.
                    distributor.ChangeDistributorPassword(password);
                    distributor.AgentCheckupInterval = 5;

                    // Save changes to the Distributor properties.
                    distributor.CommitPropertyChanges();
                }
                else
                {
                    throw new ApplicationException(
                        String.Format("{0} is not a Distributor.", publisherInstance));
                }

                // Create an object for the distribution database 
                // using the open Distributor connection.
                distributionDb = new DistributionDatabase(distributionDbName, conn);

                // Change distribution database properties.
                if (distributionDb.LoadProperties())
                {
                    // Change maximum retention period to 48 hours and history retention 
                    // period to 24 hours.
                    distributionDb.MaxDistributionRetention = 48;
                    distributionDb.HistoryRetention = 24;

                    // Save changes to the distribution database properties.
                    distributionDb.CommitPropertyChanges();
                }
                else
                {
                    // Do something here if the distribution database does not exist.
                }
            }
            catch (Exception ex)
            {
                // Implement the appropriate error handling here. 
                throw new ApplicationException("An error occured when changing Distributor " +
                    " or distribution database properties.", ex);
            }
            finally
            {
                conn.Disconnect();
            }