Thursday, March 21, 2013

SQL in Chicago

Hello Dear Reader!  I've got some very exciting news!  Pragmatic Works is holding a Two Day Performance Tuning Workshop in Chicago Illinois on Wednesday April 3rd and Thursday April 4th.  Headlining this act will be the wonderful Kimberly Hathaway(Linked-In), and lil old me!

I was born and lived most of my young life in Peoria Illinois.  The last time I was in Chicago was for a field trip to the Museum of Natural History, aka the Field Museum, with my Boy Scout Troop.  I was one of the Boy Scouts and it wasn't a reunion.

Chicago is home to some of the best resturants in the country, a main spot on shows like Man vs. Food, Diners Drive-Ins' and Dives, and Anthony Bourdain have made multiple episodes on the Windy City.

I've grown up a life long Cubs fan who has watched them in Atlanta, Washington D.C., and Miami, never in the Mecca of Wrigley Field.  Sadly the Cubs are out of town, heck even the Wrigley Field tours don't start until the week after I'm gone. I'm still hoping to stop by Wrigley and at least get a photo.

"So Balls", you say, "There was a Performance Tuning Workshop?"

Thank You Dear Reader.  My love for Chi-Town aside, I cannot wait for this workshop.  Kimberly and I are going to working very hard for you Dear Attendee, to make sure that in two days we can paint a picture and bring a lot of complex topics home.  Here's a link to the class if you're in town and would like to sign up (Some changes are coming to the outline, content will stay the same, but the flow will be streamlined)!   We are already 75% sold out, and space has been filling up fast. Space is limited so get your seat while you still can!


A lot of the problems I see in servers deal with them not being set up correctly.  Most of the time it is a simple oversight.  When troubleshooting there are things that we will check for, and some of them are simple fixes.

Did you use SQLIO to baseline you're hard drives?  Did you take a perfmon baseline?  Do you know the correct calculations for PLE? Cough cough *hint*!  What about the best ways to set up and things to consider when using Virtualization?  Are your BIOS driver's up to date?  Do you have Green Driver Settings on, what is your Windows Performance Plan set to? All this and we haven't even installed SQL Server!

Our Configuration are only just beginning.  Once we install SQL Server there is more to do.  Have we set up Instant Database File Initialization, based on our security can we?   Max Memory, Lock Pages in memory, Max Worker Threads, Maxdop, Cost Threshold for Parallelism, and many other settings need to be considered.  We will cover each of these and what the best practices are for each.

Next up we will cover the Internals of how a Query flows through SQL Server.  We'll discuss the Optimizer, Statistics, and plan costing before diving into the Plan Cache and Execution plans.  We'll round things out by a full discussion on Indexes and end the day with a dive into Locking/Blocking and Deadlocks.


Anybody can run a DMV, (anybody with the right permissions on a SQL Instance that is).  Interpreting the results is what turns Troubleshooting into Sharpshooting.

To fine tune the process we will cover Waits and Queues, making sure we understand Preemptive vs. Cooperative Processing and how that helps us get Wait Stats.  We'll troubleshoot various types and discuss what we've seen.

We'll go back to our Baselines and talk about what to look for when things go south and how to start diving into the problem.  We'll use Extended Events to single out specific data and show how you can use them and powerful tools in your arsenal.

We will discuss some of the free tools, our SQL Community, and of course #SQLHelp.

We'll step into the BI world to discuss some performance issues you will see there, and how to troubleshoot them as well. Finally we'll get a hands on lab that we can all really get into.


One of the best things about the class?  When you get one of us from Pragmatic Works you get the whole crew. ( I call dips on being Nick Fury)

They might not be there in the class with us but great SQL Community members and teammates SQL MVP's Jorge  Segarra (@SQLChicken | Blog) and Jason Strate (@StrateSQL | Blog), .

Former Microsof-ties like Kathi Kellenberger (@AuntKathi | Blog) and Roger Wolter (@rwolter50 | Linked-In).

