THE SQL Server Blog Spot on the Web
Welcome to SQLblog.com - The SQL Server blog spot on the web Sign in | Join | Help
in Search

Peter DeBetta's SQL Programming Blog

Peter DeBetta's blog about programming in SQL Server 2008, 2005, etc. using technologies such as T-SQL, .NET, CLR, C#, VB, Visual Studio, and SQL Server Management Studio.

  • Policy Based Management Evaluation Modes

    Dan Jones wrote a great post about Facets from the new Policy-Based Management feature of SQL Server 2008. At one point in the post, he listed all of the available facets and their supported evaluation modes. Since SQL Server 2008 is not RTM, and since facets can be added in the future, I thought I'd write a query that would list the facets and supported evaluation modes.

    Note that the On Demand mode is always supported and has therefore been left out of the query.

    ;WITH EM (EvalModeID, EvalModeName)
    AS
    SELECT *
       FROM
           (VALUES 
               (1, 'Check on Change: Prevent'),
               (2, 'Check on Change: Log'),
               (4, 'Check on Schedule')) AS EvalModes (EvalModeID, EvalModeName)
    )
    , FEM (FacetID, FacetName, EvaluationMode, IsSupported)
    AS
    SELECT
           pmf.management_facet_id
           , pmf.name
           , EM.EvalModeName
           ,
       FROM msdb.dbo.syspolicy_management_facets AS pmf
           INNER JOIN EM ON pmf.execution_mode & EM.EvalModeID = EM.EvalModeID
    )
    SELECT FacetID
       , FacetName
       , [Check on Change: Prevent]
       , [Check on Change: Log]
       , [Check on Schedule]
    FROM FEM
    PIVOT 
    COUNT(IsSupported)
       FOR EvaluationMode IN ([Check on Change: Prevent], [Check on Change: Log], [Check on Schedule])
    )AS FEMP
    ORDER BY FacetName

    The results for the existing 72 facets are as follows:

    FacetID

    FacetName

    Check on Change: Prevent

    Check on Change: Log

    Check on Schedule

    1

    ApplicationRole

    1

    1

    1

    2

    AsymmetricKey

    1

    1

    1

    3

    Audit

    0

    0

    1

    4

    BackupDevice

    0

    0

    1

    5

    BrokerPriority

    0

    0

    1

    6

    BrokerService

    0

    0

    1

    7

    Certificate

    0

    0

    1

    8

    Credential

    0

    0

    1

    9

    CryptographicProvider

    0

    0

    1

    10

    Database

    0

    0

    1

    11

    DatabaseAuditSpecification

    0

    0

    1

    12

    DatabaseDdlTrigger

    0

    0

    1

    13

    DatabaseRole

    1

    1

    1

    14

    DataFile

    0

    0

    1

    15

    Default

    0

    0

    1

    16

    Endpoint

    1

    1

    1

    17

    FileGroup

    0

    0

    1

    18

    FullTextCatalog

    0

    0

    1

    19

    FullTextIndex

    0

    0

    1

    20

    FullTextStopList

    0

    0

    1

    21

    IDatabaseMaintenanceFacet

    0

    0

    1

    22

    IDatabaseOptions

    0

    1

    1

    23

    IDatabasePerformanceFacet

    0

    0

    1

    24

    IDatabaseSecurityFacet

    0

    0

    1

    25

    ILoginOptions

    1

    1

    1

    26

    IMultipartNameFacet

    1

    1

    1

    27

    INameFacet

    0

    0

    1

    31

    Index

    0

    0

    1

    32

    IServerAuditFacet

    0

    0

    1

    33

    IServerConfigurationFacet

    0

    1

    1

    34