Wednesday 20 November 2013

SQL SERVER - Notes 9

65. What is E-R Diagram ?
       An E-R Diagram is a graphical representation of  the inter relationship between the Entities in a database. Table is an Entity  ex: Employee table is an Entity

      An E-R Diagram Consists of an Following Elements.
      1. Entities      [Table   i.e Employee]  
      2. Attributes  [Columns i.e Employeeid,Name,Salary]
      3. Relationships [relationship between two tables]  , i.e three types One-One,One-Many,Many-Many

       One-One :  Person table - Passport table
       One - Many : Student - Subjects
       Many - Many : Customer - Order

66. What is Policy Based Management [PBM] ?
      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.

67. How To CREATE Policy Based Management ?
      In Our example we are going to create a policy that function that create in db must be starts with name udf_.

       step 1. expand the Policy Based Management      
       step 2. Right click Condition and create a new condition
       step 3. specify the condition name and select facet as UserDefiendFunction as our sample 
       step 4: In the grid sepcify the Attribute 
                   Field : @Name
                   Operator: Like
                    Value : 'UDF_%'
      Step 5: click Ok.
      Step 6. Right Click the Policy and create a new Policy
      Step 7: Give a name for the policy and select the condition present in combo and select Evaluation                             Mode: Change:Prevent
      Step 8: Enable the Policy and Click Ok.



No comments:

Post a Comment