December 2009
Mon Tue Wed Thu Fri Sat Sun
« Nov   Jan »
 123456
78910111213
14151617181920
21222324252627
28293031  

Month December 2009

Goals for 2010

Thomas LaRock thought it would be fun to tag me in yet another round of blogging bingo, this time to answer the question “What are you Goals and Theme Word for 2010?”. To tell the truth, I have not made any kind of New Year’s Resolution for a number of years. I usually review my goals on a regular basis, but let’s put them out here for everyone to see.

Theme word? I don’t have one, “f*%#ing rad” is two words, thank you very much.

Communication

Become a Better Writer

A long time ago, I went to college for four years, took out a bunch of loans, and got a degree in English, Non-Fiction Writing. I did exceptionally well in my English classes and did even better in the writing classes. I love writing and, frankly, the quality of my writing has not been up to par recently. I want to change my focus as a writer this year. I want to switch from writing short, highly technical, blog posts and change to creating longer article and essay length pieces. There’s nothing wrong with shorter, technical, posts but that is not where my interests lie. I want to focus on improving my writing so I can effectively teach more advanced concepts through writing as well as through public speaking. I was a good writer before and I’ll be a good writer again.

Become a Better Presenter

I have no doubts about my abilities as a presenter – I have a lot of room for improvement. Over the course of the year I’m going to team up with a number of people to improve my presentations. I want to get better at better content and delivery as well as meticulously practicing my presentations until I can deliver them in my sleep. I know that a lot of improvement comes from repetition and I would like to speak at least six times this year. With my current upcoming speaking schedule, that shouldn’t be difficult at all, but we’ll see.

Self-Employment

I don’t intend to be self-employed by the end of 2010, but I plan on being well on my way. How am I going to get there?

Writing

I’m writing stronger blog content. That’s not going to be enough. I want to get my name in a more places – magazines, guest blog posts, paid content, white papers, and a book. I’ve been shopping an idea around to various publishers and I’m hoping to have a book written and finished by the end of 2010. None of these things pay big bucks, but they all add to the bottom line.

Consulting

I haven’t done much consulting in the past, of course it was difficult when my day job was being a consultant – there’s an expectation that you will bring the business back to the company. Things have changed, I’m a full time employee now. My employer and I have had the talk – I’m allowed to do consulting work as long as I don’t help out our competitors.

This year I will take on several clients that require a small amount of time (10 – 20 hours each) every month. This isn’t to replace my existing job, this is to supplement it and provide additional income. Before I go completely solo, I want to have a substantial savings buffer built up and doing work on the side makes this a lot easier. I don’t plan on going at it alone – I’ve discussed this several co-conspirators and we have plans to get started this year.

Personal Ventures

I have an idea for a business that will make me tens, maybe even hundreds, of dollars. I plan on fully pursuing this over the course of 2010. Honestly, I have incredibly high hopes for this business and we have already thought of multiple ways to monetize our business. That’s not to say that it’s sure to happen, I have a lot of hard work ahead me, but I’m looking forward to it.

PASS

As many of you know, I was elected to the PASS Board of Directors and subsequently put in charge of the Summit program portfolio. This is the heart and soul of what I want to do over the next 12 months. I am going to make sure that the 2010 Summit program committee has my full support and that we’re can make the summit the best event possible.

Inky Mess

This is a personal one: I want to finish both full arm tattoo sleeves this year and, hopefully, start on my legs.

Once again, I think I’m supposed to pick victims. I’m going to pick Matt Nowack, Rick Kierner, Jeff Blankenburg, and Jorge Segarra

I also want a chainsaw on my hand like Bruce Campbell in Army of Darkness. That would be f*%#ing rad.

Getting the ISO Week and Year

Long story short: I need the ISO Week. We need to be able to make sure that when we’re reporting, we’re pulling data for the full week (which happens to coincide with ISO Week at my employer).

The problem with using an existing function is that the existing functions just return the week and not the full year + week combination. I used the function from the Less Than Dot wiki as a starting point and added my own code to create the full YYYYWW string to give me an ISO Week. This isn’t actually in the ISO standard format for reporting the ISO week, but I also don’t care so long as I can use the ISOWeek for effective querying.

Enjoy