Finally Tremendous Sr. Consultants for Pragmatic works such as  Gareth Swanepoel (@GarethSwan | Blog), Chad Churchwell (@ChadChurchwell | Blog), Kimberly, and myself all had are input on the class and worked on making the demos.

For $300 it's a can't miss!  Hope to see you there! (Click Here to Sign Up while Seats are still available!)

As always Thanks for stopping by!



Wednesday, February 20, 2013

Windows 2012 for the DBA Setting Your Server to High Performance

Hello Dear Reader!  I’ve been doing a lot of work with Windows Server 2012 lately.  The interface is wildly different from what we’ve gotten used to in the past.  

If you’ve worked with Windows 8 or Windows Phone at all, then the UI will come as less of a shock to you. 

 If you haven’t, then hold on to your pants.

This creates a lot of fun in figuring out how to do things we already thought we knew how to do.

“So Balls”, you say, “What did you know how to do that you don’t now know how to do?  Did that even make sense?”

Yes Dear Reader it did.  Ever since the Windows Servers have been given the same GUI upgrades as the user/Windows upgrades (Thank GOD there was no Windows Server ME), ever since Perfmon has been renamed 50 BAGILLION times, there have been DBA’s scratching their heads going ARRUUU!?

Continuing that trend is the way CPU performance is handled.  

Thanks to brilliant MVP’s such as Glenn Berry(@GlennAlanBerry | Blog) and Brent Ozar (@BrentO | Blog) we’ve had guidance on how to use CPU-Z, see Glenn’s Blog on this subject, and how Power Saving Options are bad, see Brent’s Blog on the subject

Now we have Window’s Server 2012 and we know we should check our power saving options, and we should use CPU-Z.  When we get a bad reading how do we change it?


There is a Windows 2012 Performance Tuning document that is worth a read, Click here to download the Word Doc.  If you have owned a laptop in the past 5 years with Windows Vista on up on it you are familiar with the power management plans.  Interestingly enough, or not based on your viewpoint, this is in Windows 2012 as well.   Below is an exert from the Document


Common applicable scenarios
Implementation highlights
Balanced (recommended)
Default setting. Targets good energy efficiency with minimal performance impact.
·         General computing
Matches capacity to demand. Energy-saving features balance power and performance.
High Performance
Increases performance at the cost of high energy consumption. Power and thermal limitations, operating expenses, and reliability considerations apply.
·         Low latency applications
·         Application code that is sensitive to processor performance changes
Processors are always locked at the highest performance state (including “turbo” frequencies). All cores are unparked.
Power Saver
Limits performance to save energy and reduce operating cost.
·         Deployments with limited power budgets
·         Thermal constraints
Caps processor frequency at a percentage of maximum (if supported), and enables other energy-saving features.

Dear Reader I’m going to tell you right now, Balanced is not recommended.  High Performance is.  If you’re not sure why go read Glenn and Brent’s blogs about Green options and how they will hinder your CPU performance.

Now don’t get me wrong I’m all about the environment, I love me some outside, but when I have a server in a rack the only option for me is High Performance.  

The fact that Balanced is the DEFAULT is a HUGE MISTAKE in my opinion.  If you know how to find and change your power settings, have done the due diligence to understand what your usage consumption is vs. your peak hours, and care about the cost of your data center to the point that this matters, then change it.  Also stop reading here.

If like most of us you have a DAY job, get really busy, and expect your server to perform with the power and performance you purchased it at, then keep reading.

I used CPU-Z to find a couple of facts out right away.  

My server with 24 cores each running at 2.5 GHZ is running at 1.1 GHZ.  YIKES!  That’s ½ of this expensive box that we paid for.  So now I’m going to open up a Command Prompt in Administrator Mode. 

To do this go to the upper right hand corner, get the Spy Glass Icon, and type cmd, Right Click on the Icon instead of Clicking on it, and then click the option at the bottom of the screen that says Run As Administrator. (You can also pin this to the start tiles window, but one thing at a time).

Now in our Command Prompt type powercfg –LIST to see all of the active plans.  Your currently selected plan will be denoted with an *.

