Thursday, May 19, 2011

Powershell + Reporting Services?

I have a small need to produce some data in a much easier way than I have heretofore. The process that I currently do it this. I run a query that produces the table counts of various tables in a specific database. These results I paste into Excel. I then repeat that process on another database (the destination of replication) and copy those results also into the same Excel document. I have within this Excel doc a column of fields that are functions, indicating if the totals from the left are the same as on the right. This lets me easily check if the replication has caught up, and if not, which tables are missing data. Its crude and rudimentary, but a descent check on replication.



Now I have to do this for multiple databases. Repeat those steps multiple times. I dont like repeating things, unless they are fun things. This is not a fun thing. I kinda want a portal of sorts that i can click, and get the answer I want. This is not that solution.



I think about powershell. Hum... I could have a PS script that can pull the results of the table counts, and deposit it into a table. If I do this for each side of replication, for each database, I will have a simple table of results, and a simple SQL query will then let me show off only those records that are not equal, meaning replication is off on those tables. Hum... this is promising...

I easily create the script as the following.


  1. $DESTINATION="DBSERVER"

  2. $query = "SELECT
  3. @@ServerName as [ServerName],
  4. DB_NAME() as [DatabaseName],
  5. o.name AS [Name],
  6. i.rowcnt AS [Count]
  7. FROM sysobjects o
  8. JOIN sysindexes i ON i.id = o.id AND indid IN(0,1)
  9. WHERE xtype = 'u'
  10. and o.name in ( 'Table1', 'Table2')
  11. order by i.rowcnt desc"

  12. $Data = invoke-sqlcmd -query "Delete from ReplicationReviewResults where ServerName = 'DBSERVER' and DatabaseName = 'DBName'" -ServerInstance "DBSERVER" -database "DATABASEMONITORING"

  13. $Data = invoke-sqlcmd -query $query -ServerInstance "DBSERVER" -database DBNAME

  14. Write-DataTable -ServerInstance $DESTINATION -database "DATABASEMONITORING" -TableName ReplicationReviewResults -Data $Data

  15. $Data = invoke-sqlcmd -query "Delete from ReplicationReviewResults where ServerName = 'DBSERVER2' and DatabaseName = 'DBNAME'" -ServerInstance "DBSERVER" -database "DATABASEMONITORING"

  16. $Data = invoke-sqlcmd -query $query -ServerInstance "DBSERVER2" -database DBNAME

  17. Write-DataTable -ServerInstance $DESTINATION -database "DATABASEMONITORING" -TableName ReplicationReviewResults -Data $Data


This I repeat as many times as necessary. In my case, 3 times, with 3 different DBNames.
All this I shove into a PS script. I test it out and it works fine. It removes the data from the last execution, for a particular DBNAME and DBSERVER and then collects it again and deposits it into a central database on some db server. Simple. As long as connectivity exists, PS can execute, users exist, and all that type of config, I am able to execute this, and populate data. Woohoo.. Closer.

So now as I think about the portal idea... I think of Reporting Services. A report could easily display this data. Summed data or detail data. Something easily retrieved from the table ReplicationReviewResults. Easy. However, that data won't be accurate. It will be latent, since the last time that I ran the PS script mentioned. So... hum... What if I put that PS Script into a SQL Server Job? Could that work? I do have other PS scripts executing with jobs... that should work.

After testing the job and seeing success, I know have a way for my data to be populated. All I need to do is incorporate this into a Report with a step to call the job execution, then maybe wait a bit for it to finish, then display the data. Yeah!! However the user that can run reports doesnt have a lot of rights, and running jobs isn't one of them. He is a simple datareader...
So, after playing with granting rights to sp_start_job and even select on sysjobs, I'm still stuck. Duh...

I realize that this user needs to have Agent rights and recall that there are roles in the MSDB with something to do with Jobs. I add the role [SQLAgentOperatorRole] to this user, and they can in fact now execute a job. Woohoo. So I am now armed with a PS Script that is embedded in a job that can be executed by the user that reports run under. I create a proc, embedding the job start code along with the query to produce results, and then I create a report that calls this proc. Viola! I now have a portal that I can refresh, it retrieves new data, and displays that data to me.

Replication status updates as simple as hitting F5. No more repetitive tasks taking me minutes of my precious day...


Wednesday, May 18, 2011

Companies you love to love

We all know that there are companies we simply put up with. Others we hate. Some we love, but learn to put up with and ultimately degrade into a hatred. It happens. Time marches on and customer service goes down, priorities shift, things simply change and it goes from good to bad to worse, on occasion.

Back in college, I had a trusted adult in my church that ran a mechanics shop. I could call him and tell him my car was making a noise, describe the noise, and he would diagnose the issue and suggest solutions, over the phone, with no visit to his shop. As time marched on, we continued to take our vehicles to him for help and repairs. As his company grew, so did the dissatisfied service provided, until the day that we had to leave and find another mechanic. Sad. But it happens.

On the flip side, how often do you fall in love with a company, get treated well initially, but as time marches on, they treat you better and better? Think to yourself, list out the times that this has happened to you. I'm betting that it is not often that this happens. I can think of few examples myself. However, as the title of this post suggests, I have one such example.


