Upload
john-sterrett
View
2.472
Download
0
Tags:
Embed Size (px)
DESCRIPTION
Session given at the Professional Association of SQL Server Professionals.
Citation preview
October 11-14, Seattle, WA
Evaluate your Daily Checklist against 100+ instances of SQL Server while you get a cup of coffeehttp://johnsterrett.com/go/dailychecklist
John SterrettSenior DBARemote DBA Experts
2
What we will cover…
• What should be included in your daily checklist
• Build Policy Based Management Policies• Import Policy Based Management Policies• Automate execution of daily checklist• Providing reporting solution for daily
checklist
DBA-216| Evaluate Daily Checklist with PBM and CMS
3
About Me….
DBA-216| Evaluate Daily Checklist with PBM and CMS
• I am a Remote DBA Expert • Responsible 100+ Instances of SQL Server• Senior DBA on Integration Team
• Founder of WVPASS (SQL User Group)• Mid-Atlantic Regional Mentor• Host SQL Saturday #36 & #80• I reside in Wheeling, WV (Pittsburgh, PA)
4
My Story….
Urgency
Importance
Backups / RestoresCorruptionFailed mission critical SQL Jobs
Process improvementsContinuing educationProjectsIndex ManagementPerformance Tuning
Pittsburgh Steelers winning the Super Bowl
Everything else…
Failed JobsLow Disk Space
Comes from The 7 Habits of Highly Effective People by Stephen R. Covey
DBA-216| Evaluate Daily Checklist with PBM and CMS
5
Daily Checklist Questions
Do you have a daily checklist?What is your daily checklist?• Full backups• Transactional Log backups• Free space• SQL Agents are enabled• SQL Agent jobs succeeded
How do you evaluate your daily checklist?• Central Management Server (CMS)• Policy Based Management (PBM)
DBA-216| Evaluate Daily Checklist with PBM and CMS
6
Do you have a daily checklist?
46%
54%
YesNo
DBA-216| Evaluate Daily Checklist with PBM and CMS
7
What's in your daily checklist?
20%
19%
17%
19%
11%
8%5% Full Backups
succeededTransactional log backups succeededSQL Services are running SQL Agent jobs succeededDisks have free spaceData and Log files have free spaceOther
DBA-216| Evaluate Daily Checklist with PBM and CMS
8
How do you evaluate your checklist?
0
5
10
15
20
25
3
97 7
21
3 2
How do you evaluate your daily checklist?
DBA-216| Evaluate Daily Checklist with PBM and CMS
9
Job Notifications…..
DBA-216| Evaluate Daily Checklist with PBM and CMS
10
Trust but verify…..
• Is the SQL Agent enabled for all servers?• Does email operator exist for all jobs?• Is the operator the same across all servers?• Is Database Mail enabled for all servers?
DBA-216| Evaluate Daily Checklist with PBM and CMS
11
I prefer notifications
DBA-216| Evaluate Daily Checklist with PBM and CMS
12
Policy Based Management
• Policy-Based Management is a system for managing one or more instances of SQL Server 2008 (* BOL).
• Some facets allow you to enforce standards with “On-Change – Prevent”
• Can import and export policies• Apply changes when evaluation fails• Policies can run against SQL 2000 & 2005
DBA-216| Evaluate Daily Checklist with PBM and CMS
13
I use PBM to do two things…
Prevent things from happening Apply changes Automate validation of checklists• Checklists are prone to human error.• Server configurations can change over time.
Daily checklist items we will validate• SQL Agent is enabled• SQL Agent Jobs• Full backups• Transactional Log backups• Free Space
DBA-216| Evaluate Daily Checklist with PBM and CMS
14
PBM Concepts and Terms
• Targets • facets• conditions• policy• categories• server restrictions
DBA-216| Evaluate Daily Checklist with PBM and CMS
15
PBM Example – Page Verify
Page VerifyPage Verify Policy
Database Target
Database Performance Facet
@PageVerify = true Condition
SQL Server 2005 or newer Server Restriction
On Schedule Evaluation Mode
http://www.littlekendra.com/2011/01/25/pageverify/
DBA-216| Evaluate Daily Checklist with PBM and CMS
16
Evaluation Modes
On Demand• Executed by user or powershell scriptsOn Schedule• Uses SQL Agent (Runs via powershell script)On Change – Prevent• Uses DDL Triggers• * Nested Triggers should be enabledOn Change – Log Only• uses event notificationFor More: http://msdn.microsoft.com/en-us/library/bb510667%28SQL.100%29.aspx
DBA-216| Evaluate Daily Checklist with PBM and CMS
17
On-Change Evaluation….
Not all facets support On-change.• On Change – Log (17)• On Change – Prevent (12)• Application Role • Asymmetric Key• Database Role• Endpoint• Login Options• Multipart Name
• Resource Pool• Schema• Stored Procedure• Table Options• User Defined Function• User Options• View Options• Workload Group
DBA-216| Evaluate Daily Checklist with PBM and CMS
18
Where can I find policies?
Best Practices• SQL Server 2008 Feature Packs• C:\Program Files\Microsoft SQL Server\100\Tools\
Policies\DatabaseEngine\1033
Interwebs• http://www.mssqltips.com/category.asp?catid=89• Blogs• Bing or Google
DBA-216| Evaluate Daily Checklist with PBM and CMS
19
Policy Alerts
Message Number Evaluation Mode
34050 On change – prevent when policies are enabled for automatic evaluation.
34051 On change – prevent when the policy is on demand
30452 On Schedule
34053 On change – Log
* On demand cannot be enabled so there are no alerts.
DBA-216| Evaluate Daily Checklist with PBM and CMS
20
PBM Views
Views in MSDB database and dbo schema• syspolicy_policies• syspolicy_conditions• syspolicy_system_health_state• syspolicy_categories• syspolicy_policy_category_subscriptions• syspolicy_policy_execution_history• syspolicy_policy_execution_history_details• syspolicy_object_sets• syspolicy_target_sets
For more: http://msdn.microsoft.com/en-us/library/bb510742.aspx
DBA-216| Evaluate Daily Checklist with PBM and CMS
21
PBM - ExecuteSQL
The ExecuteSql() function can be used against any facet and it'll be executed once for each target in the target set.
The proxy account is called ##MS_PolicyTsqlExecutionLogin## used for scheduled jobs
http://blogs.msdn.com/b/sqlpbm/archive/2008/07/03/executesql.aspx
DBA-216| Evaluate Daily Checklist with PBM and CMS
22
PBM Gotchas!
• Cannot modify or create facets• Policies fail to read mount points as
separate locations• ExecuteSQL only supports @ObjectName
and @SchemaName • Reporting is very limited out of the box• On Change-Prevent is limited• Best Practice Policies may not be best
practice for your shop.
DBA-216| Evaluate Daily Checklist with PBM and CMS
23
PBM Demo
Import PoliciesCreate a CategoryExport PoliciesCreate PolicyEvaluate Policy• On-Demand• Scheduled• Apply Policy Change
View Policy History
DBA-216| Evaluate Daily Checklist with PBM and CMS
24
Central Management Server (CMS)
Similar to local server group except it’s a repository for your team.Group database servers• Environment• Version• Location
Apply scripts or policies against all servers in a groupNot all checklist items can be validated with PBMCan use SQL Server 2008 R2 Express
DBA-216| Evaluate Daily Checklist with PBM and CMS
26
CMS Internals
MSDB is used to store servers and groupsServers – msdb.dbo.sysmanagement_shared_registered_servers_internal
Groups – msdb.dbo.sysmanagement_shared_server_groups_internal
DBA-216| Evaluate Daily Checklist with PBM and CMS
27
CMS Security
• ServerGroupAdministratorRole role can manage the central management server.
• ServerGroupReaderRole role is required to connect to a central management server.
• Windows Authentication of the individual servers is used to execute t-sql and policies.
DBA-216| Evaluate Daily Checklist with PBM and CMS
28
First look at CMS
DBA-216| Evaluate Daily Checklist with PBM and CMS
29
DEMO!
Create Configuration Management ServerCreate GroupsRegister ServersExecute scripts against a groupExecute policy against a group
DBA-216| Evaluate Daily Checklist with PBM and CMS
30
CMS Gotchas!
• CMS itself cannot automate query or policy execution.
• CMS only supports windows authentication
• Query results are ordered by server name• Cannot include host server (Unless you
use 127.0.0.1 or add port number)• Query executes for all listed servers.
(Includes duplicates)
DBA-216| Evaluate Daily Checklist with PBM and CMS
31
Reporting - EPM Framework
http://epmframework.codeplex.com/EPMF leverages• Central Management Server• Policy-Based Management• PowerShell• XML• SQL Server Reporting Services
DBA-216| Evaluate Daily Checklist with PBM and CMS
32DBA-216| Evaluate Daily Checklist with PBM and CMS
33
Aaron Nelson – SQL University PowerShell Week
DBA-216| Evaluate Daily Checklist with PBM and CMS
34
DEMO!
Automate CMS with PowerShell
DBA-216| Evaluate Daily Checklist with PBM and CMS
35
Where to go from here?
Automate a daily checklist!
Go to http://johnsterrett.com/go/dailychecklist for reference material and sample code.
Session Code | Session Title
36
Complete the Evaluation Form to Win!Win a Dell Mini Netbook – every day – just for submitting your completed form. Each session evaluation form represents a chance to win.
Pick up your evaluation form:• In each presentation room• Online on the PASS Summit website
Drop off your completed form:• Near the exit of each presentation room• At the Registration desk• Online on the PASS Summit website
Sponsored by Dell
Session Code | Session Title
October 11-14, Seattle, WA
Thank youfor attending this session and the 2011 PASS Summit in Seattle
38Session Code | Session Title
Microsoft SQL Server Clinic
Work through your technical issues with
SQL Server CSS & get architectural guidance
from SQLCAT
Microsoft Product Pavilion
Talk with Microsoft SQL Server & BI experts to learn about the next version of SQL Server and check out the new Database Consolidation
Appliance
Ask The Experts
@ Dev Pods
Meet Microsoft SQL Server Engineering team members &
SQL MVPs
Hands-on Labs
Get experienced through self-paced & instructor-led labs on our cloud based lab platform - bring your
laptop or use HP provided hardware
Room 611 Expo Hall 6th Floor Lobby Room 618-620