ALTER FUNCTION ISOweek (@DATE DATETIME)
RETURNS VARCHAR(6)
AS
  BEGIN
    DECLARE @ISOweek INT,
      @year INT,
      @rVal VARCHAR(6) ;

    SET @ISOweek = DATEPART(wk, @DATE) + 1 - DATEPART(wk, CAST(DATEPART(yyyy, @DATE) AS CHAR(4)) + '0104') ;
    SET @year = DATEPART(yyyy, @DATE) ;

    SET @rVal = CAST(@year AS VARCHAR(4)) + RIGHT('00' + CAST(@ISOWeek AS VARCHAR(2)), 2)

    --Special cases: Jan 1-3 may belong to the previous year
    IF (@ISOweek = 0)
      BEGIN
        SET @rVal = dbo.ISOweek(CAST(DATEPART(yyyy, @DATE) - 1 AS CHAR(4))
                                   + '12'
                                   + CAST(24 + DATEPART(DAY, @DATE) AS CHAR(2)))
                                   + 1 ;
      END

    --Special case: Dec 29-31 may belong to the next year
    IF (
        (DATEPART(mm, @DATE) = 12)
        AND ((DATEPART(dd, @DATE) - DATEPART(dw, @DATE)) >= 28)
       )
      BEGIN
        SET @ISOweek = 1 ;
        SET @year = DATEPART(yyyy, @DATE) + 1 ;

        SET @rVal = CAST(DATEPART(yyyy, @DATE) + 1 AS VARCHAR(4)) + '01'
      END

    RETURN @rVal ;
  END
GO

This lets me do some snazzy reporting hackery like this:

SELECT  MIN(c2.[Date]) AS StartDate,
        MAX(c2.[Date]) AS EndDate
FROM    dbo.Calendar AS c
        INNER JOIN dbo.Calendar AS c2 ON c.ISOWeek = c2.ISOWeek
WHERE   c.[Date] = '20091229' ;

/*
StartDate               EndDate
----------------------- -----------------------
2009-12-27 00:00:00.000 2010-01-02 00:00:00.000
*/

Which is then used to feed report parameters.

Busy Busy Silence

It’s time for a personal message from your friendly Director-Elect-at-Large.

In about a week, I’m going to be taking on my first year of duties as a Director-at-Large of PASS. What are those duties? I’m going to be overseeing the program efforts for the 2010 PASS Summit. I’ll be working closely with an established team of volunteers to make the upcoming Summit an amazing experience for everyone.

Outside of PASS, what have I been doing?

Writing
I have been working on an essay length blog post. I want to branch into writing longer, more-focused, articles here. I love the shorter posts, but sometimes I don’t have anything to write about. Sometimes I just want to focus my creative energy toward something that requires more effort from me. These longer articles give me a chance to be a bit more creative and exercise my creative powers.

It’s also nice to get back to one of my passions: writing. Long before I went to college, I had a passion for writing and a passion for the sciences. When I went to college I majored in English with a concentration in Non-Fiction Writing. My original goal was to go into technical writing. That didn’t happen. I had to feed myself, so I got a “real job.” It’s nearly ten years later and I’m confident in my knowledge and ideas and writing abilities. It’s time to start writing longer pieces.

Working
For those of you how might not know, my client hired me on in November. They made me an offer a few days before I left to go to the PASS Summit and I accepted. This has been a big change for me. For the first time in 5 years I’m not a consultant – I am now responsible for the longevity of our data. With that added responsibility, I’m now the key decision maker for our databases (barring the budget, of course). In addition to my move onto the PASS Board and becoming a strategic thinker, I have to wear both tactical and strategic hats at work. It has been an interesting change and I’ve been fortifying the shop so I can do enjoyable things moving forward instead of plugging holes.

Working… for myself
I’ve been working on several side projects. There’s very little to report. One of the projects is a loose idea that will be hashed out over the next year and will hopefully become something great. Watch this space for more. I should be able to announce another one in a few weeks. And, the third one…

Well, I’ve jumped headfirst into the world of software development, again. My friend, Matt Nowack, and I (with some help from Brent Ozar) have been collaborating for the last two weeks on a project. There’s not a lot to talk about, yet. But the change in technology stack has been interesting. Rather than use a Microsoft stack, we’re using Ruby on Rails, a pair of Macs, TextMate, SQLite, and github to work together on this project. It’s been a fun experience getting back into development and considering a different set of problems from the day to day issues of a DBA. What has really amazed me, though, is how well all of these different tools have come together so nicely to make our development experience painless.

Restores
As an aside, I had the primary HDD in my laptop die not once, but twice, in the last few days. The first time it threw an error during a routine drive check that OS X thankfully performs. I had backups, so I booted the machine from the install DVD, plugged in my backup drive, and did a full restore with a low-level format. within 48 hours, the machine wasn’t booting and Seagate’s tools were reporting massive disk errors. Seagate’s tools also let me put in an RMA request through the tool itself and I have been informed that my new drive should be shipping soon. Meanwhile, I went down to a local computer emporium and purchased a new HDD. I threw it in the laptop (unformatted) and fired up the laptop with the install DVD in the drive once again. Within three hours I was up and running with a working copy of my laptop. I have never doubted the need to take regular, reliable, backups. After the events of the last several days, I am doubly convinced. Without backups, I would still be installing software right now.

