do more with less: sql central management server and multi-server administration

36
Do More With Less: Inside SQL Central Management Server and Multi-Server Administration

Upload: mike-hillwig

Post on 31-Jul-2015

758 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Do More With Less: SQL Central Management Server and Multi-Server Administration

Do More With Less:

Inside SQL Central Management Server and Multi-Server Administration

Page 2: Do More With Less: SQL Central Management Server and Multi-Server Administration

Mike Hillwig

SQL Server DBA Working with SQL Server since SQL 7 Resume includes Acme Packet Oracle, Shawmut Design and Construction,

Equitable Resources, Weirton Steel

Page 3: Do More With Less: SQL Central Management Server and Multi-Server Administration
Page 4: Do More With Less: SQL Central Management Server and Multi-Server Administration

Mike Hillwig

Owned by Two Pugs Avid Cook Lover of Blue Cheese And Bacon Geek at Heart

Page 5: Do More With Less: SQL Central Management Server and Multi-Server Administration

Obligatory Social Networking Slide

mikehillwig.com sqlserverpedia.com twitter.com/mikehillwig anysocialnetworkingsite/mikehillwig

Page 6: Do More With Less: SQL Central Management Server and Multi-Server Administration

Housekeeping

Don’t let me talk too fast. Blog post at mikehillwig.com/go/domore Please send feedback to [email protected]

Page 7: Do More With Less: SQL Central Management Server and Multi-Server Administration

April 18, 2015Microsoft, Cambridge, MA

Page 8: Do More With Less: SQL Central Management Server and Multi-Server Administration

Beware of the Blogs

There is some amazing advice out there. But…

Anybody can put bad advice on the internet

Trust people you know

Assume I’m an idiot I don’t trust people who say

“ALWAYS” or “NEVER” Test everything in your own test

environment first.

Page 9: Do More With Less: SQL Central Management Server and Multi-Server Administration

Before I start…

This crowd scares the crap out of me. Seriously. You’re one of the most technical user groups I’ve ever seen.

Page 10: Do More With Less: SQL Central Management Server and Multi-Server Administration

With that said…

This is a new topic for me. Your feedback is incredibly important [email protected]

Page 11: Do More With Less: SQL Central Management Server and Multi-Server Administration

Slides and Blog Post

mikehillwig.com/go/domore

Page 12: Do More With Less: SQL Central Management Server and Multi-Server Administration

Tonight’s Topics

Central Management Server SQL Agent Multi Server Administration

Page 13: Do More With Less: SQL Central Management Server and Multi-Server Administration

Central Management Server

Catalog of Servers Allows you to synchronously query multiple servers

Page 14: Do More With Less: SQL Central Management Server and Multi-Server Administration

SQL Agent Multi Server

Centralize your SQL Agent Jobs It’s a Master/Target relationship for the SQL Agent

Page 15: Do More With Less: SQL Central Management Server and Multi-Server Administration

LET’S DIG IN

Page 16: Do More With Less: SQL Central Management Server and Multi-Server Administration

About My Infrastructure

Using a single VM named SLATE with seven instances You wouldn’t do that. These tools require AD authentication. I’m too lazy to configure a domain controller

Page 17: Do More With Less: SQL Central Management Server and Multi-Server Administration

Seven Instances

Fred Wilma Barney Betty Pebbles BamBam Bedrock

Page 18: Do More With Less: SQL Central Management Server and Multi-Server Administration

Central Management Server

It’s a catalog of servers Allows you to break your servers into categories There is nothing fancy about this technology Yet it’s a great time saver The tool you won’t appreciate until you really need it Allows you to query multiple servers synchronously at once…

without PowerShell.

Page 19: Do More With Less: SQL Central Management Server and Multi-Server Administration

Why would I Use this?

Audits (Getting lists of things on multiple servers) Deployments Security functions

Creating logins Disabling logins

Anything that you need to run on multiple servers

Page 20: Do More With Less: SQL Central Management Server and Multi-Server Administration

