Thursday 23 June 2016

Create a Policy Based Management in SQL SERVER

 In This post we are going to see how to create a policy based management in SQL SERVER. 


In Our example we are going to see what is policy based management and how to  create a policy that function will create in db must be starts with name udf_.

Policy Based Management is a new feature in SQL Server 2008 that enables database administrators to  create and enforce policies to configure and manage SQL SERVER. A policy is a Rule that specifies a certain conditions to be evaluated against a managed Target.

       Following are the basic terms in PBM
      1. Managed Target
      2. Facet
      3. Condition
      4. Policy
      5. Policy Category
      6. Effective Policy


     Managed Target : A Managed Target is an Entity on which you want to apply policy. Ex Sql Server instance,                                Schema, Database etc.     

     Facet :  Facet is set of properties that model the behavior and characteristics of a managed target.

    Condition : A condition is a one or more clauses that specify properties of a facet.  

    Policy : A Policy contains the condition that specifies how to set the properties of the facet of a managed                       target.

    Policy Category : we can group the policy into different policy types known as policy categories.A policy can                                be belong to only one category. we can create policy categories at server level or database                                level.
   
    Effective Policy :  A Policy is considered to be effective policy if:
     1. Policy is Enabled
     2. The managed target belongs to the set of managed targets targeted by the policy.
     3. The managed target or one of its ancestors subscribes to the policy category that contains the policy.




How to Create the Policy 
*********************************************

        1. Expand the Policy Based Management      

        2. Right click Condition and create a new condition

       3. specify the condition name and select facet as UserDefiendFunction as our sample 

       4. In the grid sepcify the Attribute 
                   Field : @Name
                   Operator: Like
                    Value : 'UDF_%'

       5. click Ok.

       6. Right Click the Policy and create a new Policy

       7. Give a name for the policy and select the condition present in combo 

       8. Select Evaluation Mode: Change:Prevent

       9. Enable the Policy and Click Ok. 



From this post you can learn what is Policy based Management and how to create it in SQL SERVER 







No comments:

Post a Comment