37
October 11-14, Seattle, WA Evaluate your Daily Checklist against 100+ instances of SQL Server while you get a cup of coffee http://johnsterrett.com/go/dailychecklist John Sterrett Senior DBA Remote DBA Experts

Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

Embed Size (px)

DESCRIPTION

Session given at the Professional Association of SQL Server Professionals.

Citation preview

Page 1: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

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

Page 2: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

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

Page 3: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

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)

Page 4: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

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

Page 5: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

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

Page 6: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

6

Do you have a daily checklist?

46%

54%

YesNo

DBA-216| Evaluate Daily Checklist with PBM and CMS

Page 7: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

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

Page 8: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

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

Page 9: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

9

Job Notifications…..

DBA-216| Evaluate Daily Checklist with PBM and CMS

Page 10: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

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

Page 11: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

11

I prefer notifications

DBA-216| Evaluate Daily Checklist with PBM and CMS

Page 12: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

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

Page 13: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

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

Page 14: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

14

PBM Concepts and Terms

• Targets • facets• conditions• policy• categories• server restrictions

DBA-216| Evaluate Daily Checklist with PBM and CMS

Page 15: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

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

Page 16: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

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

Page 17: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

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

Page 18: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

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

Page 19: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

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

Page 20: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

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

Page 21: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

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

Page 22: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

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

Page 23: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

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

Page 24: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

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

Page 25: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

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

Page 26: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

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

Page 27: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

28

First look at CMS

DBA-216| Evaluate Daily Checklist with PBM and CMS

Page 28: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

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

Page 29: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

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

Page 30: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

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

Page 31: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

32DBA-216| Evaluate Daily Checklist with PBM and CMS

Page 32: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

33

Aaron Nelson – SQL University PowerShell Week

DBA-216| Evaluate Daily Checklist with PBM and CMS

Page 33: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

34

DEMO!

Automate CMS with PowerShell

DBA-216| Evaluate Daily Checklist with PBM and CMS

Page 34: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

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

Page 35: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

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

Page 36: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

October 11-14, Seattle, WA

Thank youfor attending this session and the 2011 PASS Summit in Seattle

Page 37: Evaluating Daily Checklist Against 1000 Servers using Policy Based Management

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