* CCTV - Closed Circuit Television. Widely used in UK (and for sure in many other parts of the globe) to monitor against social misbehavior.
Policy Manager
A policy manager is one important piece in the centralized administration puzzle. The general idea is to define a set of rules and have it enforced consistently for all related objects (servers, databases, tables, etc) you manage.
Databases, for example, let’s say you have a (sensible) rule that prohibits databases with Auto-shrink ON. How can you be sure that while you were enjoying your holidays the junior DBA didn’t enable it in a new database? Or as happened to me in the past, the setup of a third-party software configured it automatically.
That’s the goal of a police manager, ideally prevent breaking the standards or at least notify you when it happens. And that is what Microsoft promises for us in the next release of SQL Server, under the name of “Declarative Management Framework”.
In the next days, I am planning have a go on it and will post my impressions here.
So, let’s start by a little theory, there is a brave new world of new expressions and terms waiting for us in the Katmai, let’s look at some of them:
Terminology
Declarative Management Framework – Fancy name for the Policy manager.
DMF target – Any entity managed by a DMF policy, like instances, databases, tables, etc.
DMF facet – A group of related configurable parameters. Examples are: database facet, Linked Server Facet and Surface Area Facet.
DMF condition – A specific configuration created on top of a facet.
DMF policy – Defines how (execution mode) and where (possible targets) a defined condition will be applied
DMF policy group – A user defined group of policies that can be subscribed at once by a target. All targets subscribes to the default group, and you can create specific ones as you need.
DMF execution mode – When and how the policy should be enforced. Policies can be checked periodically (on schedule), at modification time (on change) or can be enforced at modification times. The last two isn’t available for all types of policy.
Effective policies – Are the set of policies active for a specified target.
Test drive
My first intention is to try the basics, i.e. test the feature on it’s most basic form, so let’s go:
1 – Add a condition:
The test will be to create a rule to enforce a naming standard, in this example I have decided that the name for our stored procedures should begin with "usp" (which stands for User Stored Procedure)
2 – Add a police:
Note that I have chosen to:
· Place the police under the default police group, so that I don’t need to take any additional step for it to be available on all databases on the server.
· enforce the police, this isn’t available for all conditions:
3 – Test it
After that encouraging error message, time to google. Didn’t took long to notice that I had omitted the following bugfix (pretty normal considering it is a CTP1):
C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\sn.exe -Vr Microsoft.SqlServer.DmfSqlClrWrapper,89845DCD8080CC91 followed by instance recycle (See: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1704822&SiteID=1 )
4 – Test again
This time at least I appears to be a “normal” error, this is the error that you should expect when you violate a police, but the error was raised even for the “good” procedure.
I turn out that I should not include quotes around the LIKE pattern.
5 –Test it AGAIN:
Success at last.
So, here we are, proud owners of a standardized database.