Lets talk about "this Company"

Years ago, as a young Database Professional, I heard of a company that had a simple tool that compared databases. This wasn't rocket science, but it did prove handy from time to time. I used the tool, more and more. As the company made progress, they made the tool better, and soon branched out into other tools. I do recall thinking that this was a mistake, that doing too many apps or tools would cause them to loose focus, and the tools I had grown to love might suffer, and the company, like so many others, would go down in my eyes. I have been involved in a few different levels as an outsider with this company. I even made a little money for doing usability testing on various products. I had used the product, and they wanted to know some information from me, and I freely gave that information. The payment was a bonus, I thought. I woulda given the info to help out. But was glad to get something back from them. In fact, the motorcycle gear bag I won now, and have used for many years, was purchased using part of that money. It made it easier for me to put in the rest of the money on the bag myself. I think about them every time that I ride and enjoy using that gear bag. Ironically, its red. Not because of anything other than it was the best looking bag at the store at the time. But I find it funny that it's red.

So the days, weeks, months and years march on. I continue to try out products, continue to use the old standard apps and tools, continue to simply use what they have produced and love it. So many times one of their tools has come to my rescue and helped me out. 9 months ago I finally took the time to dig into the API and write an app (a feat which i had almost forgotten from my developer days) that generates snapshots from all the databases on a server. Simple task. However using their tool saves me tons of time from manually doing it. And using the API saves me even more time. Minutes compared to hours. Recently I purchased a monitoring tool that has given me the peace of mind that something is always watching my database, and will let me know when or if something goes awry. Being a single DBA with no NOC to watch my systems, this has greatly improved my life and as mentioned, peace of mind.

All this is praise for a job well done, and should be expected of a company providing tools and apps and simply trying to sell their wares to us. However, this company does a bit more. They interact with the community and you as an individual. I have many stories that I could tell you. Some of them involving some funny situations. Find me someday, and I will relate them to you. The best involves a bio break + phone call. But the one I wish to relate today is the personal touch that they perform that affects me and my life. They reach out and in a way no other company ever has, touches you. They make sure that you know you are important to them.


The actual Story

The story is simple and short and happened in the last couple days. A few months ago I received a package from RedGate that contained some swag. One of the items was a lanyard. My son saw this and wanted to have it. He transitioned it into a school badge holder, which he wears to school every day. Monday of this week he participated in a school play, and was proudly wearing his Red lanyard along with his play costume, which comprised of a few pieces of gold material around his wrists and head. I took a picture of him in this getup, with the proud smile. Since he was wearing the lanyard, I figured I should share this with the twitterverse, letting RedGate know via hashtag. Her is the picture.



This photo is me just showing my support for my son and by extension for RedGate.

A day later, I received a picture from RedGate that showed that at least 10 people were thinking of me and my son and wanted to touch us from across the pond. Here is that photo.



How awesome is that!?!?!? Have you ever had a company go out of their way to show their support for you in such a fun and silly manner? Simply having a good time, but at the same time, making that connection that we have both forged over time that much stronger. I owe each of these individuals a hug or a heartfelt hand shake, which ever they feel most comfortable with. I bet though, by looking at the that way they responded, they'd opt for the hug.

Way to go guys. You made quite a few of us happy today with this response, and I can't wait to show my son later today what you've done for him also.

Thanks.

You already have my loyalty and appreciation and even a bit of my and my companies money. This is simply over and above. And we love you for it.

Wednesday, May 04, 2011

running, working out

If you are like me, you may have noticed that you are not getting any younger. In an effort to further my existence here on planet earth, and ensure that I have time to attempt to understand all that Paul Randal says on a daily basis, I need a lot more time ahead of me. A lot of time. In order to ensure that I stick around, one thing I can do is watch my health. Inclusive of many other things I can do, working out is high on my list. It used to not be, and in the past few years has increased in its priority. Due in no small part to the constant reminder of a great influence on my life that is embodied in the person we all know as Steve Jones. Seeing his constant reminder of what he has done on a daily basis for his health has propelled me forward when I really didnt feel like it to do my own exercise. Not to keep up. Not to compete. Simply his shining example has fortified my resolve, allowing me the extra added boost on more than one occasion to go that extra mile and get off my butt and do something. It is so appreciated and I find it a daily reminder to get up and do something active. Thanks Steve.

It is at this point that if you live in Colorado, near some horses, and answer to the name Steve Jones, you should stop reading this blog post.

Thanks for reading thus far, but seriously, this is for everyone else now.

Ok, I think he's gone. If you fall outside of the above criteria, and have found yourself influenced by Steve to go a little more, dig a little deeper, I'm interested in hearing your tale. Email me at tjaybelt@yahoo.com with your story or words of thanks or whatever. This is an idea in the inception only and I simply want to do something to say thanks back to him for his influence. Especially as he approaches the landmark goal of 1000 sequential days of running.

Monday, April 04, 2011

Meme Monday

Tom LaRock started a Meme Monday challenge.

Write an 11 word or less blog post.