Demo

Page 21: Do More With Less: SQL Central Management Server and Multi-Server Administration

Important Tables

sysmanagement_shared_server_groups Contains the groups/folders

sysmanagement_shared_registered_servers Contains the servers we’ve registered.

Page 22: Do More With Less: SQL Central Management Server and Multi-Server Administration

Important Procedures

sp_sysmanagement_add_shared_server_group Adds a new group/folder

sp_sysmanagement_add_shared_registered_server Adds a new server to a group

Page 23: Do More With Less: SQL Central Management Server and Multi-Server Administration

A Note on Connectivity

The Central Management Server is just the catalog. The machine where you’re running SSMS makes the

connections to each server. If your machine can’t see a server, your connection will fail.

Page 24: Do More With Less: SQL Central Management Server and Multi-Server Administration

A Note on Security

Unless you specifically configure it to use SQL authentication, AD authentication will use YOUR login and not the server’s service account.

Page 25: Do More With Less: SQL Central Management Server and Multi-Server Administration

One more thing…

Your statements and scripts will run synchronously Do NOT expect your results to come back in a specific order The order of results appears to be the order of completion

Page 26: Do More With Less: SQL Central Management Server and Multi-Server Administration

Multi-Server Administration

Incredibly cool Incredibly powerful The most unsexy technology to come out of Redmond since

Microsoft Bob Has a few quirks Does have a few serious caveats Caveats do have workarounds

Page 27: Do More With Less: SQL Central Management Server and Multi-Server Administration

Benefits

Allows you to keep consistency with SQL Agent jobs across multiple servers

It’s a huge time saver when you need to change a script that you regularly run in your environment, such as backup scripts or index/statistics maintenance

When a job is deployed from the master server to targets, they are locked on the target. This enforces consistency.

Page 28: Do More With Less: SQL Central Management Server and Multi-Server Administration

Pitfalls

It can be quirky Be careful with security It’s a complete culture shift When you push a job to target servers, it pushes all of the

properties, including the schedules. Be careful with IO-intensive jobs!

Page 29: Do More With Less: SQL Central Management Server and Multi-Server Administration

Turning That Around

You can still deploy the job without a schedule Then create a job that uses msdb.dbo.sp_start_job This allows you to leverage the benefits of a centrally

managed server while using the schedule of a local job

Page 30: Do More With Less: SQL Central Management Server and Multi-Server Administration

Demo

Page 31: Do More With Less: SQL Central Management Server and Multi-Server Administration

Notable Tables

sysjobs – All of the jobs you have defined, both local and Multi-Server Jobs

systargetservers – Shows all of your target servers sysjobservers – Shows what jobs are deployed to what

servers

Page 32: Do More With Less: SQL Central Management Server and Multi-Server Administration

Notable Procedures

sp_help_targetserver – Run from the master, shows all of your target servers Status of 5 means you have a process that is preventing you from

downloading instructions Shows much of the data in systargetservers

Page 33: Do More With Less: SQL Central Management Server and Multi-Server Administration

A Note on Connectivity

This uses the connectivity between servers, not your machine’s connectivity

The pushing of SQL Agent job updates is done on a regularly scheduled polling process

Page 34: Do More With Less: SQL Central Management Server and Multi-Server Administration

A Note on Security

Be very careful with security on this If you do this wrong, you could set yourself up for issues If users can manage SQL Agent jobs on your master servers,

they can deploy jobs to your target server, even if they don’t have access to that server

Jobs on the target run in the context of the target server’s service account

If you have segregation of duty issues, be very careful who you give access to your master server

Page 35: Do More With Less: SQL Central Management Server and Multi-Server Administration

Wrapping Up

CMS and MSX are very different technologies Different capabilities Different use cases Combining the two gives you a great set of tools

Page 36: Do More With Less: SQL Central Management Server and Multi-Server Administration

One more thing…

Neither CMS and MSX allow the main server to manage themselves

Put both of these tools on an independent box