게시 속성 보기 및 수정

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

항목 내용

  • 시작하기 전 주의 사항

    제한 사항

    권장 사항

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

    SQL Server Management Studio

    Transact-SQL

    RMO(복제 관리 개체)

시작하기 전 주의 사항

제한 사항

  • 게시를 만든 다음 일부 속성은 수정할 수 없고, 게시에 대한 구독이 있는 경우에 수정할 수 없는 속성도 있습니다. 수정할 수 없는 속성은 읽기 전용으로 표시됩니다.

권장 사항

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

SQL Server Management Studio 사용

SQL Server Management Studio 및 복제 모니터에서 사용할 수 있는 게시 속성 - <Publication> 대화 상자에서 게시 속성을 확인하고 수정할 수 있습니다. 복제 모니터를 시작하는 방법은 복제 모니터 시작를 참조하십시오.

게시 속성 - <Publication> 대화 상자에는 다음 페이지가 포함되어 있습니다.

  • 일반 페이지에는 게시 이름 및 설명, 데이터베이스 이름, 게시 유형 및 구독 만료 설정이 포함되어 있습니다.

  • 아티클 페이지는 새 게시 마법사의 아티클 페이지에 해당합니다. 이 페이지를 사용하여 아티클을 추가 및 삭제하고 아티클의 속성 및 열 필터링을 변경할 수 있습니다.

  • 행 필터 페이지는 새 게시 마법사의 테이블 행 필터 페이지에 해당합니다. 이 페이지를 사용하여 모든 게시 유형에 대해 정적 행 필터를 추가, 편집 및 삭제하고 병합 게시에 대해 매개 변수가 있는 행 필터 및 조인 필터를 추가, 편집 및 삭제할 수 있습니다.

  • 스냅숏 페이지를 사용하면 스냅숏의 형식 및 위치, 스냅숏의 압축 여부 및 스냅숏이 적용되기 전과 후에 실행할 스크립트를 지정할 수 있습니다.

  • FTP 스냅숏 페이지(SQL Server 2005 이전 버전을 실행하는 게시자에 대한 병합 게시와 스냅숏 및 트랜잭션 게시의 경우)를 사용하면 구독자가 FTP(파일 전송 프로토콜)를 통해 스냅숏 파일을 다운로드할 수 있는지 여부를 지정할 수 있습니다.

  • FTP 스냅숏 및 인터넷 페이지(SQL Server 2005 이후 버전을 실행하는 게시자에 대한 병합 게시의 경우)를 사용하면 구독자가 FTP를 통해 스냅숏 파일을 다운로드할 수 있는지 여부와 구독자가 HTTPS를 통해 구독을 동기화할 수 있는지 여부를 지정할 수 있습니다.

  • 구독 옵션 페이지를 사용하면 모든 구독에 적용되는 여러 옵션을 설정할 수 있습니다. 사용할 수 있는 옵션은 게시 유형에 따라 달라집니다.

  • 게시 액세스 목록 페이지를 사용하면 게시에 액세스할 수 있는 로그인 및 그룹을 지정할 수 있습니다.

  • 에이전트 보안 페이지를 사용하여 모든 게시에 대한 스냅숏 에이전트, 모든 트랜잭션 게시에 대한 로그 판독기 에이전트, 지연 업데이트 구독을 허용하는 트랜잭션 게시에 대한 큐 판독기 에이전트 등을 실행하고 복제 토폴로지의 컴퓨터에 이러한 에이전트를 연결하는 계정에 대한 설정에 액세스할 수 있습니다.

  • 데이터 파티션 페이지(SQL Server 2005 이후 버전을 실행하는 게시자의 병합 게시의 경우)를 사용하면 매개 변수가 있는 필터가 있는 게시에 대한 구독자가 스냅숏을 사용할 수 없는 경우 스냅숏을 요청할 수 있는지 여부를 지정할 수 있습니다. 또한 하나 이상의 파티션에 대해 스냅숏을 한 번 또는 되풀이되는 일정에 따라 생성할 수 있습니다.

Management Studio에서 게시 속성을 보고 수정하려면

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

  2. 복제 폴더를 확장한 다음 로컬 게시 폴더를 확장합니다.

  3. 게시를 마우스 오른쪽 단추로 클릭한 다음 속성을 클릭합니다.

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

복제 모니터에서 게시 속성을 보고 수정하려면

  1. 복제 모니터의 왼쪽 창에서 게시자 그룹을 확장한 다음 게시자를 확장합니다.

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

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

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

