T-SQL Tuesday #19–What A Disaster

Allen Kinsel (blog|twitter) is running this months T-SQL Tuesday and wanted to know about preparing or recovering from a disaster. I thought this might be a good opportunity to tell a little story of how a disaster sucked up around three weeks of my life a couple of years ago.

 

It was a normal day, I was sitting and quietly going through a small staging release when my director asked me to come into his office. Instantly I started wondering “what did I do?”

Not being able to come up with anything egregious I settled down the stomach gurgles and went wandering in. That I walked in and was offered a seat I got nervous again, this was not a good sign with this director. Now I was really curious as to what could be up.

 

What was up?

“Are you working on anything big right now?” were the words that kicked off something that changed my views on a lot of things.

“Nothing that can’t be put on hold, what’s up?”

“Did you hear about the <redacted> outage?”

“Sure, everyone here has heard about that, it’s a seriously messed up situation.”

“How do you feel about being a part of the solution?”

My long nurtured DBA sense of responsibility kicked in at this point and I heard myself saying “sure”

“Great, I’ll shoot an email off to the admin, you’ll be on a flight to <redacted> first thing in the morning.”

 

I quickly rearranged all of my plans for the next few days and resisted giving myself a facepalm until I was well clear of the office.

 

Up, up and away

The next morning I hopped on a plane and by mid-afternoon was at my place of destination. When I walked in the door it was all hands to the pump where people were rushing around like crazy and the smell of desperation was in the air.

I was brought into a room and the situation explained to me…

A couple of days prior there had been an attempt at a microcode upgrade on a SAN. The upgrade failed, crashed the SAN and corrupted all of the data. No databases could be attached or started, no files were accessible, there was no filesystem, nothing. It was bad.

I asked at what point the decision was going to be made to scratch it and go to a backup (figuring if there had been a DR site for this it would have been in place already).

 

Backups? We don’t need no stinking backups

Yup, you guessed it, there were no backups. I asked when the last time a backup was taken, someone stated that they thought a backup had been taken 9 months before, but they couldn’t be sure and they didn’t know of anyone that could get into that datacenter and see.

The reason for no backup? Apparently it was taking too long to perform the backup and so the decision was made to just turn off the backup process.

I came to find out later no effort had been made to tune the backup process or to attempt alternative backup methods.

I find it unfathomable that there were no backups on a critical system that supported > 1 million users and had extremely high visibility. You would have thought that DR would have been priority #1, but that was not the case.

 

Sleepless nights

While there was little that could be done with the dead storage there was a lot of work around what could be done as a mitigation strategy. What could be done to restore service while other work was done in an attempt to recover some amount of data.

A new SAN was brought up, database installations performed, a change management process was put in place (one had not existed before) and there was a lot of discussion around getting backups working immediately.

I didn’t move from the building the first 36 hours. Thankfully the company brought in three square meals a day for everyone that was there to ensure that we at least got fed. People were sleeping on the floor in offices just to try and get a couple of hours sleep so they could remain functional.

Restoration of service was a slow arduous process as great care had to be taken with the order of enabling certain components.

Slowly things got back to normal, hourly calls with the VP dropped to every four hours. I was able to sleep in a bed and get some rest and a change of clothes (at one point I told the VP I was running out of clothes and asked how much longer I was going to be there, his response was that I should probably go and expense some underwear).

 

Getting back some data

A little over two weeks after everything went kaboom we started getting word of some data recovery. A third party company had been brought in and had been performing a block by block recovery of the storage from the bad SAN. They were not able to pull files or anything that simple, they were just able to pull access data on blocks. With a great deal of effort they managed to recover 90% of the data, which then had to somehow get validated and reconciled with the data now in the system.

Scripts abounded, levels of confidence in the data had to be decided upon and the risks ascertained for data restoration. That to me was a very scary concept. I’m glad that the decision on that one was made well above my pay grade.

After about three weeks I was able to go home. My work (and everyone else who was sent down to work on the recovery attempt) was acknowledged in a company meeting a couple of months later.

 

Takeaways

This is a real world example of a disaster. If there had been a backup a great many good people would not have been stuck away from home for three weeks.

It gave me a much greater appreciation for what can happen in a disaster. Don’t get caught out, make sure your backups are good and you have a strong business continuity strategy.

Speakers Third Rule

You’ve mastered the first rule and have submitted a session to present at a SQLSaturday, local user group or at your office, excellent. Your presentation is written, all the details are there…slides, demos and you’ve got your patter. You’ve followed the second rule and the presentation is all you. What’s next?

Practice makes perfect

 

 

Time to run through your presentation multiple times so that you know it well and can give it without any problems.

You might have a demo heavy session and need to practice those demos over and over, getting them just perfect. It could be a presentation that’s all theory with multiple slides; run through them, know what’s on each, understand each statement that you have put out there. Do you smell BACON?

