ReplicationServer.ChangeDistributorPassword 메서드

정의

배포자 암호를 변경합니다.

오버로드

ChangeDistributorPassword(SecureString)

새 암호가 SecureString 개체로 제공되는 경우 배포자 암호를 변경합니다.

ChangeDistributorPassword(String)

배포자 암호를 변경합니다.

ChangeDistributorPassword(SecureString)

새 암호가 SecureString 개체로 제공되는 경우 배포자 암호를 변경합니다.

public:
 void ChangeDistributorPassword(System::Security::SecureString ^ password);
public void ChangeDistributorPassword (System.Security.SecureString password);
member this.ChangeDistributorPassword : System.Security.SecureString -> unit
Public Sub ChangeDistributorPassword (password As SecureString)

매개 변수

password
SecureString

새 배포자 암호는 SecureString 값입니다.

보안 참고 가능하면 사용자에게 런타임에 보안 자격 증명을 입력하라는 메시지를 표시합니다. 자격 증명을 저장해야 하는 경우 Windows .NET Framework 제공하는 암호화 서비스를 사용합니다http://go.microsoft.com/fwlink/?LinkId=34733.

설명

DistributorInstalled 속성을 설정하려면 속성이어야 true 합니다.

메서드는 ChangeDistributorPassword(SecureString) 메모리에 저장되는 동안 암호에 대한 추가 보안을 제공하며 대신 ChangeDistributorPassword(String)를 사용해야 합니다.

ChangeDistributorPassword 배포자에서 sysadmin 고정 서버 역할의 멤버가 메서드를 호출할 수 있습니다.

메서드는 ChangeDistributorPasswordsp_changedistributor_password(Transact-SQL) 저장 프로시저와 동일합니다.

적용 대상

ChangeDistributorPassword(String)

배포자 암호를 변경합니다.

public:
 void ChangeDistributorPassword(System::String ^ password);
public void ChangeDistributorPassword (string password);
member this.ChangeDistributorPassword : string -> unit
Public Sub ChangeDistributorPassword (password As String)

매개 변수

password
String

distributor_admin 로그인을 위한 새 암호 문자열입니다.

보안 참고 가능하면 사용자에게 런타임에 보안 자격 증명을 입력하라는 메시지를 표시합니다. 자격 증명을 저장해야 하는 경우 Windows .NET Framework 제공하는 암호화 서비스를 사용합니다http://go.microsoft.com/fwlink/?LinkId=34733.

예제

// 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();
}

설명

DistributorInstalled 속성을 설정하려면 속성이어야 true 합니다.

ChangeDistributorPassword 배포자에서 sysadmin 고정 서버 역할의 멤버가 메서드를 호출할 수 있습니다.

메서드는 ChangeDistributorPasswordsp_changedistributor_password(Transact-SQL) 저장 프로시저와 동일합니다.

추가 정보

적용 대상