Aracılığıyla paylaş


sp_syscollector_create_collection_item (Transact-SQL)

Kullanıcı tanımlı bir koleksiyonunda bir koleksiyon öğesi oluşturur küme.Bir koleksiyon öğe toplanacak veri ve veri toplanan sıklığını tanımlar.

Topic link iconTransact-SQL sözdizimi kuralları

sp_syscollector_create_collection_item 
            [ @collection_set_id = ] collection_set_id 
        , [ @collector_type_uid = ] 'collector_type_uid'
        , [ @name = ] 'name' 
        , [ [ @frequency = ] frequency ]
        , [ @parameters = ] 'parameters'
        , [ @collection_item_id = ] collection_item_id OUTPUT

Bağımsız değişkenler

  • [collection_set_id =] collection_set_id
    Is the unique local identifier for the collection set.collection_set_id is int.

  • [collector_type_uid =] ' collector_type_uid'
    Bu öğe için kullanmak üzere toplayıcı türü tanımlayan bir GUID değeridir collector_type_uid olan uniqueidentifier Varsayılan değer yok Toplayıcı türlerinin bir listesi için sistem syscollector_collector_types görünümü sorgula.

  • [adı =] ' name'
    Is the name of the collection item.name is sysname and cannot be an empty string or NULL.

    name benzersiz olması gerekir.Geçerli koleksiyon listesi öğe syscollector_collection_öğes sistem Görünüm adları, sorgu.

  • [sıklık =] frequency
    Is used to specify (in seconds) how frequently data is collected by this collection item.frequency is int, with a default of 5.Belirtilebilecek en düşük değer 5 saniyedir.

    koleksiyon küme olan küme nedeniyle bu modu hem de veri koleksiyon ve koleksiyon için belirtilen zamanlamaya ortaya için karşıya yükleme moduna önbelleğe alınmamış sıklığını yoksayılır küme.koleksiyon toplama modunda görüntülemek için küme, sorgu syscollector_collection_kümes sistem görüntüleyin.

  • [parametre =] ' parameters'
    The input parameters for the collector type.parameters is xml with a default of NULL.The parameters schema must match the parameters schema of the toplayıcı türü.

  • [collection_item_id =] collection_item_id
    Is the unique identifer that identifies the collection set item.collection_item_id is int and has OUTPUT.

Dönüş Kodu Değerleri

0 (başarılı) veya 1 (hata)

Remarks

sp_syscollector_create_collection_item msdb veritabanını sistem bağlamında çalıştırmalısınız.

Koleksiyon küme Koleksiyon öğesi olduğu eklenen Koleksiyon öğesi oluşturmadan önce durdurulmalı.Koleksiyon öğeleri sistem tahsilat kümelerine eklenemiyor.

İzinler

Bu yordamı çalıştırmak yürütmek izni) ile (dc_admin sabit veritabanı rolü üyeliği gerekir.

Örnekler

Aşağıdaki örnek, tahsilat türüne göre bir koleksiyon öğesi oluşturur. Generic T-SQL Query Collector Type ve derlemeye ekler küme adlı Simple collection set test 2. Belirtilen koleksiyon kümesi oluşturmak için B örnekte çalıştırın. sp_syscollector_create_collection_set (Transact-SQL).

USE msdb;
GO
DECLARE @collection_item_id int;
DECLARE @collection_set_id int = (SELECT collection_set_id 
                                  FROM syscollector_collection_sets
                                  WHERE name = N'Simple collection set test 2');
DECLARE @collector_type_uid uniqueidentifier = 
    (SELECT collector_type_uid
     FROM syscollector_collector_types
     WHERE name = N'Generic T-SQL Query Collector Type');
DECLARE @params xml = 
    CONVERT(xml, N'<ns:TSQLQueryCollector xmlns:ns="DataCollectorType">
            <Query>
                <Value>SELECT * FROM sys.objects</Value>
                <OutputTable>MyOutputTable</OutputTable>
            </Query>
            <Databases> 
                <Database> UseSystemDatabases = "true" 
                           UseUserDatabases = "true"
                </Database>
            </Databases>
         </ns:TSQLQueryCollector>');

EXEC sp_syscollector_create_collection_item
    @collection_set_id = @collection_set_id,
    @collector_type_uid = @collector_type_uid,
    @name = 'My custom TSQL query collector item',
    @frequency = 6000,
    @parameters = @params,
    @collection_item_id = @collection_item_id OUTPUT;