다음을 통해 공유


sp_syscollector_create_collection_set(Transact-SQL)

새 컬렉션 집합을 만듭니다. 이 저장 프로시저를 사용하여 데이터 컬렉션용 사용자 지정 컬렉션 집합을 만들 수 있습니다.

항목 링크 아이콘Transact-SQL 구문 표기 규칙

구문

sp_syscollector_create_collection_set 
          [ @name = ] 'name'
        , [ [ @target = ] 'target' ]
        , [ [ @collection_mode = ] collection_mode ]
        , [ [ @days_until_expiration = ] days_until_expiration ]
        , [ [ @proxy_id = ] proxy_id ]
        , [ [ @proxy_name = ] 'proxy_name' ]
        , [ [ @schedule_uid = ] 'schedule_uid' ]
        , [ [ @schedule_name = ] 'schedule_name' ]
        , [ [ @logging_level = ] logging_level ]
        , [ [ @description = ] 'description' ]
        , [ @collection_set_id = ] collection_set_id OUTPUT 
        , [ [ @collection_set_uid = ] 'collection_set_uid' OUTPUT ]

인수

  • [ @name = ] 'name'
    컬렉션 집합의 이름입니다. name은 sysname이며 빈 문자열이나 NULL일 수 없습니다.

    name은 고유해야 합니다. 현재 컬렉션 집합 이름의 목록을 보려면 syscollector_collection_sets 시스템 뷰를 쿼리합니다.

  • [ @target = ] 'target'
    나중에 사용하도록 예약되었습니다. name은 nvarchar(128)이며 기본값은 NULL입니다.

  • [ @collection\_mode = ] collection_mode
    데이터를 수집하고 저장하는 방식을 지정합니다. collection_mode는 smallint이며 다음 값 중 하나를 포함할 수 있습니다.

    0 – 캐시된 모드. 데이터 컬렉션과 업로드가 별도의 일정에 속해 있습니다. 연속 컬렉션을 위해 캐시된 모드를 지정합니다.

    1 - 캐시되지 않은 모드. 데이터 컬렉션과 업로드가 같은 일정에 속해 있습니다. 임시 컬렉션이나 스냅숏 컬렉션을 위해 캐시되지 않은 모드를 지정합니다.

    collection_mode의 기본값은 0입니다. collection_mode가 0이면 schedule_uid 또는 schedule_name을 지정해야 합니다.

  • [ @days\_until\_expiration = ] days_until_expiration
    수정된 데이터가 관리 데이터 웨어하우스에 저장되는 일 수입니다. days_until_expiration은 smallint이며 기본값은 730(2년)입니다 days_until_expiration은 0 또는 양의 정수여야 합니다.

  • [ @proxy\_id = ] proxy_id
    SQL Server 에이전트 프록시 계정의 고유 식별자입니다. proxy_id는 int이며 기본값은 NULL입니다. 지정된 경우 proxy_name은 NULL이어야 합니다. proxy_id를 확인하려면 sysproxies 시스템 테이블을 쿼리합니다. dc_admin 고정 데이터베이스 역할에는 프록시에 액세스할 권한이 있어야 합니다. 자세한 내용은 SQL Server 에이전트 프록시 만들기를 참조하십시오.

  • [ @proxy\_name = ] 'proxy_name'
    프록시 계정의 이름입니다. proxy_name은 sysname이며 기본값은 NULL입니다. 지정된 경우 proxy_id는 NULL이어야 합니다. proxy_name을 확인하려면 sysproxies 시스템 테이블을 쿼리합니다.

  • [ @schedule\_uid = ] 'schedule_uid'
    일정을 가리키는 GUID입니다. schedule_uid는 uniqueidentifier이며 기본값은 NULL입니다. 지정된 경우 schedule_name은 NULL이어야 합니다. schedule_uid를 확인하려면 sysschedules 시스템 테이블을 쿼리합니다.

    collection_mode가 0으로 설정된 경우 schedule_uid 또는 schedule_name을 지정해야 합니다. collection_mode가 1로 설정된 경우 schedule_uid 또는 schedule_name을 지정하면 무시됩니다.

  • [ @schedule\_name = ] 'schedule_name'
    일정의 이름입니다. schedule_name은 sysname이며 기본값은 NULL입니다. 지정된 경우 schedule_uid는 NULL이어야 합니다. schedule_name을 확인하려면 sysschedules 시스템 테이블을 쿼리합니다.

  • [ @logging\_level = ] logging_level
    로깅 수준입니다. logging_level은 smallint이며 다음 값 중 하나를 포함할 수 있습니다.

    0 - 실행 정보 및 다음 항목을 추적하는 SSIS 이벤트 기록

    • 컬렉션 집합 시작/중지

    • 패키지 시작/중지

    • 오류 정보

    1 - 수준 0 로깅 및 다음 항목

    • 실행 통계

    • 지속적으로 실행되는 컬렉션 프로세스

    • SSIS의 경고 이벤트

    2 - 수준 1 로깅 및 SSIS의 세부 이벤트 정보

    logging_level의 기본값은 1입니다.

  • [ @description = ] 'description'
    컬렉션 집합에 대한 설명입니다. description은 nvarchar(4000)이며 기본값은 NULL입니다.

  • [ @collection\_set\_id = ] collection_set_id
    컬렉션 집합의 고유한 로컬 식별자입니다. collection_set_id는 OUTPUT이 있는 int이며 필수 사항입니다.

  • [ @collection\_set\_uid = ] 'collection_set_uid'
    컬렉션 집합의 GUID입니다. collection_set_uid는 OUTPUT이 있는 uniqueidentifier이며 기본값은 NULL입니다.

반환 코드 값

0(성공) 또는 1(실패)

주의

sp_syscollector_create_collection_set는 msdb 시스템 데이터베이스의 컨텍스트에서 실행해야 합니다.

사용 권한

이 프로시저를 실행하려면 dc_admin(EXECUTE 권한 있음) 고정 데이터베이스 역할의 멤버 자격이 필요합니다.

1. 기본값을 사용하여 컬렉션 집합 만들기

다음 예에서는 필수 매개 변수만 지정하여 컬렉션 집합을 만듭니다. @collection\_mode는 필수 사항은 아니지만 기본 컬렉션 모드(캐시된 모드)를 사용하려면 일정 ID 또는 일정 이름을 지정해야 합니다.

USE msdb;
GO
DECLARE @collection_set_id int;
EXECUTE dbo.sp_syscollector_create_collection_set
    @name = N'Simple collection set test 1',
    @description = N'This is a test collection set that runs in non-cached mode.',
    @collection_mode = 1,
    @collection_set_id = @collection_set_id OUTPUT;
GO

2. 지정된 값을 사용하여 컬렉션 집합 만들기

다음 예에서는 여러 매개 변수에 값을 지정하는 방식으로 컬렉션 집합을 만듭니다.

USE msdb;
GO
DECLARE @collection_set_id int;
DECLARE @collection_set_uid uniqueidentifier;
SET @collection_set_uid = NEWID();
EXEC dbo.sp_syscollector_create_collection_set
    @name = N'Simple collection set test 2',
    @collection_mode = 0,
    @days_until_expiration = 365,
    @description = N'This is a test collection set that runs in cached mode.',
    @logging_level = 2,
    @schedule_name = N'CollectorSchedule_Every_30min',
    @collection_set_id = @collection_set_id OUTPUT,
    @collection_set_uid = @collection_set_uid OUTPUT;