We can see that Balanced is currently select, as this is the default out of the box configuration.  So let’s change this.  Make note of the GUID above because you’re going to need it.  The command is powercfg –SETACTIVE <guidoftheplanyouwant>.

We run another powercfg –LIST to check our options and we see that High Performance is now our default.   Another look at CPU-Z and everything looks right as rain.


For more on this subject Dear Reader, visit the Windows Technet site on How to Set the Default Power Plan for Windows 2012 by clicking here

As for Windows Server 2012 I must profess, despite the out of the box options, I like it.  Always on is more stable, It reads ISO files without a 3rd party installer, and while the interface is different I’ve been able to find a lot of configuration items that were previously in hard to reach places.  Basically more blogs to come.

As Always Dear Reader Thanks for Stopping by and I hope this helps you get the most out of your server!



Thursday, January 24, 2013

I'm an Administrator Why Can't I Copy Files

Hello Dear Reader!  I've been working on setting up a virtual environment for quite some time. When last I wrote about it, I described issues I was having due to cloning the same server that I had set up as my Domain Controller, Dude Where Did my AD Account Go? Troubleshooting Duplicate SID’s. 

Well I’ve gotten further down the road and today I was setting up some new servers to do some work with Availability Groups.  The Servers were cloned, SID’s were different from the Domain Controller, I renamed the servers, added them to the domain, set up my additional hard drives, and started copying over SQL Server files for the installation.  Then I get this error.

“So Balls”, you say, “did you remember to add your domain account as a Local Admin?”

Excellent question Dear Reader, you’re on your game today!  I did.  I even logged on as the local server’s Administrator and double check that my account was listed in the Administrators group.

Initially the way I had gotten around this error was by logging in as the Local Server Administrator.  I found that account had all the correct permissions.  This wasn’t a satisfying resolution.  If I didn’t have access to copy files, what else was I missing?  Would this cause an issue with my SQL Installation?

Help me help You Windows!  HELP ME HELP YOU!

I was stumped, so I turned to the Intrawebs.  Google/Binging the error message got me some results.   The first couple links didn’t help.  Then I came across a message board from the Windows Server forums, Destination Folder Access Denied – Copying file to root of C:\.

I wasn’t trying to access my C:\ but these steps worked for me.  I’m going to detail out the same steps that Rick Tan did in the forum post.

First open up run and type in gpedit.msc to open the Group Policy Manager.

Next expand the tree by Windows Settings | Security Settings | Local Policies | Security Options.  Scroll to the bottom we are looking for Policies that begin with User Account Control.   First up User Account Control: Behavior of the elevation prompt for administrators.    

You may not want to disable this on your server at work, but these are my VM’s.  I’ve given my account Server Admin level access.  I don’t want to have to answer a prompt every time I need to do Administrative things.  We want to set this to elevate without prompting.

Click OK and let’s move on to our next one.  User Account Control: Detect application installations and prompt for elevation.  Okay I’m an Admin.  I’m going to install things on my server.  Otherwise this account wouldn’t be an Admin.  Let’s disable this, I don’t want to be prompted with “are you sure?” every time I try to install something.

Click okay and now onto User Account Control:  Run all administrators in Admin Approval Mode.  Seriously?  How many times do I need to say I’m sure this Admin account is an Admin?

Click Disabled and OK.  So once we change these policies you no longer get the annoying ARE YOU SURE, ARE YOU SURE?, ARE YOU SURE?,prompts.  Sometimes you just want to yell!  I’m an Administrator, I granted this account Admin access.  YES! IT’S A F#(%ING ADMIN!

“So Balls,” you say, “You okay there?”

Sorry Dear Reader, redundant security frustrates me.  The steps worked for me though.  When I try to copy over SP1 for SQL 2012 it succeeds.  Refreshingly enough, I don't get prompted to ensure I wanted to really run the item I double clicked on.  What a wonderful world.

For these settings to take affect a reboot will be required.  So now it's time to sit back, and enjoy a pop up free world.  As always Dear Reader, Thanks for stopping by!