The PowerShell of the Future

PowerShell Today

Allen White recently presented for CBusPASS about PowerShell. First off, I’d like to say thanks to Allen for driving down from Canton, OH to speak in person. He took the time to stick around afterwards and chat about a bunch of things that were on user group members’ minds.

Allen’s presentation covered the basics of PowerShell through concrete examples – automating backups, restores, and database creation. Throughout the entire process, Allen demonstrated many aspects of PowerShell that make the DBA’s life easier. Allen demonstrated how it’s possible to easily work with data from files, the registry, and SQL Server simultaneously through PowerShell. Many of these things would take a considerable amount of work with T-SQL, if they’re even possible at all.

Interestingly, one of the first things I was reminded of was how much PowerShell looks like a variety of programming languages, specifically Perl. One of the nicest aspects of Perl is that it’s a glue language. Glue languages help you piece together various pieces and parts of your servers that have no real way to communicate with each other. PowerShell makes it possible to do the same thing, natively, on Windows.

PowerShell, as part of the Common Engineering Criteria, is enabled in all of the newer Microsoft server products. So, you can be sure that PowerShell is available as part of SQL Server, Exchange Server, Windows Server 2008, SharePoint, and many other products that I’ve forgotten. This will make it easier to take care of a larger number of servers and diverse server products using a single language.

This is the state of PowerShell right now. PowerShell 2.0 is available with Windows 7 and Windows Server 2008 R2.

What’s really exciting is PaSH.

PowerShell Tomorrow

Object reference not set to an instance of a phone

Object reference not set to an instance of a phone

PaSH is an open source reimplementation of PowerShell for other operating systems – Linux, OS X, Windows Mobile.

Think about that for a minute… Did you really wait for 60 seconds to think about that? Good.

With PaSH I could VPN to my network, fire up my PowerShell prompt on my phone, and start diagnosing server problems. Or run a remote backup. Or failover a cluster. Or any number of wonderful and amazing things.

Here’s where it gets cooler: If PaSH catches on, we could soon see similar libraries for MySQL or Apache. Maybe someone will even write a layer that maps common Windows and SQL Server functionality to their open source equivalents. A heterogenous datacenter becomes a lot easier to manage when you can write maintenance scripts using a common language across all platforms.

Looking forward, this isn’t so far fetched. The open source community has embraced mono, the open source version of the .NET Framework – I have mono and MonoDevelop (the mono IDE) installed on my mac. It’s included in several Linux distributions by default. It isn’t that much of a stretch to imagine PaSH becoming an effective and accepted cross-platform administrative scripting language.

What is Your Biggest Weakness?

David Stein started a fun little game of blog tag and zapped Brent Ozar who, in turn, zapped me. The challenge here is to answer the interview question “What is your biggest weakness?” David’s answer was that he loves to jump straight into code. Brent’s answer is that he only wants to do things that he can do better than everyone else and only if he can do it quickly (Brent is what I call a Type A Slacker).

What’s my biggest weakness apart from a fondness for car keys and the gas pedal?

Well, there are two glaring flaws that come to mind. One is Brent’s raging flaw – if I don’t see myself as having any chance of being better than just about everyone, I don’t have a lot of interest in doing something.

As for my second flaw: if I’m going to do something and do it well, I’m also going to study that subject as if it were an academic subject. If I’m going to do it and I’m going to do it well, I’m going to understand why I’m doing it, how it works under the hood, and why it works that way. I will pursue the academic theory behind a subject thoroughly, sometimes far more than is necessary.

I love music. Over the course of my life, I have taken lessons in piano, guitar, and the french horn. I have taught myself the fundamentals of multiple percussion instruments, clarinet, and the fife. I’ve studied music theory formally in music classes and lessons and informally on my own. I’ve experimented with a variety of techniques to produce the sounds I want and have even taken apart and reassembled various musical instruments to gain a better understanding of their inner workings. Sounds like someone who likes music, right? Well, here’s the catch: I approached all of these instruments methodically, even though I wasn’t fully aware of it at the time. Ultimately, music became a passionate hobby: I knew that I would never be a great musician or composer. I didn’t have the drive or talent.

When I went to college I got a degree in English. I’ve always loved the written word. Rather than focus on analyzing literature, I studied the craft of writing. I read every book we were assigned on writing multiple times. I analyzed my favorite authors’ writing styles. I pared down my writing and built it up in other styles. I challenged myself to write about subjects I had never written about. I studied writing the way that many people study math or science.

