게시자 및 배포자 속성 보기 및 수정

이 항목에서는 SQL Server Management Studio, Transact-SQL 또는 RMO(복제 관리 개체)를 사용하여 SQL Server 2012에서 배포자 및 게시자 속성을 보고 수정하는 방법에 대해 설명합니다.

항목 내용

  • 시작하기 전에:

    권장 사항

    보안

  • 다음을 사용하여 배포자 및 게시자 속성을 보고 수정하려면

    SQL Server Management Studio

    Transact-SQL

    RMO(복제 관리 개체)

시작하기 전에

권장 사항

  • Microsoft SQL Server 2005 이전 버전을 실행하는 게시자의 경우 sysadmin 고정 서버 역할의 사용자는 구독자 페이지에서 구독자를 등록할 수 있습니다. SQL Server 2005부터는 더 이상 복제에 대해 구독자를 명시적으로 등록하지 않아도 됩니다.

보안

가능한 경우 런타임 시 사용자에게 보안 자격 증명을 입력하라는 메시지가 표시됩니다.

맨 위로 이동 링크와 함께 사용되는 화살표 아이콘[Top]

SQL Server Management Studio 사용

배포자 속성을 보고 수정하려면

  1. SQL Server Management Studio에서 배포자에 연결한 다음 해당 서버 노드를 확장합니다.

  2. 복제 폴더를 마우스 오른쪽 단추로 클릭한 다음 배포자 속성을 클릭합니다.

  3. 배포자 속성 - <Distributor> 대화 상자에서 속성을 보고 수정합니다.

    • 배포 데이터베이스의 속성을 보고 수정하려면대화 상자의 일반 페이지에서 해당 데이터베이스에 대한 속성 단추 (...)를 클릭합니다.

    • 배포자와 관련된 게시자 속성을 보고 수정하려면 대화 상자의 게시자 페이지에서 해당 게시자에 대한 속성 단추 (...)를 클릭합니다.

    • 복제 에이전트에 대한 프로필에 액세스하려면 대화 상자의 일반 페이지에서 프로필 기본값 단추를 클릭합니다. 자세한 내용은 복제 에이전트 프로필을 참조하십시오.

    • 관리 저장 프로시저가 게시자에서 실행되고 배포자에서 정보를 업데이트할 때 사용되는 계정의 암호를 변경하려면 대화 상자의 게시자 페이지에서 암호암호 확인 상자에 새 암호를 입력합니다. 자세한 내용은 배포자 보안 설정을 참조하십시오.

  4. 필요한 경우 속성을 수정한 다음 확인을 클릭합니다.

게시자 속성을 보고 수정하려면

  1. SQL Server Management Studio에서 게시자에 연결한 다음 해당 서버 노드를 확장합니다.

  2. 복제 폴더를 마우스 오른쪽 단추로 클릭한 다음 게시자 속성을 클릭합니다.

  3. 게시자 속성 - <Publisher> 대화 상자에서 속성을 보고 수정합니다.

    • sysadmin 고정 서버 역할의 사용자는 게시 데이터베이스 페이지에서 복제에 사용할 데이터베이스를 설정할 수 있습니다. 데이터베이스를 설정한다고 해서 그 데이터베이스가 게시되는 것은 아닙니다. 데이터베이스를 설정하면 설정된 데이터베이스에 대한 db_owner 고정 데이터베이스 역할의 사용자가 그 데이터베이스에 하나 이상의 게시를 만들 수 있습니다.
  4. 필요한 경우 속성을 수정한 다음 확인을 클릭합니다.

맨 위로 이동 링크와 함께 사용되는 화살표 아이콘[Top]

Transact-SQL 사용

복제 저장 프로시저를 사용하여 프로그래밍 방식으로 게시자와 배포자 속성을 볼 수 있습니다.

배포자 및 배포 데이터베이스 속성을 보려면

  1. 배포자, 배포 데이터베이스 및 작업 디렉터리에 대한 정보를 반환하려면 sp_helpdistributor를 실행합니다.

  2. 지정한 배포 데이터베이스에 대한 속성을 반환하려면 sp_helpdistributiondb를 실행합니다.

