You need to enforce rules in your SQL Server environment? You need to strictly monitor who breaks or tries to break them? If so, you need Policy-based Management! Learn how this technology can help your resolve many of your problems!
2. Our agenda
• What is it? Policy – based management?
• How does this all work?
• What is coming?
• Case Study: SQL Server Health Checks
• Thank you!
2
4. What is PBM?
Way to define rules
SQL Server 2008/R2/2012 Feature
Express Edition and higher
(in Express – Limited functionality)
Can be used against 2000 and 2005
… kind of
4
9. Advanced policies
ExecuteSql(‘Numeric’, ‘SELECT COUNT(*) FROM
sys.databases’)
http://msdn.microsoft.com/en-us/library/ms188001.aspx
Script as a condition!
ExecuteWql
('String', 'rootCIMV2',
'SELECT State
FROM Win32_Service
WHERE Name = "SQLAgent$SECOND"')
http://msdn.microsoft.com/en-us/library/bb895209.aspx
9
12. syspolicy_policy_categorie
Views s
syspolicy_policy_category_subscription
s
syspolicy_object_se
syspolicy_policies ts
syspolicy_target_set
s
syspolicy_policy_execution_history
syspolicy_policy_execution_history_detail
s
syspolicy_conditions
syspolicy_system_health_stat
e
12
16. SQL Server 2012?
Availability Database
Availability Group
Availability Group State
8 new Facets Availability Replica
From 76 to 84 Database Replica State
Search Property List
Sequence
Server Role
16
How does it work? – Facets, Conditions, Policies, Demos, CMSEPM – Enterprise policy based management frameworkWhat is coming – Denali + Azure
Brent Ozar:TEST - PASS OR FAIL
Limited functionality – CMS, on-demand only (no Agent in Express)No all facets are available for all versions. No all features are available in all version, so test! In 2000 – no DDL triggers! On change prevent – does not work! EPM – Стъпва на SQL Server, Reporting Services, MDW and Powershell (and policy-based management)
On change – log – only if an event is generated! On prevent – only AFTER trigger! The example of index rebuild! The trigger fires after finished :D DDL Trigger
Auto close will be deprecated!
Execution modeMessage numberOn change: prevent (if automatic) 34050On change: prevent (if On demand) 34051 On schedule 34052On change 34053
Count the suspect pages – executeSQLCheck the freespace on the drive WQLCheck if a counter is below a threshold or a data file has slow response time (in ms!)
How to add the instance that is the Central server to the monitored -> check donev’s blog!
MSDB - backup, SPs! Queries
On-change: prevent mode will fail or perform unexpectedly.DDL triggersCDC and Transactional replication – systanschemas no indexes
Do the import of all policies -> C:\\Program Files (x86)\\Microsoft SQL Server\\110\\Tools\\PoliciesDatabase Backups and CMS – ADD the central to the tree. How? – Donev’s blog! Checking table names and preventing!
Only microsoft can add facets! Cannot fail over with the policies – server-based objects! CMS is for that! Availability Database – Exposes properies of the Availability Database objectApplicable Target Types: AvailabilityDatabaseAvailability Group – Exposes properies of the Availability Group objectApplicable Target Types: AvailabilityGroupAvailability Group State – Exposes properies of the Availability GroupApplicable Target Types: AvailabilityGroupAvailability Replica – Exposes properties of the Availability Replica object.Applicable Target Types: AvailabilityReplicaDatabase Replica State – Exposes the properties of physical database replicas participating in an availability group.Applicable Target Types: DatabaseReplicaStateSearch Property List – обвързано е с Full-text indexes. List от свойства, които да бъдат добавени във тези индекси.SELECT Document FROM Production.Document WHERE CONTAINS(PROPERTY(Document,'Title'), 'Maintenance OR Repair'); GO Sequence – http://www.sql-server-performance.com/2011/sequence-sql-server-2011/Server Role – Exposes properties of the ServerRoleobject.Applicable Target Types: ServerRole