Author: way0utwest

  • I’m Going on Tour

    I’ve done quite a bit of speaking over the last few years, which has required a lot of travel. I had 15 events that I attended last year, only one of which was in Denver, so I spent quite a few days on a plane.

    sqlinthecitylogoThis year I’ve cut back a bit, with only 3 events so far this year, but it will get busy this fall. The SQL in the City events last year in London and LA were a big success for my employer, Red Gate Software, and this year we’ve decided to expand and build a mini-tour of events.

    We are back in London this July, for two dates this time on July 13, and 14. Friday is booked, but you can still register for Saturday, July 14 and come attend a free training event, which will talk about SQL Server issues and include information about how Red Gate’s products make you more efficient and effective at your job.

    This fall, we are going on a 5-cities-in-11-days tour all over the US. We have booked the following dates:

    In addition, we’ve added a sixth event in Seattle, on Monday, Nov 5, just before the PASS Summit.

    sqltoolbeltThese are free events, and we’ll have some tool tracks, talking about how to better get value from Red Gate tools, but we’ll also have tracks that talk about real issues you encounter as DBAs. I’ll be speaking, along with Brad McGehee and Grant Fritchey on writing better T-SQL, database maintenance, disaster recovery, and more.

    This tour is something we’ve talked about for a few years, and we’ve finally gotten the time, money, and permission for a tour. So look for us to be traveling through your part of the US. I’m not sure if we’ll have a real tour bus to travel in style.

    tourbus2

    With quite a few people coming over from the UK, and a frugal boss, our budget might end up supporting a tour in something like this.

    tourbus

    In any case, if you will be in one of the cities on any of the dates above, register today. It’s an exciting experiment, and one that I hope will be valuable for you and us, and something we’ll get to do every year in different cities.

  • Create Your Own Intense Interview

    Are you unhappy in your job? Do you work too many hours? Is the work environment causing you stress or unhappiness? In all of those situations, I counsel people to look for another job. Make a plan to move on to another position, or even another career field or industry. It can be hard, it can be a struggle, it can take time but we work to live, not the other way around.

    It always amazes me how quickly people settle for jobs, choosing the first position they can possibly get, regardless of the potential pitfalls or even known problems with the position. I know many people have bills and obligations, but you will spend a lot of your life in a job. Doesn’t it make sense to try and find a job that you enjoy, or fulfills you in some way. Or at least a job you enjoy going to most days?

    It’s hard to find a new job. It’s hard for companies to find employees that will fit into the organization and stay a long time. I’d think that most of us on either side of the interview table would want to be sure that we are entering into a good relationship. Companies ask lots of questions to try and learn about the candidate; candidates should do the same thing. Create an intense interview, one where you probe the company as hard as they probe you to determine the shape, scope, and size of the position. You don’t need to be adversarial to do this, but be thorough and do not be afraid to ask questions.

    I heard from a friend recently that went on an interview, and had done some research beforehand. This person jotted thoughts and questions in a notebook, took it to the interview, and made notes as the session progressed. I had never done that, but it makes sense, and I think I’d do that in the future.

    I do not treat interviews as some contest I have to win by impressing people. It’s a mutual meeting to determine if we want to do business together, and that mindset has served me well over the years.

    Steve Jones


    The Voice of the DBA Podcasts

    We publish three versions of the podcast each day for you to enjoy.

  • The Standing Desk Experiment

    I’ve had a few friends using standing desks for sometime. I first heard about Greg Gonzalez (sqlSentry | Blog | @SQLSensei), fellow runner and one of the smartest SQL people using a treadmill desk. I saw it in his office at SQLSentry a few years ago, and was intrigued, but I never tried anything. Then I saw Buck Woody (Blog | @buckwoody) build a standing desk at home, and still didn’t do anything. However a few weeks ago I ran into Buck in San Diego and we talked about it.

    And I decided to start.

    Photo May 16, 4 34 58 PM

    I bought a 4 monitor stand that clamps to a desk. I have been working with 2 monitors, but I had 3 set up for awhile and when I moved my desk I didn’t hook the third one back up. I’m actually tempted to add the 4th, so this was a good purchase.

    However I didn’t look at my desk. It has no rear lip. I tried clamping it to my wife’s desk, which backs up to mine, but it didn’t work well. The weight and torque were a little much. I was slightly stymied, but then decided that I could experiment with my desk in the basement. I use that one for podcasts, and it has a lip. So I started moving things downstairs. I started with my spare monitors.

    Photo May 26, 3 25 34 PM

    Once those were up, I shut down my desktop and dragged it downstairs, along with monitors and assorted cables. I hooked everything up and was ready to go when I remembered one thing. No Internet.

    We don’t have cables run downstairs, and I didn’t have a spare wireless adapter. Or did I? I “borrowed” the one my son uses for the XBOX, forcing him to deal with the built in one in the slim, which lags at times. However priorities matter, and I told him it would be a week or two and then I’d move back upstairs.

    Photo May 27, 4 35 10 PM

    No digital cables, or digital to analog adapters handy, so I’m with two monitors for now. I wasn’t sure how it would go, but I decided to just order a few DVI cables so I can actually test this well. I have 2 19” monitors on top and 2 23” ones on the bottom, but I may need to reverse things. I’ll experiment over the next week or so.

    I did a little minor work, including a podcast edit on this setup over the weekend, but it was like 30 minutes at a time. Today I added another box of books so the keyboard is above my elbows about an inch or so. Books are nice height adjusters for the test, so I can experiment a bit. I also raised the mouse as well, so it’s level with the keyboard.

    Today I’ve worked a few hours, and it’s definitely more work than sitting. I hesitated getting going this am, both because I’d be in the basement, and because I was tired, but once I got started, I actually liked it. Definitely tired, and I need to get some shoes for the afternoon to see how it works, but for now it’s a good setup.

    I’ll post more and add a few more pictures. It’s definitely a little out of sorts for me as I don’t have everything from upstairs. No speakers (headphones), limited power outlets until I move my other power strip down, and no office companion Sad smile

  • Detecting Database Option Changes with DDL Triggers

    One of the keys to managing a large production SQL Server environment is being aware of changes that are taking place in the environment, and preventing potentially harmful changes. There are any number of ways to do this: triggers, auditing, PMB, third party monitoring, and more.

    In this post, I want to look at a quick way to detect issues with databases using DDL triggers. Specifically, I will build a quick trigger that responds to the ALTER DATABASE event.

    Tracking Changes

    In general, I try to avoid those options that severely limit my flexibility. I dislike trying to enforce every possible rule I create since I understand that IT environments often evolve and change, and the hard rules you have today may not apply tomorrow. I also realize that most of the time the hard rules have exceptions to them for various reasons and it’s much easier to manage a set of instances if you expect that the might not have the same requirements.

    I do want to be informed of changes, and one option is a DDL trigger that responds to a particular event. DDL triggers have a large list of events that will trigger them, of which the ALTER DATABASE is one.

    We build the trigger by giving it a name, scope and an event. In this case, we’ll start with this template

    CREATE TRIGGER [name]

    ON ALL [scope]

    FOR [event]

    You can change the scope and events as needed. For me, I need the Server level scope (database changes are a server instance event) and then the ALTER_DATABASE event. From there, it’s pretty much normal T-SQL coding.

    The data comes back from the EventData() function as an XML fragment, so in the trigger, I need to parse out the particulars that I care about.

    The code I’ll use is this:

    CREATE TRIGGER DBAAudit_ALTER_Database
    ON ALL Server
    FOR ALTER_Database  -- Captures a Create Database Event
    AS
         
    DECLARE
      @EventTime datetime
    , @ServerName varchar(200)
    , @LoginName varchar(200)
    , @DatabaseName varchar(200)
    , @TSQL varchar(2000)
    , @event XML
    
    select @event = EVENTDATA()
    
    SELECT @ServerName = @event.value('(/EVENT_INSTANCE/ServerName)[1]', 'varchar(200)')
    SELECT @EventTime = @event.value('(/EVENT_INSTANCE/PostTime)[1]','datetime' )
    SELECT @LoginName = @event.value('(/EVENT_INSTANCE/LoginName)[1]','varchar(200)' )
    SELECT @DatabaseName = @event.value('(/EVENT_INSTANCE/DatabaseName)[1]','varchar(200)' )
    SELECT @TSQL = @event.value('(/EVENT_INSTANCE/TSQLCommand)[1]','varchar(2000)' )
    
    Print 'Database ' + @Servername + '.' + @DatabaseName + ' was altered by ' + @LoginName
    Print 'Command: ' + @TSQL
    
    

    When I create this on my instance, it is stored in the Server Objects \ Triggers area on my server. Just like any other object, I can right click and perform all kinds of actions in SSMS.

    ddltrigger_a

    When I execute a change on a database, such as setting a database to read only with this:

    alter database dba_admin set READ_ONLY
    

    I get this in the messages tab (from the Print statement)

    Database DKRSQL2012.dba_admin was altered by DKRSQL2012\Steve

    Command: alter database dba_admin set READ_ONLY

    If I set the database back to read_write, I get this:

    Database DKRSQL2012.dba_admin was altered by DKRSQL2012\Steve

    Command: alter database dba_admin set READ_Write

    This is a nice example, but in a real system, I’d use a database for tracking these changes and store the information from the event in a table. Instead of a PRINT, I’d insert data into a table that tracks changes.