배포자 및 배포 데이터베이스 속성을 변경하려면

  1. 배포자 속성을 수정하려면 배포자에서 sp_changedistributor_property를 실행합니다.

  2. 배포자 데이터베이스 속성을 수정하려면 배포자에서 sp_changedistributiondb를 실행합니다.

  3. 배포자 암호를 변경하려면 배포자에서 sp_changedistributor_password를 실행합니다.

    보안 정보보안 정보

    가능한 경우 런타임 시 사용자에게 보안 자격 증명을 입력하라는 메시지가 표시됩니다. 스크립트 파일에 자격 증명을 저장해야 하는 경우에는 무단으로 액세스하지 못하도록 파일에 보안을 설정하십시오.

  4. 배포자를 사용하는 게시자의 속성을 변경하려면 배포자에서 sp_changedistpublisher를 실행합니다.

예(Transact-SQL)

다음 Transact-SQL 스크립트 예에서는 배포자와 배포자 데이터베이스에 대한 정보를 반환합니다.

-- View information about the Distributor, distribution database, 
-- working directory, and SQL Server Agent user account. 
USE master
EXEC sp_helpdistributor;
GO

-- View information about the specified distribution database. 
USE distribution
EXEC sp_helpdistributiondb;
GO

다음 예에서는 배포자의 보존 기간, 배포자에 연결할 때 사용되는 암호, 배포자가 여러 복제 에이전트의 상태를 확인하는 간격(하트비트 간격이라고도 함)을 변경합니다.

보안 정보보안 정보

가능한 경우 런타임 시 사용자에게 보안 자격 증명을 입력하라는 메시지가 표시됩니다. 스크립트 파일에 자격 증명을 저장해야 하는 경우에는 무단으로 액세스하지 못하도록 파일에 보안을 설정하십시오.

-- Change the heartbeat interval at the Distributor to 5 minutes. 
USE master 
exec sp_changedistributor_property 
    @property = N'heartbeat_interval', 
    @value = 5;
GO

DECLARE @distributionDB AS sysname;
SET @distributionDB = N'distribution';

-- Change the history retention period to 24 hours and the
-- maximum retention period to 48 hours.  
USE distribution
EXEC sp_changedistributiondb @distributionDB, N'history_retention', 24
EXEC sp_changedistributiondb @distributionDB, N'max_distretention', 48
GO 

-- Change the password on the Distributor. 
-- To avoid storing the password in the script file, the value is passed 
-- into SQLCMD as a scripting variable. 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".
USE master
EXEC sp_changedistributor_password $(Password)
GO

맨 위로 이동 링크와 함께 사용되는 화살표 아이콘[Top]

RMO(복제 관리 개체) 사용

배포자 속성을 보고 수정하려면

  1. ServerConnection 클래스를 사용하여 배포자 연결을 만듭니다.

  2. ReplicationServer 클래스의 인스턴스를 만듭니다. 1단계에서 만든 ServerConnection 개체를 전달합니다.

  3. (옵션) IsDistributor 속성에서 현재 연결된 서버가 배포자인지 확인합니다.

  4. Load 메서드를 호출하여 서버에서 속성을 가져옵니다.

  5. (옵션) 속성을 변경하려면 ReplicationServer 개체에 설정할 수 있는 하나 이상의 배포자 속성에 새 값을 설정합니다.

  6. (옵션) ReplicationServer 개체의 CachePropertyChanges 속성이 true로 설정되면 CommitPropertyChanges 메서드를 호출하여 서버의 변경 내용을 커밋합니다.

배포 데이터베이스 속성을 보고 수정하려면

  1. ServerConnection 클래스를 사용하여 배포자 연결을 만듭니다.

  2. DistributionDatabase 클래스의 인스턴스를 만듭니다. 이름 속성을 지정하고 1단계에서 만든 ServerConnection 개체를 전달합니다.

  3. LoadProperties 메서드를 호출하여 서버에서 속성을 가져옵니다. 이 메서드가 false를 반환하는 경우 지정된 이름의 데이터베이스가 서버에 없는 것입니다.

  4. (옵션) 속성을 변경하려면 설정할 수 있는 DistributionDatabase 속성 중 하나에 대해 새 값을 설정합니다.

  5. (옵션) DistributionDatabase 개체의 CachePropertyChanges 속성이 true로 설정되면 CommitPropertyChanges 메서드를 호출하여 서버의 변경 내용을 커밋합니다.