Today’s meme is “Write a SQL blog post in 11 words or less”

I wrote Multiple...

-------------------------------------------------

It's Monday! Again!

Fine!?!

Let's get through this quickly and efficiently!!

-------------------------------------------------

Hello Monday. I wonder what jobs failed over this last weekend?

-------------------------------------------------

Good morning SQL Monitor. What did you see happen this weekend??

Friday, March 18, 2011

I have a backpack

I won it at a Microsoft Event many years ago. It says Microsoft Insider. Its an OGIO branded backpack. I have used it to daily transport my goodies to and from, between work and home. Almost daily I will grab it, with a laptop inside, some power cables, various other emergency cables of all varieties, spare mouse with batteries, an MP3 player, and so on. It has become the haven for holding all those precious things that I may need and use for electronic uses. When I go on a trip, I can typically grab this bag, throw in some cameras and camera chargers, and maybe a book, and be ready for the weekend. Whatever happens, I've got a cable or tool in that bag for what I may need. As you can tell, I practice the motto 'Be Prepared'.

Ive done this as far back as this backpack has resided in my possession. Although the actual items have shifted during said time, the existence of these items, among any others that seem necessary has been constant. This bag has a place to rest at home. A thrown if you will, where only it lives. Its near the door, so I can grab it easily on the way out the door. At work, it always goes in a similar place of glory. Always where I can get to it, see it, be comforted by its existence and all it stands for.


Whats the point of all this? We'll get there...

So, I changed jobs recently. I no longer have a laptop to bring home at night, nor to bring back to the office in the morning. I no longer have that single power cable for the laptop. My bag is a lot more light these days. But I continue to bring it back and forth. Now, the only purpose to do this is habit. The extra cables and power supplies and what nots are simply that, extra. Usually used in conjunction with a laptop. Either at the office, at home, or away. So, without a laptop in the bag, whats the point? It becomes a bag only. Not a super special device to hold all my special things. It ceases to have the purpose it once had. And I believe that it is silly for me to bring it back and forth under the old habit, since my circumstances have changed.

Get where I'm going yet? This applies to us as Database Professionals...

Sit back now, look at what you do, day in, day out. Analyze these actions and detail to yourself which of those actions serve a purpose, accomplish a goal, and which are simply formed from habit. Those that are only habitual, really dig deep on them, and tell yourself if they still serve a purpose or not. I bet you will find some that you simply do because you have become accustomed to perform said action, and they may no longer be needed. If you do not have any, congratulations. Or maybe you didnt take as honest a look at your tasks.

As for me, my bag is at home now. Still holding its collection of extra tools and what nots. But its not at the office. This entire week, i forced myself to not grab it and bring it. Forced myself out of my comfort zone to see if this tool, this crutch of a habit is really necessary. The jury is still out on that. I may need more time to fully realize the results of this small action. But I took the step to analyze myself, my actions and the usefulness of that tool. I hope you will do the same.

Monday, March 14, 2011

I'm Addicted, I'll admit it

Before I started this new job of mine, (nearing the 3 month mark as we speak) I had heard of this little tool that i envisioned would make my life easier. In this role, I am a solitary DBA, in a shop that has very little visibility into the database systems. DBs were setup, configured, and if worked, were left well enough alone. Until something bad happened, no one really looked at them.

With my new task to be the Administrator of all things Database, I was concerned that something would occur when I wasn't sitting in my chair. How could I know what was going on on the systems in the early morning hours? What about later at night, while I was unwinding from my day? And lets not even talk about the weekends... those were the worst of all. What if something happened, while I was out playing... how would I know? How could I react quick enough to solve issues, how could I be informed?

Well, all this was a concern and had been addressed when I installed, configured a special piece of software called SQL Monitor, by RedGate. Once configured to my likes, it would capture events, send me alerts, even keep track of what had happened. I was freed up to do other tasks, as I had a monkey in the background collecting and monitoring for me. I love this monkey. I have grown accustomed to having him around and letting me know whats up.

Then came this last weekend, when everything went to, well, it wasn't what I was expecting. Last week, after an extension or two of my trial period expired ( I have yet to get the money makers to get me the money to purchase the product), I was left without a window into my database. It was amazing at how quickly I was able to become addicted to this software solution and rely upon it. I had found myself checking my phone (personal cell phone) periodically when the little blip went off that let me know I had received an email from work. Sometimes it was an email from my favorite monkey (SQL Monitor) that I had left back at the office to tirelessly watch my db. Sometimes I had to deal with the alert. Sometimes not. But it was always there, swinging in its cage, keeping an ever persistent watchful eye on my systems.

However, this last weekend, my monkey stopped working, because my trial expired. Addiction at its worst. I went into withdrawal. I didn't know what was going on. I had to check it manually, periodically, to ensure things were ok.

