Category Archives: Uncategorized

Will the Real Idiot Stand-up.

As you know our other DBA just left and he just started his new job. I was IMing him today and asked him how it was going. He said, the last DBA was an idiot. It’s funny, cause I can’t count the number of times I’ve said that. I don’t thing I’ve ever started a job where the guy before me knew what he was doing.

The question is though, am I really all that good or do I just have an inflated ego? I’d probably have to say it’s a bit of both really. I’ve seen a lot of DBAs who just don’t know the simplest things about SQL. I’ve talked about this several times in both my blogs so I’m not going to harp on it too much right now, but it holds more true every year I’m in this industry.

There’s a difference between just doing things differently than the other guy, and his systems actually being neglected. Not performing backups or index maint. is bad DBAing. It’s not just a different way of doing things. I remember talking to a guy who was a very high DBA at a company we all know last year. I was at PASS come to think of it. And he sat there proudly and told me that they NEVER change their sa passwords on any of their systems. I would love to tell you his reasoning, but I just couldn’t get into something like that. But to be proud that you never change your sa password is just assinine. You know what they say dude, if you look around the room and you can’t find the asshole, it’s you. The same goes with idiots.

It’s hard to measure skill though. Everyone has such different experiences. Things I’ve come to know well may be completely foreign to a different DBA who’s far better than I at something else. So does it make him an idiot because he doesn’t know what I know? Yeah, sometimes. The basics should be covered. Every DBA should know what it is to backup a system and do maint. and basic security. And so often it’s these basics that aren’t covered.

So now it comes down to simplicity. What makes a really good DBA? I’ve had several talks with guys all over IT about this same topic, and in almost every session, we’ve pretty much concluded that you only have to try a little bit to be better than the average guy. The average guy does very very little to further his knowledge or to get really good at his job. Most people just skate by. So if you try just a little bit you can rise above the crowd. That’s what I think anyway.

SQL Server Done Right

This is the perfect topic to go along with what I wrote on my other blog today in The real difference between SQL Server and Oracle.

I just got an email from the producer of the new Kalen Delaney series on SQL Server giving me my press pass into the online content for this series. I’ve only watched the 1st 9mins so far and already it’s exactly what I’m talking about in my other blog. Here’s Kalen Delaney who writes one of the most successful series on SQL Server (the other one is by the late Ken Henderson. I still have a hard time saying that), and she’s going the extra mile to put her book into a video training series where she explains the concepts herself.
I, like many other people learn better when things are explained to me than I do from a lifeless page. And Kalen’s an experienced teacher so she has a way of explaining things that make you just get it. Already in this video she’s already covered security of metadata and the sys schema. She’s actually explaining how this stuff fits together from the ground up. That’s how it’s done. I have no doubt that the rest of the series will contain the same deep-level understanding.

I think I’m going to enjoy this series and I’ll try to write-up a full report when I’m done. Or maybe I’ll just do it as I go along.

OK, so here’s the link to the site. You can order the DVD or you can watch it online. It’s good stuff. Seriously, go check it out if you haven’t.
I was recently chatting with Kalen in email and she told me that this is basically the course she teaches when she’s brought into a company to teach a class.

Actually, I didn’t mean this to be an official interview, but I’m going to go ahead and paste her email here. I’m sure she won’t mind (at least I hope not) and she explains it better than I would anyway. I typically don’t post emails without asking first, but she knows who I am and she answered my questions like she was being interviewed, so this one time I’m going to do it. But you’ll almost never see me take this liberty.

1. What material will this first DVD cover…

You can get information about my course here: http://www.insidesqlserver.com/Course%20Description%20and%20Outline.htm
The first DVD covers most of what is in Module 1.

2. What format will it take… will be be a group of slides and whitepapers, or screencast instruction by you…

The DVD will be a mixture of live capture of me talking, and screen captures of my slides and my demos.

3. Who all is involved in the project…

I am recording the class that I have been presenting all over the world for the last several years. Chuck Boyce, of AskaSQLGuru.com is doing the filming and editing. The business side is being managed by Peter Ward of www.WardyIT.com in Brisbane, Australia

4. How often can we expect to see a new DVD come out…

Since I have to fly to New York for filming, we are only able to do about one a month. In fact, I am just about to leave for the airport for the second round of filming.

5. What advantage will one have in ordering these over just getting the books…

Different people learn in different ways. If you like to hear and see someone explaining concepts, this can add to the benefit of the books. People pay a lot of money to attend my classes, but since I’m only one person, I can’t offer them that often. The DVDs are a chance to for anyone, anywhere to get to take my class. If you can read and absorb everything in the books on your own, the DVDs might not offer anything more.

So again, here’s the link to SQLServerDVD.com.

Already a Nightmare

I’ve had to call a vendor for support and it’s already not going well. I’m not going to say which vendor, but I’ll tell you that I’m having problems with my SQL backups.
Anyway, I went online and filled out the form with all the info… OS, SQL version, etc… then I got the email from the support tech asking me for all this info.

I replied by saying I had already filled that stuff out when I created the ticket so why did I have to do it again? I don’t mean to be a difficult customer, but come on. Why do I have to do everything twice?

