Category: Random

The Nature of Absurdity

The other night I was adjusting some quorum settings for the WSFC that was underlying a couple of AGs at work. Quorum needed fixing up as we were going to perform a site failover while some network switches were updated on the primary site, and I didn’t want to risk the potential of an outage should a WAN link go down between the primary DC and the DR DC. Fortunately PS makes this pretty simple, I just ensured that quorum would be maintained by the votes in the DR DC by removing them from a couple of machines in the primary DC:

(Get-ClusterNode -Name MySQLNode1).NodeWeight=0;

(Get-ClusterNode -Name MySQLNode2).NodeWeight=0;

 

And then checking the votes on the WSFC to ensure that the DR site would stay up no matter what:

Get-ClusterNode | ft Name, NodeWeight -auto

 

Then I failed over the AG, I could have used T-SQL to do this in SSMS or SQLCMD:

ALTER AVAILABILITY GROUP MyAG ON REPLICA = 'MyDrSQLNode3' WITH (AVAILABILITY_MODE = SYNCHRONOUS_COMMIT);

ALTER AVAILABILITY GROUP MyAG ON REPLICA = 'MyDrSQLNode3' WITH (FAILOVER_MODE = AUTOMATIC);

ALTER AVAILABILITY GROUP MyAG FAILOVER;

But I’ve written a GUI interface to do this sort of thing in C#. This provides our NOC the ability to perform failovers themselves so that they can apply Windows CUs without having to call someone up to failover. The C# originally used T-SQL under the covers, but I’ve changed it recently so that it uses SMO (although have had to work around an issue using T-SQL):

AvailabilityGroup.Failover();

 

The once the FEX and switch work was completed I added the votes back to the primary DC and failed everything back again.

 

It was while I was doing all this that I got to thinking about just how absurd all of this stuff is.

  • 20 years ago I would have laughed at the thought of all this random jargon and what it might mean
  • 15 years ago I would have laughed at the though of Microsoft creating a proper shell language, with them preferring dim heavy VBScript
  • 10 years ago I’d told you that you needed a disk quorum for your MSCS because otherwise you were going to have FCI problems with a machine was restarted
  • 5 years ago I’d have laughed at the idea of using AGs for production (that laughter has turned to tears many times)
  • 3 years ago the closest I would have gotten to C# would have been a tart orange
  • 2 years ago the concept of being a major contributor to a large open source project would have been laughable
  • 1 year ago I’d have given you an evil look at the merest mention of SMO

 

This stuff all moves so fast, it’s just ridiculous, there’s just no way to keep up with it all. Think of all the other changes over the last dozen years of SQL Server and Windows…things like DMVs, Azure, AWS, compression, TVPs, temp variables, CTEs, output clauses, lag and lead, partition by, partition tables, etc…

Spend a moment to think about all the stuff you’ve been through, for however long you’ve been doing this nonsense, and realize the absurd nature of it all.

 

By the way, this was deliberately acronym heavy, so here are some definitions:

  • AG – Availability Group
  • AWS – Amazon Web Services
  • CTE – Common Table Expression
  • DC – Data Center
  • DMV – Dynamic Management View
  • DR – Disaster Recovery
  • FEX – Cisco Fabric Extender (network stuffs)
  • FCI – Failover Cluster Instances
  • GUI – Graphical User Interface
  • MSCS – Microsoft Cluster Service (precursor to WSFC)
  • NOC – Network Operations Center (those folks who are the first in line when something goes bad, and also the ones that have the lousy job of waking you up in the middle of the night because something went wrong)
  • PS – PowerShell
    • ft – Format-Table (in Get-ClusterNode command)
    • -auto – automatically size data columns returned to the client
  • Quorum – a majority of votes in a WSFC that is required to ensure that the clustering services stay online to ensure that there is not a risk of a split-brain scenario which could cause massive data problems (oversimplification)
  • SMO – (SQL) Server Management Objects
  • SQL – Structured Query Language
  • SQLCMD – SQL Server Command Line Interface
  • SSMS – SQL Server Management Studio
  • T-SQL – Transact-SQL
  • TVP – Table-Valued Parameters
  • VBScript – Microsoft Visual Basic Scripting Edition
  • WAN – Wide Area Network
  • WSFC – Windows Server Failover Cluster