Transact-SQL 사용

게시는 수정할 수 있으며 게시 속성은 복제 저장 프로시저를 사용하여 프로그래밍 방식으로 반환할 수 있습니다. 사용하는 저장 프로시저는 게시 유형에 따라 달라집니다.

스냅숏 또는 트랜잭션 게시의 속성을 확인하려면

  • @publication 매개 변수에 게시 이름을 지정하여 sp_helppublication을 실행합니다. 이 매개 변수를 지정하지 않으면 게시자에 있는 모든 게시에 대한 정보가 반환됩니다.

스냅숏 또는 트랜잭션 게시의 속성을 변경하려면

  • @property 매개 변수에 변경할 게시 속성, @value 매개 변수에 이 속성의 새 값을 지정하여 sp_changepublication을 실행합니다.

    [!참고]

    변경 시 새 스냅숏을 생성해야 하는 경우 @force_invalidate_snapshot 값도 1로 지정해야 합니다. 변경 시 구독자를 초기화해야 하는 경우 @force_reinit_subscription에 값 1을 지정해야 합니다. 변경 시 새 스냅숏 또는 재초기화가 필요한 속성에 대해서는 게시 및 아티클 속성 변경을 참조하십시오.

병합 게시의 속성을 확인하려면

  • @publication 매개 변수에 게시 이름을 지정하여 sp_helpmergepublication을 실행합니다. 이 매개 변수를 지정하지 않으면 게시자에 있는 모든 게시에 대한 정보가 반환됩니다.

병합 게시의 속성을 변경하려면

  • @property 매개 변수에 변경할 게시 속성, @value 매개 변수에 이 속성의 새 값을 지정하여 sp_changemergepublication을 실행합니다.

    [!참고]

    변경 시 새 스냅숏을 생성해야 하는 경우 @force_invalidate_snapshot 값도 1로 지정해야 합니다. 변경 시 구독자를 초기화해야 하는 경우 @force_reinit_subscription에 값 1을 지정해야 합니다. 변경 시 새 스냅숏 또는 재초기화가 필요한 속성에 대한 자세한 내용은 게시 및 아티클 속성 변경을 참조하십시오.

스냅숏의 속성을 확인하려면

스냅숏의 속성을 변경하려면

예(Transact-SQL)

다음 트랜잭션 복제 예에서는 게시 속성을 반환합니다.

DECLARE @myTranPub AS sysname
SET @myTranPub = N'AdvWorksProductTran' 

USE [AdventureWorks2012]
EXEC sp_helppublication @publication = @myTranPub
GO

다음 트랜잭션 복제 예에서는 게시에 대한 스키마 복제를 해제합니다.

DECLARE @publication AS sysname
SET @publication = N'AdvWorksProductTran' 

-- Turn off DDL replication for the transactional publication.
USE [AdventureWorks2012]
EXEC sp_changepublication 
  @publication = @publication, 
  @property = N'replicate_ddl', 
  @value = 0
GO

다음 병합 복제 예에서는 게시 속성을 반환합니다.

DECLARE @publication AS sysname;
SET @publication = N'AdvWorksSalesOrdersMerge';

USE [AdventureWorks2012]
EXEC sp_helpmergepublication @publication = @publication;
GO

다음 병합 복제 예에서는 게시에 대한 스키마 복제를 해제합니다.

DECLARE @publication AS sysname;
SET @publication = N'AdvWorksSalesOrdersMerge'; 

-- Disable DDL replication for the publication.
USE [AdventureWorks2012]
EXEC sp_changemergepublication 
  @publication = @publication, 
  @property = N'replicate_ddl', 
  @value = 0,
  @force_invalidate_snapshot = 0, 
  @force_reinit_subscription = 0;
GO

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

RMO(복제 관리 개체) 사용

RMO(복제 관리 개체)를 사용하여 프로그래밍 방식으로 게시를 수정하고 해당 속성에 액세스할 수 있습니다. 게시 속성을 보거나 수정하는 데 사용되는 RMO 클래스는 게시의 유형에 따라 달라집니다.