It really doesn’t matter the kind of demo just practice it over and over again. Drive your dog crazy by holding it a captive audience as you present while holding a strip of bacon just out of reach.

Don’t worry if you don’t have a dog as a cat, spouse, girlfriend, boyfriend or fluffy bunny rabbit will work just as well.

The more you run through your presentation the more comfortable you will feel with it. This comfort is going to be vitally important for when you first get up in front of that “live studio audience”.

When those nerves kick in (and they will) you’ll have the mind muscle memory to carry you through. After all you practiced it until it was second nature to present, there’s not going to be anything to worry about come presentation time…right?

Speakers Second Rule

After writing a post for Un-SQL Friday on the first rule of speaking I decided that it would make quite a good series of posts, so here’s my second rule of speaking:

Find your own voice

 

What do I mean by this?

As an analogy when I first started out blogging I tried to emulate other writers in the community. In doing so I felt it very difficult to get across what I was trying to say. The message was lost in my trying to be someone I wasn’t. In addition I found it a real chore to write anything and pretty soon gave up posting.

My second attempt at blogging was a great deal more successful, at least it feels that way. Instead of trying to copy the style of someone else I am writing in my own voice. Whatever sentence structure I come up with is what I use. I don’t find it a chore to get words down, I feel like my message gets across and I am a great deal happier in the Don’t be this guythings that I publish.

 

Speaking is no different. Sure, you could try to emulate Buck Woody (blog|twitter), Brent Ozar (blog|twitter) or Sean McCown (blog|twitter) but I wouldn’t recommend it. Each one of those speaker is very different in the way that they present. Each has a very clear way of putting the message across and each one does so in a way that captures your attention. They have built their styles from years of presenting in their own voice. They are all very comfortable in how they present, they do this by being themselves.

Taking a lesson from my blogging experiences I decided that my presentations would be in my voice. I would present them in a way that I felt comfortable. By using my voice I knew I would never be outside of my comfort zone. Think about trying to talk like someone else, then add in a technical aspect. Now imagine fifty people are watching you try to be someone you’re not.

Stomach churning yet?

 

Presenting is going to be challenge enough for you at first. Go in being yourself, it’s worth it.

Un-SQL Friday #004–Speakers First Rule

I may be a day late and a dollar short for Un-SQL Friday #004: Speaker Lessons Learned but still felt I had something to share.

One of my favorite book series is The Sword of Truth by Terry Goodkind. The first of the 11 book series is called Wizards First Rule. It’s one of those oft rehashed tales of someone ordinary who turns out to be anything but. One of the things passed along was the first of a series of rules about magic. It made me think of speaking and the rules around that.

There are numerous rules (sure, you could call them guidelines or pieces of advice but we’re playing semantics here so go with it).

 

So here’s rule #1…

Don’t be afraid, go for it!

 

 

Such a simple rule. So often I read tweets from folks who talk about wanting to be able to present and wishing they could do so. There are people who really want to speak at the PASS Summit but haven’t submitted a session because of fear.

Fear of public speaking, making a mistake, things going wrong and rejection are all valid reasons why people get scared to submit their first session. It’s why folks don’t submit for their user groups or local SQLSaturday events. It’s why you may even be too nervous to present on a subject to team members at your company.

I get that, I’ve been there. You know what though? I decided I wanted to present and that ultimately I wanted to present at the Summit. To do that I had to get started. I chose my first event and submitted a session. Things went well the first time, not so well the second. I’ve had (what felt like) a complete disaster in a session and yet I’m still here, still standing and I’ve submitted to present at this years Summit. Whether or not I get chosen doesn’t matter at this point, the chief thing is that I tried (see getting over the fear of rejection).

I managed to conquer my fear, I know that you can do that same. What’s the worst that can happen?

Be Careful Installing Windows Features

Did you know that installing certain Windows features could impact the way that SQL gets installed on your server? Me either.

When performing some installs recently I came across a problem whereby I was not able to change the shared tools location. The option was greyed out. This didn’t make any sense to me. The install was happening on a new server, there had been no previous SQL installs on the machine and so no problems with installed components preventing those kinds of problems.

 

Digging through the filesystem I found a C:Program FilesMicrosoft SQL Server folder. That didn’t make any sense to me at all, I’d not installed anything.

I could not even find anything that might be using this folder when looking through the installed software and yet I couldn’t delete the folder as there were files in use.

After much head scratching I finally found the problem.

 

I had installed the Windows System Resource Manager feature to help manage resources, which is very useful when running more than one instance of SQL on a machine, or if you have multiple software installs and want to keep control of your CPU and memory. This feature uses (and so automatically installs) another feature called the Windows Internal Database which it says is a relational data store.

 