So, what have I learned from this experience? I warn all those of you thinking about using SQL Monitor. Don't do it. I mean, don't do it, unless you are willing to allow yourself to become addicted to its features and information and alerting. Don't do it unless you want to find yourself falling in love with an imaginary monkey that watches your systems without fail when you are not in the office. Don't do it unless you like offloading the automated digging into your systems, the automated alerting of issues, the freedom that this product grants you to do other tasks while it consistently does its prescribed tasks.More importantly, don't install it, become addicted to it, rely upon it, unless you can get it purchased quickly and not become disconnected from its addictive services. This I experienced this weekend. It wasn't nearly as fun as previous weekends when it simply worked, simply monitored, simply kept my sanity in check...

I have now received an extension on the trial again. I am plugged in. I got my fix. I can last a few more days. During this time, I MUST get the monies to purchase the product, so that I can continue having my fix. Continue to get the steady drip of love from #Red-Gate and #SQLMonitor. Allow SQL Monitor reach out its virtual hands and together we can grasp the greased rope holding on to my sanity. (who's quote is this? "even the most well- adjusted person is holding on to his or her sanity by a greased rope.")

I do enjoy the product, and have become used to its usefulness and features. I have become addicted to it. I need it.

Wednesday, March 02, 2011

The log for database 'Borked' is not available. Check the event log for related error messages. Resolve any errors and restart the database

I found that a small database across the country that no one really thinks about often was giving this message. I was made aware of this thru a series of events that led me down quit the rathole. From one thing to the next and the next, and finally finding this to be a core issue in the event logs.

Its a little database. It does a small specific task.Let's call it 'Borked'. It was part of a maintenance plan that performed backups, and since the log file was unavailable, it was unable to backup. Luckily this was part of a maintenance plan, so when it failed at the beginning of the process, it also prevented any other databases from backing up. Yes, that was facetious. This was one of the items along the rathole that I found out. The issue came to my attention as folks noticed that some data was out of sync. Borked DB that lives on this db server is copied elsewhere and restored, and reports are pulled from it. This data on the report was out of whack. Because there were no new backups of DB X, because DB Y had an issue... part of maint plan... yeah...

So, I do some research online, and see people suggesting DBCC CheckDB on this DB. However, when I attempted to run this command, it would tell me the same error. Odd. Looking into the errorlogs shows me that its been happening for quite some time, about 20 days, and the first instance of it showed me nothing of note in the Error Logs that could point to any other issue. There are 4 other dbs on this DB Server, and they are all ok. Before touching this Borked DB, I ran DBCC CheckDB on all the others, and performed manual backups. I also removed the maint plan and instituted individual backup jobs. I tested each of these, and the next day confirmed that they executed properly. So, all was well with the other DBs. But nothing seemed to work on Borked.

Being worried that there is some corruption, that I may loose data, coupled with the fact that 20 days have transpired without a descent backup, I was obviously worried about the data. I created a new database, and exported all the data from Borked to BorkedData db, to keep track of it. I blew it on this step, since I had not initially created the objects as they were in the original, they were stripped down copies of the tables (missing Identities, missing constraints, etc). So now I have a copy of the data, but the schema is a bit goofed. I take some more time to actually use #RedGate tools to make a copy of the database, then export the data, then compare again to ensure that me BorkedNew database has all the proper objects and data. Whew.

Now I am free to futz with the Borked. Obviously some tasks have been attempted already, but they all resulted in an error message about a missing log file. Not much more help than that. So my obvious thoughts went to detaching the DB, and bringing it back online thru attaching it again. This seemed to make sense in my head, and was the direction I had headed since the inception of messing with Borked. I had to get my ducks in a row to ensure that I could restore it, if the need arose. Thus all the moving of data, copying of schema, etc. Just to make sure I had a copy. So, I get ready to detach Borked and reattach it. I create all the scripts, double check the paths, and simply make sure all was in order. I envisioned that this would be a quick 1-2 punch. Detach. Attach. Viola, no one the wiser. Keep in mind that there is a web app using the DB, but its not highly used, so a small interruption would not be noticed, or so I was told by the 'owners' of this system. I use the term 'owners' in the loosest sense of the term. I have now spent more time vested with Borked than anyone else in the company, so technically, I am its new 'owner'. Anyway, I digress. We are about to detach and attach the db, which in my mind will release it, and then upon attaching it, will reinit the link to the log, and somehow make life happy again for little Borked. I pause, looking over the script one last time, ensuring I have selected the appropriate T-SQL... pause for effect, then execute the fateful code.

I know, you are expecting that this is the end of this story... But no. It is not. What happened? same thing as all other attempts... Error about the missing tlog. Crap. Crap Crap. Ive prepped, Ive backedup. Ive copied data. Ive ensured I can restore. I have the entire DB copied elsewhere. and that backedup. Yeah. What to do now.

So, I right click it, and goto tasks in SSMS, and notice the small menu item I have rarely used. 'Take Offline'. Hum, not quite a Detach. Not quite a Delete. Something I've honestly, rarely performed on a DB. So I click it. And sure enough, DB goes offline. There is a nice little icon next to it that shows me its offline. Well, at this point, it seems that there is only one choice. That is to 'Bring Online' again. So I now click this. And viola, Borked is now online.