스냅숏 또는 트랜잭션 게시의 속성을 보거나 수정하려면

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

  2. TransPublication 클래스의 인스턴스를 만들고, 게시에 대해 NameDatabaseName 속성을 설정한 다음 1단계에서 만든 연결에 ConnectionContext 속성을 설정합니다.

  3. LoadProperties 메서드를 호출하여 개체 속성을 가져옵니다. 이 메서드가 false를 반환하는 경우 2단계에서 게시 속성이 올바르게 정의되지 않았거나 게시가 없습니다.

  4. (옵션) 속성을 변경하려면 설정할 수 있는 한 개 이상의 속성에 대해 새 값을 설정합니다. 논리 AND 연산자(Microsoft Visual C#에서는 &, Microsoft Visual Basic에서는 And)를 사용하여 지정된 PublicationAttributes 값이 Attributes 속성에 대해 설정되어 있는지 확인할 수 있습니다. 포함 논리 OR 연산자(Visual C#에서는 | 및 Visual Basic에서는 Or)와 배타적 논리 OR 연산자(Visual C#에서는 ^, Visual Basic에서는 Xor)를 사용하여Attributes 속성에 대한 PublicationAttributes 값을 변경할 수 있습니다.

  5. (옵션) CachePropertyChanges에 대해 true 값을 지정했으면 CommitPropertyChanges 메서드를 호출하여 서버의 변경 내용을 커밋합니다. CachePropertyChanges에 대해 false 값을 지정했으면(기본값) 변경 내용이 즉시 서버로 전송됩니다.

병합 게시의 속성을 보거나 수정하려면

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

  2. MergePublication 클래스의 인스턴스를 만들고 게시에 대한 NameDatabaseName 속성을 설정한 다음, 1단계에서 만든 연결에 ConnectionContext 속성을 설정합니다.

  3. LoadProperties 메서드를 호출하여 개체 속성을 가져옵니다. 이 메서드가 false를 반환하는 경우 2단계에서 게시 속성이 올바르게 정의되지 않았거나 게시가 없습니다.

  4. (옵션) 속성을 변경하려면 설정할 수 있는 한 개 이상의 속성에 대해 새 값을 설정합니다. 논리 AND 연산자(Visual C#에서는 &, Visual Basic에서는 And)를 사용하여 지정된 PublicationAttributes 값이 Attributes 속성에 대해 설정되어 있는지 확인할 수 있습니다. 포함 논리 OR 연산자(Visual C#에서는 | 및 Visual Basic에서는 Or)와 배타적 논리 OR 연산자(Visual C#에서는 ^, Visual Basic에서는 Xor)를 사용하여Attributes 속성에 대한 PublicationAttributes 값을 변경할 수 있습니다.

  5. (옵션) CachePropertyChanges에 대해 true 값을 지정했으면 CommitPropertyChanges 메서드를 호출하여 서버의 변경 내용을 커밋합니다. CachePropertyChanges에 대해 false 값을 지정했으면(기본값) 변경 내용이 즉시 서버로 전송됩니다.

예(RMO)

이 예에서는 트랜잭션 게시에 대한 게시 특성을 설정합니다. 변경 내용은 명시적으로 서버로 전송될 때까지 캐시됩니다.

          // Define the server, database, and publication names
            string publisherName = publisherInstance;
            string publicationName = "AdvWorksProductTran";
            string publicationDbName = "AdventureWorks2012";

            TransPublication publication;

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

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

                // Set the required properties for the publication.
                publication = new TransPublication();
                publication.ConnectionContext = conn;
                publication.Name = publicationName;
                publication.DatabaseName = publicationDbName;

                // Explicitly enable caching of property changes on this object.
                publication.CachePropertyChanges = true;

                // If we can't get the properties for this publication, 
                // throw an application exception.
                if (publication.LoadProperties())
                {
                    // Enable support for push subscriptions and disable support 
                    // for pull subscriptions.
                    if ((publication.Attributes & PublicationAttributes.AllowPull) != 0)
                    {
                        publication.Attributes ^= PublicationAttributes.AllowPull;
                    }
                    if ((publication.Attributes & PublicationAttributes.AllowPush) == 0)
                    {
                        publication.Attributes |= PublicationAttributes.AllowPush;
                    }

                    // Send changes to the server.
                    publication.CommitPropertyChanges();
                }
                else
                {
                    throw new ApplicationException(String.Format(
                        "Settings could not be retrieved for the publication. " +
                        "Ensure that the publication {0} exists on {1}.",
                        publicationName, publisherName));
                }
            }
            catch (Exception ex)
            {
                // Do error handling here.
                throw new ApplicationException(
                    "The publication property could not be changed.", ex);
            }
            finally
            {
                conn.Disconnect();
            }
' Define the server, database, and publication names
Dim publisherName As String = publisherInstance
Dim publicationName As String = "AdvWorksProductTran"
Dim publicationDbName As String = "AdventureWorks2012"

Dim publication As TransPublication

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

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

    ' Set the required properties for the publication.
    publication = New TransPublication()
    publication.ConnectionContext = conn
    publication.Name = publicationName
    publication.DatabaseName = publicationDbName

    ' Explicitly enable caching of property changes on this object.
    publication.CachePropertyChanges = True

    ' If we can't get the properties for this publication, 
    ' throw an application exception.
    If publication.LoadProperties() Then
        ' Enable support for push subscriptions and disable support 
        ' for pull subscriptions.
        If (publication.Attributes And PublicationAttributes.AllowPull) <> 0 Then
            publication.Attributes = publication.Attributes _
            Xor PublicationAttributes.AllowPull
        End If
        If (publication.Attributes And PublicationAttributes.AllowPush) = 0 Then
            publication.Attributes = publication.Attributes _
            Or PublicationAttributes.AllowPush
        End If

        ' Send changes to the server.
        publication.CommitPropertyChanges()
    Else
        Throw New ApplicationException(String.Format( _
         "Settings could not be retrieved for the publication. " + _
         "Ensure that the publication {0} exists on {1}.", _
         publicationName, publisherName))
    End If
Catch ex As Exception
    ' Do error handling here.
    Throw New ApplicationException( _
        "The publication property could not be changed.", ex)
Finally
    conn.Disconnect()
End Try

이 예에서는 병합 게시에 대한 DDL 복제를 해제합니다.

           // Define the server, database, and publication names
            string publisherName = publisherInstance;
            string publicationName = "AdvWorksSalesOrdersMerge";
            string publicationDbName = "AdventureWorks2012";

            MergePublication publication;

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

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

                // Set the required properties for the publication.
                publication = new MergePublication();
                publication.ConnectionContext = conn;
                publication.Name = publicationName;
                publication.DatabaseName = publicationDbName;


                // If we can't get the properties for this merge publication, then throw an application exception.
                if (publication.LoadProperties())
                {
                    // If DDL replication is currently enabled, disable it.
                    if (publication.ReplicateDdl == DdlReplicationOptions.All)
                    {
                        publication.ReplicateDdl = DdlReplicationOptions.None;
                    }
                    else
                    {
                        publication.ReplicateDdl = DdlReplicationOptions.All;
                    }
                }
                else
                {
                    throw new ApplicationException(String.Format(
                        "Settings could not be retrieved for the publication. " +
                        "Ensure that the publication {0} exists on {1}.",
                        publicationName, publisherName));
                }
            }
            catch (Exception ex)
            {
                // Do error handling here.
                throw new ApplicationException(
                    "The publication property could not be changed.", ex);
            }
            finally
            {
                conn.Disconnect();
            }