By the looks of things the Windows Internal Database is based around the SQL 2005 engine, this gets installed into C:Program FilesMicrosoft SQL Server.

When performing the new SQL install it went out and identified that SQL components were already installed and forced installation of the shared tools into that same location.

 

After removing the Windows System Resource Manager and Windows Internal Database features I was able to move the shared tools install to another location.

Be very aware of what features and roles might be install on your machines, it might bite you when you least expect it.

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.

Central Auditing Of SQL Permissions Scripts

Yesterday I gave a presentation for the PASS PowerShell Virtual Chapter on central auditing of SQL permissions with PowerShell and TSQL. For those that attended feel free to download the scripts I used in my presentation. For those that didn’t…well you can still download them but this picture may not apply to you…

Image from http://whosawesome.com/

Don’t Shrink TempDB!

As a general practice don’t shrink any databases. Every once in a while there is a need to do so. I had one of those needs today.

 

My disk is full

Thanks to a cumulative effect of a misconfigured SQL install, incorrect location of TempDB and the server pagefile combined with a user running a huge query joining 20+ tables with no where clause we had a drive run out of disk space. Unfortunately this caused another process to break which needed to grow the transaction log on another database.

I contacted the business owner immediately explaining how we needed to move TempDB to another drive and restart SQL (in fact I’d already performed the alter statement to move TempDB off to it’s own LUN where it should have been all along). The business owner stated that we could not restart SQL until after the evening so we were left in a situation where certain things were failing.

 

Why not shrink TempDB?

That was my feeling. TempDB was 18GB larger than it had ever needed to be so I figured I could just shrink the data file (there was just one) and reclaim 50% of the difference to keep things chugging along until the restart. I attempted to perform the shrink on the file and it did nothing. I checked TempDB and nothing was using it, but still the shrink failed.

Interesting problem. Argenis Fernandez (blog|twitter) just joined my team and he came over to try and help. He suggested running DBCC FREEPROCCACHE and DBCC DROPCLEANBUFFERS given that the user impact would be minimal given the servers usage patterns. 

After running the DBCC commands I was able to perform the shrink, clean up the space and keep everything running.

 

Corruption – that’s why

Curious as to why running those DBCC commands allowed me to shrink the file I posted to #sqlhelp on Twitter asking why.

Pretty much immediately I got a reply from Paul Randal (blog|twitter) that made my stomach churn:

Dont Shrink Tempdb

 

Paul and Aaron Bertrand (blog|twitter) sent me links to a Microsoft KB article that clearly explains this.

From Paul I bring you the KB in a nutshell: unless you quiesce SQL Server, a TempDB data file shrink can cause corruption.

 

This post brought to you by yet another reason not to perform a shrink.

Presenting For The PASS PowerShell Virtual Chapter

A quick note, on Wednesday at 1PM EST I’ll be giving an online presentation on one of the two topics I submitted for the PASS Summit this year.

 The presentation will be heavy on the demo side of things and I’ll cover the basics of querying SQL Server using PowerShell, running scripts against multiple machines quickly and easily as well as bulk loading data into SQL.

Please check out http://www.powershell.sqlpass.org/ for a link to the livemeeting.

 

Central auditing of SQL permissions with PowerShell & TSQL

Description: As a DBA it can be a challenge to know who has permissions to what SQL instances and what objects. The more instances you have the more complex that task. In this presentation I’ll share a method using PowerShell and TSQL that can be used to capture permissions from all of your SQL instances and load them into a centralized location. We’ll even take it a step further by auditing those permissions so that we can quickly and easily identify any that might have changed.

 

What’s In A Name?

Back in November (which seems so very long ago) I wrote a post for UnSQL Friday #1 on branding. Feel free to go and read that, I can wait…

…while everyone else is off reading that here’s a quick synopsis, I fell into an accidental brand with the bush baby image, this despite few people knowing and fewer people being able to pronounce my Twitter handle @anonythemouse (Anony-The-Mouse).

 

Welcome back.

Recently I’ve been giving a great deal of thought as regards branding and decided that it was about time that I actively managed my own brand. I can hardly claim that I’m anonymous any longer given the blog posts, activity on Twitter and presentations (@AnonyTheMouse being a play on anonymous). As such I’ve decided to change things and will be sporting a new Twitter handle from next week and there will be an accompanying new blog to match up with it. There is also going to be, in the future, a new logo *say it ain’t so Nic, say it ain’t so*. Sorry, the bush baby needs to rest those eyes, they must be feeling really strained after staring for so long.

 

I really want to thank Cami Peacock (blog|twitter), Sean McCown (blog|twitter) and Jen McCown (blog|twitter) for being awesome sounding boards and coming up with great and creative thoughts across the whole branding spectrum.

I’ll be posting more details as things change.