I’m pretty sure just going through all the SQL Server word salad is enough to drive a person to drink.

Life as a DevOps DBA

A few weeks ago Grant Fritchey (b|t) posted about DevOps, the DBA , and the word “No”. Go ahead and read it, I’ll wait right here.

Welcome back. As you’ve just read, Grant ranted a little on the concept that the DBA does nothing but say no to requests, and that people still live the belief that it’s their default response to anything.

The whole concept of the DBA saying no really comes about because the people that are responsible for getting up in the middle of the night, because somebody did something crazy that broke the site, are not fans of a lack of sleep. Hey, if you knew that there was a not-null probability of losing an evening, or a weekend, wouldn’t you be hesitant to allow changes as well.

I spent many years as that gatekeeper. The one that didn’t want to lose that time. I didn’t want to spend my time saying no, but I knew for darn sure that I wanted to understand what was going in and what the potential impact was going to be. After all, I’d rather spend my time figuring out how to simplify managing my enterprise than trying to figure out what was broken with the latest release.

Continue reading “Life as a DevOps DBA”

Changing The Default Email Address In Office 365

Not SQL related today but a good example of PowerShell in action.

I recently migrated my personal email over to Office 365 from Microsoft. The migration itself went very smoothly but I ran into an issue where the primary email address on the account was showing with a @sirsql.onmicrosoft.com address instead of @sirsql.net. This seriously bugged me and I couldn’t find a way to change it in the Office 365 admin interface.

After some digging I found that you could only make a change such as this using PowerShell, and that you couldn’t do it using the account you want to change (makes sense).

So I created a new admin account just for the purpose and initiated a session in Office 365 (entering the admin users credentials when prompted)

$Livecred = get-credential

$Session = new-pssession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $Livecred -Authentication Basic -AllowRedirection

Import-PSSession $Session

Now I had to find the account, easy enough:

get-mailbox | where-object {$_.Identity -eq "<my account>"} | fl

This gave me all the details, including the PrimarySmtpAddress

image

As you can see from the membership properties you can get and set this information, so that’s what I went to do:

set-mailbox <my account> -PrimarySmtpAddress <my account>@sirsql.net

And got an error

A positional parameter cannot be found that accepts argument ‘-PrimarySmtpAddress’.
    + CategoryInfo          : InvalidArgument: (:) [Set-Mailbox], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Set-Mailbox

 

Well this made no sense. No matter what I tried I could not do anything other than a get on the PrimarySmtpAddress. Back to the searching and I discovered that Microsoft have not provided the capability to run a set on that particular member object in Office 365 (although it’s available with Exchange). Way to do with that Microsoft.

After some more digging I was able to get the SMTP address changed by setting the WindowsEmailAddress to the correct value

set-mailbox <my account> -WindowsEmailAddress <my account>@sirsql.net

 

One other note, when using PowerShell to manage O365 and it says to use Identity use the Alias for the account instead or you might up with unintended consequences.

Being Inappropriate At The Summit

Last year Sean & Jen McCown (you might also know them as the Midnight DBAs) put on a little event called “Inappropriate PASS”. It was a smallish gathering of 30 or so folks who wanted to give and watch presentations that were a little on risque side. 

There were drinks, noms, curse words a plenty and enough stuff to make you laugh that your sides hurt. A fun time was had by all in attendance.