I go to the script that I had saved that had all other attempted commands I had previously executed against Borked. I ran a DBCC CheckDB against it, and it succeeded. I then realized I had fodder for a Blog post, and started writing this. About the time that I wrote the word 'Take Offline' in the paragraph above, I actually went back to the DB to ensure that was the proper term, and realized I had yet to backup this database, after bringing it back online. Doh! What a dork. So i obviously kicked off the backup, and it succeeded.

Viola! my little Borked db is now online, and all seems well. Had I known this little caveat, I might have performed those simple menu items yesterday, instead of worrying about getting backups, moving data, digging into the processed, and all that. But, the silver lining is that this little db Borked now has a new owner. One that knows more about it than others, and will love it for years to come. Even if it cant figure out where its tlog went and why it can no longer access it. Fun Times !!

Monday, February 28, 2011

swwug 2011

I have been invited back to present for the SWWUG vConference in April. I will be flying down to Tucson on March 8th and recording my 4 sessions. These are not the exact titles, but from the top of my head.

Documentation. You know you love it.
Data file sizes.
Profiler / Traces
DBA Tasks

At this point, Documentation has been completed, and actually practiced as a presentation already. The others are nearing completion. I had set a goal to have them completed by this last weekend, and failed to accomplish that goal. I have a bit more work to do on some of them. But most are already well planned and created. Just need to be fluffed up at this point.

One of the tools that I used to help me was a mindmap software where I simple was able to link ideas together and list them all out. I used a couple different versions of the software, and a few different computers, including my Galaxy Tab, to simple brainstorm with myself and come up with the skeleton for each presentation. I believe that I will actually use this document in the the Documentation presentation, as an example of how to simply start documenting. Its been a work in progress, and the mindmap software allows me to simply keep adding ideas to the map and utilize those when the time comes to flesh out the presentation.

I'm nervous and excited, as always, as the date approaches. I love the creative process, I love actually presenting, I love teaching and talking and always hope that i can do a descent job and help folks. However, its still a nerve wracking process. Once its all done, I always appreciate the effort put into it, the experience as much as I do that its over. Its a funny process to look forward to something that scares you, kinda like a rollercoaster. I keep getting back in line for another ride, but am scared while in line and on the ride, yet I always return to the line and ride.


Tuesday, February 15, 2011

SQL Saturday 66

This started out as a simple review of the SQL Saturday 66 in Colorado Springs. Then it needed some back story. Then it simply became a novel. So, enjoy, or jump out now. Your choice.


Sometime last year, I decided that I would try to get to some regional SQL Saturday events. It didn't know exactly how I would accomplish this, for there were a couple obstacles standing in my way. The first was time.


The second was money. Those were the big ones.


Time was hard to come by, as it seemed that I didn't really have a lot of time to do professional development since it consistently seemed to be impacted by work. Ironic that I was unable to learn about skills that would help me in work, because I really needed to be at work instead...


Money was a difficult resource to acquire and use for this type of venture. Its benefit is obvious. Its a great education and networking opportunity to attend any SQL Saturday event. Yet it was always difficult to come up with the slush money to fly myself and get a hotel, car and anything else needed in order to go to somewhere else for a couple days.


Let's keep it simple, and keep it to those two obstacles. Time and money.


If I was one of the lucky ones, those that work at a company that has a vested interest in attending an event such as this, I'd be lucky to be sent, with expenses covered. This is an obvious win win for company and employee. I, however, am not one of those few lucky ones.


There are also those that are in the consulting gig that see their attendance at these events as a business expense to drum up potential business for their own company and skills. This is a noble gamble to bet on yourself, all the while giving back to the community as you do. This is a win win as well. I am not one of these either.


I'm just a working stiff, like many of the other DBAs and Database Developers out there that attend these events. However, something changed in my life a couple months ago. A job change changed everything. I now have more discretionary time that allows me to attend an event like our beloved SQL Saturdays. So, the time element was relaxed and I decided to simply throw the money part out the window. After discussing it with my CFO, she and I decided that we'd spend the money to fly me to a location and spend a couple nights. I can keep it cheap, and doing so would allow me to learn, grow and experience professional development on a budget.


So, I looked at the events coming up, and thru my hat into the Colorado Springs SQL Saturday event. It's close by, and I know some of the folks from the area. I am also the Regional Mentor, so it would be good for me to meet more of the local SQL people and get some face time with them as well as their leaders in the community. From my house to their home is about a 10 hour drive, and with the gas prices as they are, it would be 6's to fly or drive as far as cost went. However, there is a significant cost to spend 10 hours driving, instead of 2 hours flying. So a choice was made to fly to Colorado Springs. A couple nights in a hotel would be $50 or so, maybe $100 each. This isn't too bad of a cost. But its still a cost. I had a few opportunities to cheapen my hotel cost with a few options that presented themselves to me. One was to rent a cabin with Chris Shaw (twitter|blog) and split the cost. Another was to split a room with some local community people. Another was to stay with a good friend that lives in the area. Since this last option was going to give me some good time to catch up with a good friend, i chose it and made arrangements to spend the night at his place. In order to get there with enough time to hang out, I decided that I needed to fly out a bit earlier (1:50pm) instead of the later time (8:00pm).