I’m very lucky that I’m in a career where I can go beyond my immediate tasks, look inside, and find the theory that makes it all tick. It sometimes takes a good tug to pull me back from the theory to focus on the practical. Thankfully, so much of database development is based on a thorough understanding of theory that it’s okay to go off on a tangent.

Who is next in this game of tag? Matt Nowack, and Joe Webb.

Links for the Week of 2009.12.04

SQL Server

  • Kendal Van Dyke: Delegation: What It Is And How To Set It Up – The title says it all, folks.
  • wmarow’s disk & disk array calculator – Storage calculator. This wouldn't be terribly fascinating, except I know the performance characteristics of our I/O subsystem and when I plug in the variables, this is pretty close to real life performance. (Not directly SQL Server related, but it’s my blog so it goes where I wants it.)
  • A Loan At Last! – Brad Schulz thoroughly describes how to create a loan payment schedule stored procedure using nothing but T-SQL. The end result is beautiful to behold.

Development

Stuff & Things

How Do You Use SQL Server

Grant Fritchey took it upon himself to tag me in his most recent blog post about how we use SQL Server. The best part about this is I was just hired Senior DBA, so I can write with the unbridled enthusiasm of someone who is showing off a new car.

Here’s a little bit of background – my employer provides freight, utility, and telecom expense management services. In short, we pay your bills, we hand key your bills, we figure out how to EDI your bills – we do everything we can to process as many bills as possible every second of every day of the year. We were also a bank – expenses can be justified but you better have a damn good reason for wanting to spend 27k per CPU for Enterprise Edition vs 7k per CPU for Standard Edition. My production servers all run Standard Edition.

In a way, though, I’m very lucky. I have a homogenous environment. From development to production, everything is running on SQL Server 2008 sitting on top of Windows Server 2008. Every server gets patched on the same day.

On to the reason why you came here: how we actually use SQL Server.

Most people have an application tier that sits on top of some kind of data access layer that eventually talks to an RDBMS through some kind of query generation engine. The application tier makes decisions and does most of the work and talks to the database to get a result set and then pukes that into a grid on a screen somewhere. We don’t really have that.

Long before I arrived a decision was made to treat SQL Server as an application platform. SQL Server is the core of our business. Before someone gets all up in arms, let me explain.

When I said that we process a large quantity of bills I want you to think massive piles of paper bills being hand keyed by an army of people. Bills are being typed in, scanned in, sent in via EDI, pigeon, and Star Trek teleporter at all hours of the day. We are doing everything we can to process as much data as we can. We do batch processing. We do single line item processing. We do all kinds of crazy transformations on the data.

Guess where that all happens. That’s right: in the database. Sure, we have an application layer that sits on top of the database, but it accesses the database through stored procedures and views. Yes, there is logic in the stored procedures. I am very strongly of the opinion that universal data logic belongs in the database. We make heavy use of stored procedures, constraints, views, indexed views, summary jobs… all the traditional aspects of RDMBS development. We’re leveraging SQLCLR to keep some heavy lifting in SQL Server but move it into the CLR where it belongs and also to give us the ability to create high performance ad hoc reporting capabilities.

Things are very much in their infancy right now, I’m the first full time DBA at this company. Are things smooth right now? Not always. We’ve had runaway processes bring a production machine to its knees for hours. Our SAN isn’t configured optimally and I/O waits account for 1/3 of the time waits on all of our production machines.

Data is still coming into the database from a legacy mainframe application written in COBOL. The monitoring is still largely a collection of hand written scripts that were thrown together by myself and the previous DBA – my manager. On the bright side, both my boss and his boss were DBAs at one point. They understand my pain points and they’re willing to give me the time to get things up and running the way they should be.

In a few years, we’re replacing it with a brand new .NET application. We’ll still be using stored procedures for data access and business logic, but we’ll be expanding to use even more SQLCLR. We’ll also be picking up SQL 2008 R2 or maybe even SQL11 by that point and leveraging new technology like StreamInsight and Master Data Management. Hopefully I’ll be implementing things that were new in 2005/2008 but haven’t had the opportunity to use like Service Broker, Change Data Capture, and Performance Data Collector.

To me, this is heaven. SQL Server is in the place it should be – at the core of the business.

Victims, victims… I need victims… I’m going to tag Tim Benninghoff and Mladen Prajdić.

This site is protected with Urban Giraffe's plugin 'HTML Purified' and Edward Z. Yang's Powered by HTML Purifier. 230 items have been purified.