Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
Windows Server

SQL Server 2008 R2 : Implementing Policy-Based Management (part 1) - Creating a Condition Based on a Facet, Creating a Policy

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
8/6/2012 6:16:59 PM
Now that you understand the basic purpose and concepts behind Policy Based Management, let’s look at how to administer Policy-Based Management, then how to apply it to a server, and then a group of servers.

There are essentially six steps to implementing and administering Policy-Based Management:

  • Creating a condition based on a facet

  • Creating a policy based on that condition

  • Creating a category

  • Creating a Central Management Server

  • Subscribing to a category

  • Exporting or importing a policy

Let’s look at each of these steps in turn. The upcoming sections explain each step in its entirety.

Creating a Condition Based on a Facet

When you are creating conditions, the general principle includes three elements: selecting a property, an operator, and then a value. The following example walks through the steps to create a condition based on a facet which will enforce a naming standard on a table:

1.
To create a condition, connect to a SQL Server 2008 instance on which you want to create a policy.

2.
Launch SQL Server Management Studio (SSMS). In Object Explorer, expand the Management folder, expand the Policy Management folder, and then expand the Facets folder.

3.
Within the Facets folder, browse to the desired facet on which you want to create the policy (in this case, the Table facet).

4.
To invoke the Create New Condition window, right-click the facet and select New Condition.

5.
In the Create New Condition dialog, type a name for the condition (for example, Table Name Convention) and ensure that the facet selected is correct.

6.
In the Expression section, perform the following tasks:

a. Select the property on which you want to create your condition. For this example, use the @Name property.

b. In the Operator drop-down box, select the NOT LIKE operator.

c. In the value text box, enter 'tbl%'.

7.
Repeat step 6 for any additional expressions. For this example, the following expressions were entered, as displayed in Figure 1.

AndOrFieldOperatorValue
 @NameNOT LIKE'tbl%'
ANDLen(@Name)<=50
AND@NameNOT LIKE'%s'

Figure 1. Creating a condition based on a facet.

8.
Click OK to finalize the creation of the condition. You may have to click on the Field text box again for the OK button to be enabled.

Note

You can create conditions that query Windows Management Instrumentation (WMI) (using the ExecuteWSQL function) or SQL Server (using the ExecuteSQL function). For example, you can create conditions to check on available disk space or number of processors on the server. WMI allows you to issue SQL-like queries against management objects, which can return information on the physical machine hosting SQL Server and configuration and performance information, which is not accessible from within SQL Server itself.


Creating a Policy

After creating the condition or conditions, you need to create the policy. The policy is a standard that can be enforced on one or more SQL Server instances, systems, server objects, databases, or database objects. Follow these steps to create a policy with SQL Server Management Studio:

1.
In Object Explorer, expand the Management folder, expand the Policy Management folder, and then click on Policies.

2.
Right-click on the Policies folder and select New Policy.

3.
On the General tab of the Create New Policy dialog, enter a name for the new policy, such as Check Table Naming Conventions.

4.
In the Check Condition drop-down box, select a condition, such as the one created in the previous example, or select New to generate a new condition from scratch.

5.
The Against Targets section indicates which objects the policy should be evaluated against. For example, you could create a new condition that applies to a specific database, all databases, a specific table, all tables, or to databases created after a specific date. In the Action Targets section, indicate which targets this condition should apply to.

6.
Specify the Evaluation Mode by selecting one of the options in the drop-down menu. The options include On Demand, On Schedule, On Change Log Only, and On Change Prevent.

Note

If On Schedule is selected for the Evaluation Mode, specify a schedule from the predefined list or enter a new schedule.

7.
The final drop-down box is Server Restriction. You can restrict which servers you do not want the policy to be evaluated against or enforced on by creating a server condition. Create a server restriction or leave the default setting None. An example of the policy settings for checking table name conventions is displayed in Figure 2.

Figure 2. The Create New Policy dialog.

8.
Before you close the Create New Policy dialog, ensure that the policy is enabled (the Enabled check box is selected) and then click on the Description page. The Description page allows you to categorize your policy, but it also allows you to display a custom text message when a policy is violated and a hyperlink where the DBA/developer can go for more information about the policy.

9.
Click OK to finalize the creation of the new policy.

An Alternative to Creating Policies

As you can imagine, for complex policies you might need to create many conditions. In some cases it may be easier to create a table, database, or server configured to conform to the policy you want to create and then right-click on the specific object and select Facets. This brings up the View Facets page. Click on the Export Current State as Policy button. This exports a policy and a single condition to which the existing object will conform.

Figure 3 illustrates the dialog that prompts you for a name for your policy and condition as well as where you want to store the policy. You can store it in the file system and then import it to a Central Management Server or other servers where you want the policy to be evaluated, or you can import it directly to a server. Note that this policy will contain conditions specific to the object you use as a template; for example, if you use the AdventureWorks2008 database, the policy will test for the condition where the database name is equal to AdventureWorks2008. For this feature to be useful, you likely need to edit the conditions to ensure that they are generic and evaluate exceptions correctly.

Figure 3. Exporting a policy based on an existing object.
Other -----------------
- SQL Server 2008 R2 : Policy-Based Management Concepts
- Active Directory Domain Services 2008 : Add Attributes to Global Catalog Replication, Remove Attributes from Global Catalog Replication
- Active Directory Domain Services 2008 : Add Attributes to Ambiguous Name Resolution Filter, Remove Attributes from Ambiguous Name Resolution Filter
- Windows Server 2003 : Software Update Services (part 2) - The Automatic Updates Client, Configuring Automatic Updates Through Group Policy
- Windows Server 2003 : Software Update Services (part 1) - Configuring and Administering SUS
- Microsoft SQL Server 2008 R2 : Physical server design - Memory configuration
- Microsoft SQL Server 2008 R2 : Physical server design - CPU architecture
- Virtualizing Exchange Server 2010 : Benefits of Virtualization, Virtualization Requirements
- Virtualizing Exchange Server 2010 : Virtualization Overview
- Microsoft SQL Server 2008 R2 : Installing SQL Server Clustering (part 3) - Failure of a Node, The Connection Test Program for a SQL Server Cluster
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
 
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server