This decision meant that I needed to ask for a bit of time off on Friday to leave early. This means I need to talk to my boss. In the past, when events of this nature occurred, this didn't always work out well. When work seems more important than anything else, a SQL event falls way short. I was worried to ask, but needed to, and did. As I informed my boss, he started asking me questions. The conversation went something like this.


Me: I need to take off a bit early on Friday to fly to a SQL Saturday event.

Boss: What is this event?

Me: Its put on by individuals for individuals, part of the SQL Community, all over the nation.

Boss: This sounds like a Professional Development event

Me: Yeah... (waiting for the hammer to fall, some excuse why it would be difficult to attend)

Boss: This sounds like something tht we should be paying for.

Me: (shocked) Yeah.


This is the simple version, but they decided to not only allow me to take off a bit early on Friday, but they were intending on paying for the flight and hotel. I was shocked and amazed. Time and money. Solved. Woohoo!!


Off we go to SQL Saturday in Colorado Springs.


Luckily, as the dates approached, my friend Randy Knight (twitter|blog) also decided to attend. This meant that we could travel together and split some of the costs. We headed up to the airport Friday afternoon, and after a moment of slowness as we passed an unfortunate accident, we were again on our way, albeit a bit late.

Once at the airport we cruised thru security, leaving only a single bottle of Strawberry Jam behind that apparently is insidious enough in nature as to not be allowed into the airport proper for fear of use as a weapon of some sort. This bottle was an intended gift for the wife of my buddy, as a thank you for allowing me to spend the night at her house. It was also a bottle canned by my wife at the LDS Cannery, which made it something special from us to them. It was not meant to be though...


The plane ride was uneventful, dumping us into a different version of winter than we had at home, but similar enough to not be terribly different. As I left the airport, and watched as Randy grabbed his rental car and departed, I waited for my ride to appear. Even though it was clear and sunny, I was soon cold, having forgotten it was winter here too. I stand outside for a bit, until i start communicating with my buddy. The text messages and voice conversation soon took an odd turn as questions were posed but unable to be answered to anyones satisfaction. It turned out that my ride was in Denver at the airport as I was standing outside the airport in Colorado Springs. Funny. Even funny to us at the time. A bummer. But funny nonetheless. What a mix up. With all the communication tools that we have and at our disposal, neither one of us seemed able to clearly indicate which airport I was arriving at for this event. Funny. Sad kinda funny, but funny nonetheless.


I end up calling Randy back to retrieve me, as he had a head start to the speaker dinner from the airport already. Luckily he was able to return to get me, leaving the nearly empty freeway to return to the airport with plenty of time to allow the rest of Colorado Springs residents to embrace the Friday afternoon rush hour traffic, allowing us to gain a more full experience of the clogged freeway. This irony was repeatedly brought to my attention by my new chauffeur as we were stuck driving behind residents on their way home from work. We took off, driving north to the speaker dinner. We initially went to Randy's hotel to check in, and I even checked on a price for a room there that night, in case I wasn't able to hook up with my friend for the evening. I then checked on the hotel that I was going to stay at the next night, to see what the price would be for the first night, again, in case. After this, I went to Mr. Biggs to assist with the preparations for the event in any way that I could. It was great to meet some of the speakers and organizers. I already knew Marc Beacom (twitter|blog) from past SQL Community events, and it was great to catch up with him. He was the only person that I already knew IRL though. The others, some friends, others acquaintances, were mostly known to me via twitter already. I got to give Chris Shaw (twitter|blog) a big bear hug to great him as we had become friends over twitter, facebook, Im and email for the past couple years. I have always felt like he was a brother. Funny how our community becomes family. SQL Community -> #SQLFamily.


Soon it was the speaker dinner and time to shmooze, cavort, meet, discuss, talk, enjoy and share. It was also the first meal of the day for me, as I had barely eaten anything for breakfast and completely missed lunch because of the time suck that flying can be. Luckily I survived on some snacks from my bag while on the plane, as well as those incredible Biscotti cookies. Dinner was great and we had a great time talking to new people. One of which, Jeremy Lowell (twitter|blog), was nice enough to allow me, a stranger, to get into his vehicle and deliver to the house of my friend for the evening. Jeremy was headed home anyway, which turns out was about 5 minutes from my end location. So it turned out that it was a win win for us. We talked about SQL, but soon turned the conversation to other random topics that we found out we had in common. Its always amazing to meet people in these events that are just as human as you with the same concerns, ambitions, interests and whatnots. We had a great time talking for an hour. A friendship began.


Once at my buddies house, I was honored to meet the kids. Gifts were given, minus the Strawberry jam which now lives in a trash in SLC airport. Soon we were simply talking, telling stories, and having a great time. We both do woodworking and it was great to see his work space. Later in the evening I was even able to help feed the horses, which made me feel like I was channeling Mike Rowe as I attempted to perform a task I was unaware of how to perform. Standing in the cold Colorado night, helping feed the animals in the snow was invigorating. Fun to do once. Once back in the warmth of the home, it was time to get to bed, so that we could get up early the next morning and make the 1 hour commute down south to the SQL event. Off to bed we went. Me, grateful for the time spent, the stories told, the experiences had and the roof over my head and bed offered within their home. Thanks.