' Define the server, database, and publication names
Dim publisherName As String = publisherInstance
Dim publicationName As String = "AdvWorksSalesOrdersMerge"
Dim publicationDbName As String = "AdventureWorks2012"

Dim publication As MergePublication

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

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

    ' Set the required properties for the publication.
    publication = New MergePublication()
    publication.ConnectionContext = conn
    publication.Name = publicationName
    publication.DatabaseName = publicationDbName

    ' If we can't get the properties for this merge publication, then throw an application exception.
    If publication.LoadProperties() Then
        ' If DDL replication is currently enabled, disable it.
        If publication.ReplicateDdl = DdlReplicationOptions.All Then
            publication.ReplicateDdl = DdlReplicationOptions.None
        Else
            publication.ReplicateDdl = DdlReplicationOptions.All
        End If
    Else
        Throw New ApplicationException(String.Format( _
         "Settings could not be retrieved for the publication. " + _
         "Ensure that the publication {0} exists on {1}.", _
         publicationName, publisherName))
    End If
Catch ex As Exception
    ' Do error handling here.
    Throw New ApplicationException( _
        "The publication property could not be changed.", ex)
Finally
    conn.Disconnect()
End Try

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

참고 항목

태스크

게시에 대한 아티클 추가 및 삭제(SQL Server Management Studio)

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

개념

데이터 및 데이터베이스 개체 게시

게시 및 아티클 속성 변경

게시 데이터베이스의 스키마 변경

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

아티클 속성 보기 및 수정