With the Summit coming up in a little over a month planning is well underway for this years event. To help with the planning Jen is asking for some feedback for possible attendees (those of you that will be at the Summit and those of you that live in the local area. Please go to http://www.midnightdba.com/Jen/2011/08/important-inappropass-survey/ and fill out the 30 second survey. 

I think you should seriously consider joining us for a couple of hours of craziness and should put some serious thought into something that you would like to talk on for 5 minutes. Nothing is off the table or out of bounds so bring your worst. It’s going to be a blast.

 

Such fun.

How To Interview–A Quick Guide

This post was originally going to be called “Interview Dos and Don’ts” but I didn’t want it to get confused with interviewing on DOS, or to start a grammar war on the use of Do’s or Dos.

I had the chance to interview a couple of candidates for a senior developer position today. Each one of the interviewees had greater than 12 years experience in developing for SQL Server. Each one of the interviewees had different styles in the interview process.

Rather than focus on specific questions and answers in this post I actually want to look at how each candidate handled themselves in general and in response to questions. All the interviews here were performed by our DBA team of three people.

 

Candidate 1

The first interviewee had a great deal of experience and was already seated when we walked in the room. Rather than stand and greet everyone the candidate stayed in his chair and just reached out his hand. Not a good start.

I figure that everyone has a quick 30 second “this is what I can do” spiel, and so that was the first thing asked. In that situation I would expect someone to give a very brief overview of their knowledge and experience. For some unknown reason this person decided to give a life biography in a rather condescending manner.

Technical questions followed. Each one of those was met with the kind of attitude that indicated “I’m better than you”. Many of the answers were wrong. When asking for clarification on answers we were frequently met with a wave of the hand and “I don’t really know”.

At one point a question was asked and the follow up used some obvious logic to disprove the original answer. At this point I would expect the candidate to change one of the answers. They didn’t. A new and third answer appeared that completely (apparently) disproved the logic. Pretty stunning.

After what was an all too long period of interviewing this person, we let them go and moved on to the next person.

 

Candidate 2

Our second victim interviewee immediately stood and greeted us when we walked in. He had a nervous smile on his face as he shook hands and introduced himself.

The elevator pitch went ok and there was none of the obnoxious behavior the first candidate. Then we started in on the tech questions and things started going a little sour.

I can understand folks getting a little nervous when interviewing but this candidate seemed to go to pieces. Questions were frequently answered with “I know this, but I can’t remember” and a panicked look. With this person being so obviously flustered we tried to get them back on track by throwing over a couple of softball questions. At this point I think we’d lost the candidate entirely and brain panic took over.

At the end of the interview he almost seemed on the verge of tears and it seemed to us that he started trying to play the emotional angle to try and have us feel sorry for him in an effort to have us walk away with a good impression.

We’re DBAs, empathy is bred out of us so this didn’t work.

 

Candidate 3

The final candidate greeted us with a warm friendly smile as he stood, shook everyone’s hand and introduced himself. He repeated back out names to be sure that he had heard them correctly and settled into his seat.

The elevator pitch was spot on. We got a very quick overview of his skills and what he’d been working on recently.

When we started in on the technical questions he gave obvious consideration of what we were asking, looked for clarifying points for some things and provided concise answers. By no means was he able to answer each and every question, however when he did not know he was quick to admit as such, provide what he felt would be the answer and a pointer to where he would look for a definitive answer.

This prompted a question around community involvement in which he mentioned that he liked to attend events like SQLSaturday and read blogs. When asked about favorite blogs he was able to provide a few and name the sessions and speakers from the most recent local SQLSat event. This was a huge plus as this candidate obviously enjoys working with SQL Server enough to spend time and effort outside to increase his knowledge outside of regular work activities.

When a couple of questions were answered incorrectly and we questioned the responses we were met with a genuine interest in getting the correct information and were able to build conversation around those items.

We were sad when time was up and we had a great time sitting and interviewing this person.

 

So which one would you choose?

If you were an interviewer, technical responses aside, which one of these candidates would be at the top of your list?

Captain Obnoxious?
Nervously Tearful?
Quietly Comfortable?

I know which one was at the top of ours.