The next morning had us up early to make the commute. After stopping at a gas station along the way, and after purchasing the first cup of joe ever, I was able to make a small effort at paying back my gracious host for the previous nights lodging. We had a great time talking about many many things and I truly enjoyed the time we had to spend together as the sun chased us. Soon we arrived at our destination and got on our game faces. It may seem otherwise on occasion, but we are all geeks at heart and want to simply sit in front of a computer, shunning human contact in all its forms. Attending an event such as a SQL Saturday seems against our nature, but it is such an important part of our Professional Development that we suck it up and go and put on our game faces, getting ready to talk and interact with each other.



Luckily Chris Shaw and the other organizers thought of this and planned to have many networking events that forced and allowed us to interact with each other, getting to know each other. The first event gathered us together in disciplines, into two circles. One inner circle faced an outer circle, one to one. We were to take 2 minutes with each person in the circle and perform some SQL Speed Dating, answering 2 questions. It was a simple exercise and allowed me to introduce myself to 13 people as well as get to know them. It was fun. Soon the sessions were underway. SQL Lurn was ON! Between each session, a networking event occurred. The first I chose to participate in was Lazer Tag. What a rush. This is always such a fun activity and we all seemed to have a blast shooting each other. There was lunch, which allowed us a chance to eat and talk with each other, performing our own networking discussions while cramming pizza into our gullets. More sessions and more networking occured. Lurnin and Networkin. Over and over. It was great, well organized, and well participated in by all.


I ended the day with my session in the last slot. I had participated in Lazer Tag just prior to my session in one of the networking events, which got my blood pumping and ready to stand in front of a group of SQL peeps and discuss Documentation. I believe that the session went well, and we had good discussions. Many speakers attending my session, which was always a bit nerve wracking initially, but enables me as a speaker to engage the audience even better than typically, as these are now friends and family that can be pulled into the discussions easily.


After the sessions, we had one more networking event. We all had to make a trek across the family fun center to the sand box, and retrieve an easter egg. Inside each egg, for each member of the event, a prize awaited them. The organizers had gotten many items to give away and each person received something. It was well received and I believe everyone went away feeling a bit more special at having received a thoughtful gift for simply attending. It was a nice touch.


And just like that, as quickly as it started, it was over. It was such a full day, with so many interesting topics, great knowledge, great networking, that it blew by so quickly. I for one barely noticed that I had been on my feet for many hours, had done a great many different things as well as learned and gotten excited about SQL stuff. It was exactly what was needed. Many thanks go out to the organizers. Great job!!


After the event folks retired to the bar to continue networking. I don't drink, so tend to not spend a ton of time at the bar, but did take the chance to relax a bit, talk a bit, and continue to network and build those relationships started previously. Discussions about the event ensued, Regional Mentor duties were performed with various members of the community, help given to those folks looking to setup new chapters and needing some ideas to get them going, and friendships were continued. It was a great time.


Randy and myself departed, after many handshakes, fist bumps and a few hugs. We took off to go get some dinner and relax before our 4:30 am start time the next day for the 6:00 am flight. Dinner was quick, once we finally found a place, got a seat and got our food. Having forgotten that this was a Saturday night and that many other people also wanted to eat dinner, we were slightly delayed in our own goals. Dinner did occur, bellies were filled and more discussions were had about SQL and other topics. Finally, bed awaited, its siren song calling me to slumber at 8pm, finally falling asleep sometime around 9pm. Rare for me to retire so early, yet needed to make the flight the next morning.


The next morning came quite a bit earlier than I could have expected. Its always funny to drive around in the dark, knowing its morning, yet being deceived into still believing its night. An odd juxtaposition. We arrived at the airport without a problem, albeit at the ungodly hour of nearly 5am. We got thru security easily, except for the TSA groping that occurred. Ironically I tend to travel in a tshirt and sweats, releaving myself of a belt, buttons or anything that would pose a threat to the metal detectors. However, this was the reason the TSA groper choose to use to get close and personal with my persona, the baggy sweats. Funny.


After arriving home a couple hours earlier than I would normally wake up on a Sunday, it was all over. I was home. Early and tired and spent. I laid down and rested for most of the day, getting ready to start my normal work week. Good times, good friends, good knowledge. Forging existing relationships and building new ones. Making the SQL Community into my SQL Family. Thats what I see occurs in these events.

Long live SQL Saturday!!!

Thursday, January 13, 2011

SQL Monitor - giving it a whirl