Hairy Toast

Every morning when I leave the house I get in the car and the first thing I do is throw my jellied toast face down in the floor of my car. Why not, that’s where it’s going to end up anyway when the asshole in front of me slams on his breaks. Now at least it doens’t piss me off when it happens. Then when I get to work the first thing I do is run some kind of wild query that fills up all the memory and CPU and locks everyone out of the system. Why not, that’s what’s going to happen as soon as my favorite report writer logs in.

Some days it just doesn’t pay to get out of bed and go through the hassle. Then again, if you’ve done what you should as a DBA, it shouldn’t be that bad. Hopefully you’ve setup things in your DB that keep things from getting too out of hand. Hopefully you’ve been able to teach your report writer some basic dos and don’ts (sp?).
But what if you’re in a new place? Can you still be effective? Of course you can. Again, if you’re a good DBA you’ve collected a nice gaggle of scripts that you take from place to place. Years ago when I was just getting started, I didn’t get that. I always thought, why be lazy, just write the damn scripts when you need them. But that’s the wrong attitude. It’s not laziness, it’s practicality. There’s just no reason to work out that logic every time.

So if you follow some of your own best practices and set yourself up for success, maybe you can withstand the bad times. But there’s nothing you can do about traffic, so I guess you’ll have to keep throwing your toast on the floor. Life goes on.

Installing LiteSpeed

For those of you who follow my blog, you know that I’ve used LiteSpeed for many years now. And one of the things that’s always bugged me is the lousy way they run their upgrades. To upgrade LS typically consists of having to do some version of manually deleting the current repository tables and then running the install program. And this is after uninstalling your previous version manually as well. And if you want to save your data in your repo tables you have to create new ones and copy the data over, or just rename the old tables. And it still isn’t that easy because of the relationships. If you just rename the tables you have to rename the relationships too or the new install will fail. And you have to do this for every box you own. What a pain in the ass!!

Well, I have a problem with LS not backing up one of my DBs even though it’s been working just fine for almost 2yrs. So I just upgraded from v.4.7 to the latest 4.8 (yes, I know v.5 is coming out soon, but I can’t wait). And let me tell you this… it looks like they finally got these upgrade problems fixed. My upgrade went smooth. I didn’t have to manually uninstall the old version, I didn’t have to play my usual shell game with the repo tables, and I didn’t have to burp the service. Life is good.

Now, I’ll have to see if it actually fixed my problem. But I’m happy to be able to report something good about LS for the first time in a long time. They’ve mostly been adding features, and very slowly at that, and haven’t been really concerned with our actual problems. Maybe this is a turning point.

Anyway, good job LS guys.

Bad Code Management Practices

One thing that’s as varied as ways to code is how to manage the code itself. Or I guess I should say architect instead of manage, but it all comes down to management.

The 2 major ways are to componentize and to not. And by componentize, I mean taking all the individual components and turning them into small independent chunks that can be called from many sources. A good example is taking a date calculator routine in your SPs and turning it into a function so the SPs just call it instead.
So those are the 2 ways. You either put it inline with the code or you make it into a component and call it from all the modules you need.

Of course, I’m mainly talking about SQL code here, but it really applies to any kind of code I suppose.

It’s easy to see the advantages of developing a component solution. This is the DB equivalent of COM, right? But what’s not easy to see is what it does for you (or to you) support-wise. What this solution can do is put you in a new form of .dll hell from the old days.

Let’s take a simple example…
Let’s say that you have sn SP in prod that’s giving you problems and you want to track down where the degraded performance is coming from. So you open up the SP and start looking at the code. You see that a major component of it is an external SP call. OK, so you open up that SP. Now you see that that SP calls 3 other SPs. And each one of them is calling more SPs. And so on and so on. This is the definition of spaghetti code isn’t it?

I’m actually in the middle of doing this very thing right now. I wanted to stop and blog about it while I was still pissed off. I’ve been doing this for an hour now and I’m not any closer to a solution than I was when I started. So you can see that while going the COM route can be helpful, you can take it too far. And that’s really what happens, isn’t it? Devs take a good idea and drive it into the ground until it’s so hard to manage it’s not even worth having it anymore.

I’ve been trying to come up with some guidelines for this and it’s tough. But roughly, I like to say that if several SPs use the same code, or are calculating the same thing, it’s ok to pull out into COM. The same goes with code that gets changed a lot. If you’ve got code that changes often and is used in a lot of SPs, by all means put it into it’s own SP so you only have one place to change it.

Anyway, I guess I’ll get back to my plate of spaghetti now.

sp_Whoville

This post is dedicated to all those field DBAs who like to call up the prod DBAs and tell them how busy the server is based on the number of spids or short-term blocks returned by sp_who(2).

See this is the hidden cost of generic logins that have too many rights. Everyone on the planet can read BOL and try to interpret the results. And whatever they mark in their heads as being the sign of a server being too busy is what they’re going to call you with. Our users have 2 criteria for a busy server. The number of spids (active or inactive), and how many short-term blocks they see.