게시자 속성을 보고 수정하려면

  1. ServerConnection 클래스를 사용하여 게시자 연결을 만듭니다.

  2. DistributionPublisher 클래스의 인스턴스를 만듭니다. Name 속성을 지정하고 1단계에서 만든 ServerConnection 개체를 전달합니다.

  3. (옵션) 속성을 변경하려면 설정할 수 있는 DistributionPublisher 속성 중 하나에 대해 새 값을 설정합니다.

  4. (옵션) DistributionPublisher 개체의 CachePropertyChanges 속성이 true로 설정되면 CommitPropertyChanges 메서드를 호출하여 서버의 변경 내용을 커밋합니다.

관리 연결의 암호를 게시자에서 배포자로 변경하려면

  1. ServerConnection 클래스를 사용하여 배포자 연결을 만듭니다.

  2. ReplicationServer 클래스의 인스턴스를 만듭니다.

  3. ConnectionContext 속성을 1단계에서 만든 연결로 설정합니다.

  4. Load 메서드를 호출하여 개체 속성을 얻습니다.

  5. ChangeDistributorPassword 메서드를 호출합니다. password 매개 변수에 대해 새 암호 값을 전달합니다.

    보안 정보보안 정보

    가능하면 런타임에 사용자에게 자격 증명을 입력하라는 메시지를 표시하십시오. 자격 증명을 저장해야 하는 경우 Microsoft Windows .NET Framework에서 제공하는 암호화 서비스를 사용합니다.

  6. (옵션) 다음 단계를 수행하여 이 배포자를 사용하는 각 원격 게시자에서 암호를 변경합니다.

    1. ServerConnection 클래스를 사용하여 게시자 연결을 만듭니다.

    2. ReplicationServer 클래스의 인스턴스를 만듭니다.

    3. ConnectionContext 속성을 6a단계에서 만든 연결로 설정합니다.

    4. Load 메서드를 호출하여 개체 속성을 얻습니다.

    5. ChangeDistributorPassword 메서드를 호출합니다. password 매개 변수에 대해 5단계에서 만든 새 암호 값을 전달합니다.

예(RMO)

이 예에서는 배포 및 배포 데이터베이스 속성을 변경하는 방법을 보여 줍니다.

보안 정보보안 정보

자격 증명을 코드에 저장하지 않도록 런타임에 새 배포자 암호가 제공됩니다.

            // 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();
            }
' Set the Distributor and distribution database names.
Dim distributionDbName As String = "distribution"
Dim distributorName As String = publisherInstance

Dim distributor As ReplicationServer
Dim distributionDb As DistributionDatabase

' Create a connection to the Distributor using Windows Authentication.
Dim conn As ServerConnection = New ServerConnection(distributorName)

Try
    ' Open the connection. 
    conn.Connect()

    distributor = New ReplicationServer(conn)

    ' Load Distributor properties, if it is installed.
    If distributor.LoadProperties() Then
        ' 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))
    End If

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

    ' Change distribution database properties.
    If distributionDb.LoadProperties() Then
        ' 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.
    End If
Catch ex As Exception
    ' Implement the appropriate error handling here. 
    Throw New ApplicationException("An error occured when changing Distributor " + _
        " or distribution database properties.", ex)
Finally
    conn.Disconnect()
End Try

맨 위로 이동 링크와 함께 사용되는 화살표 아이콘[Top]

참고 항목

태스크

게시자에 대한 정보 보기 및 태스크 수행(복제 모니터)

개념

복제 관리 개체 개념

게시 및 배포 해제

배포 구성

복제 관리 개체 개념

배포자 및 게시자 정보 스크립트

복제 시스템 저장 프로시저 개념