I recently started a new gig, and there is little monitoring occurring on the database systems currently. Happily enough, I am aware of a fairly new product called SQL Monitor from RedGate that says it can fill the bill nicely. What better time to try it out than now?!? I get myself a copy of it and install it to my local hard drive, web presence and db together ( i know its not the best installation scenario, but its worth giving it a try). I initially only set it up to look at my machine, which has little or nothing going on on it anyway. This is done for a day or so, to see what sprouts up, what it finds, and what it suggests on a quiet system. It still finds plenty to complain about, like missing backups, no tlog backups, no maintenance (DBCC CheckDB, or as they are called in the tool, Integrity Checks). Plenty of entries appear each day. I was particularly fond of the Long Running Queries that it came across, especially when these were actions I was taking to remediate other issues that it had found. I found some of the Long Running Queries funny to me, since they were judging this execution against past executions. Lets say I had a process that took 5 seconds to run once. The next time it took 10 seconds to run. Well, this is twice the previous time, and warranted an alert as a Long Running query. Don't get me wrong, I can see the irony that a job that takes 10 seconds once and 5 seconds the next time is labeled a 'Long Running Query'. But the alternative is to have this process run, take twice as long, and no one be the wiser. I would rather know, and deal with it, remediate it, or ignore it than not know.

After watching my boring database, I turned it onto a couple other systems. It found a lot of the same things, which prompted me to create jobs to take those actions into account, and perform them on a much more regular basis than before. I had already launched into fixing the Backups from being a single Maint Plan for everything, to individualized jobs that would execute in proper sequence, and order, with proper notifications going to the newly minted email list 'DBAlerts@mycompany.com". A couple more processes in place, and I had all but eliminated those alerts that SQL Monitor was complaining about. The next morning, though, I was surprised to find myself inundated with over 300 alerts from one of the databases. It's a good thing that I hadnt hooked up email alerting to this yet, or it would have been a miserable night of sleep. As I waded thru the alerts, there were some obvious items that were of valor, and needed to be fixed. More processes needed to be added to the systems. Or the alerts needed to be configured to be a little more forgiving, or disabled, whichever be the case for the particular database and its alert. This went on for a few days, until the majority of the alerts were related to Long Running Queries again. From these, I have compiled a list of distinct queries that need to be investigated. When others within the company are asked if they recognize these particular items, they all sigh, groan, say how nice it is to have someone seeing these things, and more importantly, grin when they realize that they may in fact be 'dealt' with at some time, instead of simply ignored, as has been the process heretofore sans a DBA.

So, after dealing with a few days of many alerts appearing, two days ago, i simply wiped them all out. Keep in mind that they are still stored in the SQL Monitor system, simply with a cleared setting, so that they do not obfuscate the main portal shoeing 'active' alerts. I eliminated them to give me some breathing room, and start a new baseline of activity after having configured many alerts. The one that seems to appear the most is 'Long Running Queries', and I have not configured this one in any way, as it doesnt get specific with SQL Statements that can be ignored. Whereas Unusual Job Execution times are not only specific for SQL Server instance, they are for job name as well. So a similar job on 2 systems can have distinct handling of the alert, based on its specific configurations. Allowing for more leniency on one side and more strictness on the other, for example.

Its not all rosy and shiny though. I have had some alerts raised that when I clicked on them to dig in, the app simply coughed up an error. Support let me know that this is a known bug and will be fixed. When you click into an alert to handle it, there are a lot of options, but when you are done, you have to go 'back' to the alerts page, often losing your place. I wish that there was next or previous button within the actual alert, such that once the alerts is dealt with, you can traverse the list to the next one more easily. When you add a comment to an alert, there are 4 controls, 2 of which are buttons (cancel and the other, maybe its ok, i cant remember). Point being, when you add a comment, and then tab from the comment control, its actually highlighting on the cancel button, though you cant really tell, but if you hit space or enter at this point, it cancels the comment. I cant tell you how many times i have written the most beautiful comment, only to have it wiped out by my quick fingers on the apparently wrongly focused next key. I know that there is a lot left to learn about the product, and look forward to learning it, either on my own, or via training from RedGate (free webcast on the product is coming up in a week or so).

I'm almost out of time on my evaluation period, and have not been given the money to purchase the product yet. I may have to request a bit more time to test it out. Since I installed it locally, I do not have access to see it via any webpage, except my own host, and I am unable to send emails. Both these functions, i believe, are important to a true review of the product. I will attempt to get it onto a true web box soon, maybe tomorrow, and get it visible to me at least, via web page.

This is a rather quick run thru of the product from my memory, while at home, before heading to bed. I am sure that there are items I have forgotten to mention that warrant mentioning. I will sit down with the product and try to recall all these, and get a list of them for a future post. Since I didnt win a copy of the product, nor a fancy iPad recently, I am excited about getting pics of my eval version on my Galaxy Tab monitoring my systems from some place other than my office to show off to folks. If nothing else, the tool has given me a means to brag about DBAs abilities to become informed of goings on in the systems. I have reported some of the items found in our daily stand up meeting, and a Product Manager mentioned 'after hearing these things about our database, I am glad, today, that he (meaning me) is part of our company as the DBA'.

So far so good. This tool has done what it claims to be able to do. Its interactions with me have not left me frustrated or angry. It has provided me with information that is useful in my day to day duties. Configuring it properly will allow me to monitor my systems and keep an ear to the ground, even if I am not in the office to be present when things occur in my DB.

See more reviews of this product at the RedGate website itself http://www.red-gate.com/products/dba/sql-monitor/reviews. And look at more information about the product here : www.red-gate.com/sqlmonitor.