Of course I used to try to explain to them that you could bring the server down with a single spid so the number doesn’t matter… and that blocks are fine as long as they don’t persist. Since I’ve been here for quite a while though, and none of them have gotten the hint yet, I usually just thank them for letting us know and that we’ll get right on it.

One of my favorite analogies used to be that judging the server on the amount of spids is like loading your car up with people and declaring that traffic is really bad today. Somehow that still didn’t get the point across.

Losing a DBA

It’s almost never fun to lose a DBA, but it’s a fact of life. People leave jobs, and sometimes jobs leave people. This is another reason why it’s really important to not tax your DBAs too heavily. If you’ve got 2 DBAs and they’re both working like dogs, what happens when you lose one? I’ll tell you what happens… deadlines start to slip, backups start failing and don’t get looked into, maint starts getting behind, security gets relaxed, etc. You want your DBA to have time to do his job and be able to pick up some slack when you lose someone. And it could be quite a while before you get a replacement. Good DBAs are really hard to find and you don’t want someone to just warm the seat.
I talked about this recently in my IW blog. Of course, this really only goes for production DBAs, right? I mean, you can work your devs as much as you want. They’ll never get a call in the middle of the night because the server’s down or because a package failed. So again, DBAs are insurance policies. We’re kinda like a clustered server. You don’t use the inactive node. It just sits there waiting for something to happen to the primary node. It seems a terrible waste and managers hate spending that money for a box that just sits there. And while DBAs aren’t quite that useless, we really should be used in the right way. So it really is just like a multi-node cluster. You never run the primaries at full capacity because one day something will happen and one box will have to take on its workload and one of the downed nodes. So if they’re all running at 100%, they can’t failover and resume work. So you run them at 50%… give or take, right?

So again, let your prod people do their prod jobs and don’t put them on too many actual projects. Afterall, that’s what prod means.

And yeah, we’re losing our other DBA so I’m all alone now. We’ll see how it turns out.

More thoughts on Admin Passwords

OK, I’m also changing this in the original post, but in case you don’t think to go back and check.
When I sent my admin password solution to a buddy at MS, he tried it and it didn’t work. After a fairly short discovery, I discovered that it worked for me because I had a drive mapped to the admin share on my DC. So PSExec was using that IPC to connect. So unless you’re lucky enough to have something like that, you prob won’t be able to use this solution. However, it’s a good backdoor so it may be a good idea just to setup a mapped share on your box anyway just in case something happens and you get shut out of your DC.

On that note. This is a really excellent reason why you never want to run SQL under an admin acount and especially not under a domain admin acct. I’ve seen that more than I care to and it always comes out bad eventually. It only takes a very basic knowledge of SQL to discover that someone with regular user rights can setup a SQL job to promote their user acct to admin because the job will run under the context of the agent acct at the OS level. And if you’re running your services under an admin acct they’ll have full rights to do whatever they like. And if you’re running it under a domain admin acct, then they can promote themselves to domain admin pretty easily by running a .vbs or prob even powershell. Pretty much any scripting language will prob do, huh…
And that goes for running SQL on a DC under local system. That’s the same as domain admin as far as the DC is concerned. So be smart and run your SQL accts with non-admin accts and just remove that from the equation. There are enough ways for internal and external hackers to elevate rights. Don’t help them.

Reset Domain Admin Account

Last week I somehow forgot the domain admin acct in my lab. I tried for 3 days to remember it and I finally came to the realization that I just wasn’t going to. So I started looking around on the web for different things I could do. I wasn’t really in a hurry cause my domain was running just fine.

I found many methods for changing the local admin acct, but not many for changing the domain admin acct in a windows 2003 domain controller. I did find this method here.

Anyway, I checked with an SE friend of mine on the windows support team at MS and he said that was a good method and told me to run with that one. Not that I minded, but I just didn’t want to bring down my DC and take the time to copy all that stuff to floppy, etc. So I kept looking.

I finally had an idea that I just had to share with everybody. It’s so simple it’s scary.
I used the SysInternals tool psexec.exe. What it does is run programs remotely on the box of your choosing. The problem of course, is that you have to make an admin connection to that box, and if you could do that, you wouldn’t have to use psexec to reset the password. So I looked at the help file for psexec and found a parameter that just amazed me. -s is its name.
What that does is tells psexec to connect with the local system acct of the remote box. And since the local system acct has full admin rights, you have the rights you need to change the admin password.

So at a command prompt go to the dir where you have psexec and type the following command:
psexec.exe -s \\machinename cmd
That tells you to bring up a command shell on the remote box and log in as the machine’s local system acct. So now you’ve got a shell open on your box just like you were standing in front of the console on the remote box. Now you just type the command for changing the admin password: net user administrator newpassword

That’s it. It’s simple, elegant, beautiful, and it really saved my ass.
I hope this helps someone else.

Just for grins, here’s a Camtasia I made of the process just to make it even easier. Click here

UPDATE:
Here’s an update to my original post. I sent this solution to a friend at MS and he found that it didn’t work for him. After a little investigation, I discovered that it worked for me because I had the admin share on my DC mapped on my box and PSExec was using that IPC. You can read more about that here.