Re attaching logins…script

I am posting this as first in the series I plan to do on my favorite scripts. This is also an attempt to get into blogging seriously – an idea suggested by Tim Ford – to blog atleast one thing learnt per day(#learn365). Am starting with very mundane/basic things as there are many of them.

As a DBA I often have a need to do activities across user databases on a server. One of them is to re attach all SQL Server Logins when a Development or QA environment is restored. There are many ways of doing this…and many scripts available online. Below is the script I authored and use. I also use the same framework to perform any activity across user databases. It works on SQL Server 2005, 2008 and 2008 R2. I have not tested it on SQL Server 2012.

The script checks if login exists on the database so that it does not have to run on databases that do not have the login and produce an error.  It looks really simple but when I looked for a script I could not find one that met my needs and therefore wrote my own.

/*********************************************************************************************
Authored by: Malathi Mahadevan 2/15/2013
**********************************************************************************************/
— Define variables needed
DECLARE @DataBase NVARCHAR(128)
DECLARE @Command NVARCHAR(500)
DECLARE @loginname VARCHAR(20)

–Provide login to be reattached
SELECT @loginname = ‘mylogin’

DECLARE UserDatabases CURSOR FOR

SELECT name FROM master..sysdatabases
where name not in (‘master’,’tempdb’, ‘model’, ‘msdb’, ‘distribution’)

— Open Cursor
OPEN UserDatabases
— Get First database
FETCH NEXT FROM USerDatabases INTO @DataBase

— Process until no more databases
WHILE (@@FETCH_STATUS = 0)
BEGIN
SET @command = ‘USE [‘ + @database + ‘];IF EXISTS(SELECT 1
FROM sys.database_principals princ
LEFT JOIN sys.database_permissions perm
ON perm.grantee_principal_id = princ.principal_id
where name = ”’ + @LOGINNAME + ”’and type_desc = ”SQL_USER”) ‘
+ ‘EXEC sp_change_users_login ”update_one”,’ + ”” + @LOGINNAME + ”’,’ + ”” + @LOGINNAME + ”’;’
EXEC (@command)
— Print command to be processed
PRINT @command
— Get next database
FETCH NEXT FROM UserDatabases INTO @DataBase

END

— Close and Deallocate Cursor
CLOSE UserDatabases
DEALLOCATE UserDatabases

SQL Cruise 2013

I had the opportunity to go on yet another SQL Cruise in 2013. This time our trip was to the Carribean Isles – St Maarten, US Virgin Islands and the Bahamas. In addition to some great opportunities for training and networking the cruise was a relaxing and enriching experience with great food and great opportunities for sightseeing in new land(s). Below is my summary of the experience – if you want to skip my rambling notes and get to what I got out of it please scroll at the way down to the last paragraph 🙂

Day 0- 25th January 2012: I landed at Miami late Friday evening. The cruise crowd met up with local sql server user group members and had a small get together by the pool at the hotel where we stayed.We were also given our sql cruise swag (big bag of goodies from various sponsors).It was a good opportunity to warm up to the cruise and get to know fellow cruisers.

Day 1 – The first day was marked by a breakfast get-together at the hotel we stayed in. It was a good meal and an opportunity to get to know new cruiser Mickey Stuewe and also catch up with Kevin Kline, Bruce Sacrisante and several others. Kevin was also kind to sponsor our ride to the dock in a taxi. The check in was crowded and the ship was much larger than the one I had been in Alaska. We were finally in by noon and met up again for lunch. That was followed by room check in. I took the evening off to nap and settle in – and missed the ‘search the ship’ contest which is a lot of fun. But I simply could not find energy to do it after a long day.

Day 2 – The first day at sea was marked by breakfast followed by Kevin Kline’s class on communication ‘Influence vs Authority’.  Kevin has always been one of my favorite teachers in the community particularly in areas of professional growth and this class was no exception. I learnt a lot about using different styles of communication with different people (so different from the default same cut for all that most techies are used to).I was also impressed by Kevin’s suggestion to keep a printout of various styles so that one may refer to them constantly and make it a habit. That is something I have adopted and has helped in atleast two situations so far.After a great lunch the afternoon session was Allen White’s ‘Powershell 101’. I have attended this session a couple of times before but always find it uniformly interesting and inspiring to get to learn Powershell. This session was followed by  ‘How to be an Enterprise DBA – Part I’ by Sean Mccown. Sean discussed automation strategies, communication strategies and various situations faced by DBAs who handle several servers in large shops. I found it very interesting and useful. The evening was marked by networking hour on the deck followed by formal dinner. The dinner discussion at the table I was centered around mid life challenges with finding jobs, and being a generalist versus a specialist. It provided many insights.

Day 3 – This day was again at sea and marked by a continuation of Sean Mccown’s session on being an Enterprise DBA. It was accompanied by an invigorating discussion on many challenges faced in handling DBA work in enterprise shops. After lunch the class continued with Ryan Adams teaching Active Directory terminologies and usage as applicable to SQL Server. I learnt more on many terms that I did not know in great detail about. The evening was again marked by networking – also called ‘Office Hour’. I was impressed and happy with the fact that cruisers had some time to themselves in the evening to network on their own or explore the huge ship at leisure.

Day 4 – We docked at St Maarten today. I took a guided tour to a Butterfly Farm followed by a short exploration of the beach and some shopping. The Butterfly farm was the backyard of a canadian scientist – a sunny garden full of flowers, with only a thin mosquito net for protection and hundreds of butterflies gracing the space. It was a truly spectacular and interesting visit. The multi cultural nature of the tiny island (partly owned by the French and partly by the Dutch), and the lifestyle of the local people (very little fresh water or agriculture, tourism main industry) was interesting to observe. After a long day we met up for networking again and then retired early.

Day 5: We docked at St John’s, an island part of the US Virgin Islands today. It was a gorgeously beautiful summer day. I was torn between joining the group on their trip to a private beach or going on the tour I planned — the eco hike of the island, and finally ended up doing the latter. The hike was a short 3 mile walk through the rocky island landscape, with many gorgeous views of the beaches. We also spent two hours at Honeymoon beach, a small beach with smooth white sand and the bluest beautiful waters ever. I regretfully made my way back to the boat around 2 pm. St John’s is definitely among the most beautiful scenic places I have seen in my lifetime. We met up again for networking and dinner in the evening, most conversation centered around our sightseeing experiences that day.

Day 6: This was a day at sea. Our class started with Neil Hambly teaching Memory Management. I liked Neil’s style of teaching and learnt many tips from the presentation. It was followed by Kevin Kline’s session on SQL Server Internals. Although I have attended the session before it was a great refresher on things one needs to know. This was followed by Ryan Adams teaching Policy Based Management. In the evening we met up for a semi formal dinner at the same restaurant. My memories of the dinner center around the gluten free, sugar free peach cobbler ordered by Mickey Stuewe and shared by some of us. It was truly a memorable guilt free dessert experience 🙂

Day 7: Our last day of the cruise began with Allen White teaching ‘Powershell for Performance’. I was very impressed by scripts he used to do performance monitoring and display graphs as reports. The ship docked at the Bahamas for the afternoon. I spent the afternoon on a swimming experience with dolphins at the resort we were close to. It was truly unforgettable but left little time for anything else. The weather at the Bahamas was also chilly due to a storm front coming in. Our last evening was marked by a great get together after dinner with plenty of jokes and good humor. I took leave of the party with many warm feelings, friendships made and gratitude for a great week of learning and networking.

There are a few things I learnt from the cruise. First of them perhaps is that it has given me an opportunity to make friends easily – I am one of those people who is often perceived as a strong introvert, although am really not that much of a shy or reserved person. My personality type is more of an ‘ambivert’ or ‘centrovert’ as they call it – I take time to warm up to people though and am not an ‘instant mixer’. To add to that is all the complexities of having spent half a lifetime in another culture and the strong stereotype around asian women. I would probably not have much to contribute in a conversation that centers strongly around american food, or alcohol or music but I do like jokes of any kind and enjoy conversations where people give room for differences and have time to listen. SQL Cruise allows for that, and has helped me make many good friends among the people I have cruised with so far. I have been enriched by their stories and their experiences and hopefully they learnt some from mine too. I am also always someone up for checking out new lands and exploring new places – it is just the trip for someone interested in all that .I was able to add 3 new places to my list and that makes me greatly thrilled. Lastly is the invaluable experience of technical learning and being around people who have been successful and good at what they do, for extended periods of time. There are many conferences/sql saturdays and various events but none that give you the opportunity to do all of this in one week.

I would highly encourage any person interested in growing their career in SQL Server to try SQL Cruise. You will want to come back for more, I promise. I want to thank the sponsors – SQL Sentry, Idera, Red Gate and Confio for making this possible for the SQL Community – in addition to Tim and Amy Ford, for their great organizing skills and also for the fun and enriching company of their entire family.

SQL Saturday 154 – St Louis

I attended SQL Saturday 154 at St Louis last weekend. I was particularly keen to attend this event since it was organized by my friends at St Louis (Sanil Mhatre,Julie Bloominquest, Kathie Kellenberger, and others) who have been regular attendees at all of our events at Louisville. It was also their first sql saturday. I arrived late on friday and checked in at Crowne Plaza, the hotel assigned to the event. It was very comfortable,reasonably priced and close to the event location – which helped me not rent a car. The next day morning I finished breakfast at the hotel and walked to the event. It was a short and pleasant walk. I had left my speedpass printout at home but the team was quick to print me a copy, and I was set with my badge and swag bag in a few minutes. I was also able to get a good cup of coffee and settled in for my first session of the day – Dan Guzman’s ‘Maximising SQL Server Insert Performance’ – I learnt a few things particularly on benchmarking and measuring performance. The next session I attended was Arie Jones’s ‘Pwned..Security,SQL Server and you’. AJ is one of those people who can keep you listening for hours with the content and stories – and he was totally in his element today. I greatly enjoyed the presentation and learnt many new things about hacking techniques and security mechanisms to prevent them. After this session I had to head back to the hotel to check out, and returned in time for lunch. There were no lines and was able to get my sandwich easily – it was recommended to sit in classrooms, eat and listen in on vendor presentations. This was a great idea but for those of us who could not attend the post event, this was also the only time to socialize. I spent this hour socializing with many people I knew, and also with vendors. The only post lunch session I was able to attend before rushing to the airport was Kevin Boles’s ‘ Common TSQL mistakes’ –  another brilliant presentation packed with tips for every day use. I thoroughly enjoyed the session and left the event very satisfied with a good day’s learning.
As an organizer of 5 sql saturdays I happen to know the many pains and huge effort to pull off an event – and the effort put in by the team was obvious. Finding a space to host such an event for free is a huge challenge, but again bigger spaces are the only way events can grow – so perhaps a bigger space would help next time. Also, as Kendal Van Dyke pointed out in the SQL Saturday news letter – the most common feedback events get are around signage in and around the building. We learnt to make investments in signage and reuse them every year – something I have never regretted doing as an organizer – this could be considered.  A boxed lunch with all sides in one box would be better – in return for $10. Other than these small issues I felt the event was very well organized and look forward to attending the next one!!

Thank You To an Awesome Sponsor

There are 3 kinds of people who keep our user groups and sql saturdays going. They are loyal speakers, sponsors and volunteers. We took extra care to reward our speakers this time – particularly those who have been returning to us every year for the past five years. For sponsors – it is difficult to offer any ‘rewards’. Sponsors are the reason behind our free lunches, our swag, our giveaways…This post is a humble thank you to one of the best sponsors there is. Idera Software has kindly sponsored our user group lunches for 4 years now, and all our 5 sql saturdays as Gold Sponsors. Without them it would be really really hard to keep both the user group meetings as well as sql saturdays going. We are proof and testimony to their commitment to community and we greatly appreciate it. This picture is our volunteer team expressing our thanks.On behalf of all volunteers and attendees of Louisville SQL Saturday – THANK YOU IDERA, YOU ROCK!

SQL Saturday 2012 – Lessons learnt

We had our fifth SQL Saturday at Louisville this year. It was an awesome day of free training and networking, with a record attendance of over 200 people and 35 sessions on 7 tracks. Our venue was at the School of Business at University of Louisville. Some of the lessons learnt and experiences we had as  organizers are as below.

1 Pre Cons/Day before:
I have written a separate post covering pre cons themselves. Generally having pre cons at the same location gave us a huge breather in terms of organizing – usually we only get the location the day before – and stay there until late night setting up. This allowed us to put up signs, fill bags and get tables and swag organized a whole day earlier. Many volunteers could enjoy the speaker dinner and show up far less stressed the next day because of this. While it is tough to get the same premises again without interruptions on a working day, the advantages are tempting and we will try to make this happen in similar ways next time.

2 Signs: We made a significant investment in getting good signage this time, and it paid off really well.Many people appreciated the signs, and not too many complained of being lost.

3 Speaker Dinner: We wanted to pick up the tab on speaker dinner this time since we had not done so in the past. The Bristol Bar and Grille provided good food with local flavor at a reasonable price and well within our budget .Most speakers and attendees enjoyed the dinner.

4 SpeedPass:
This was our first experience using speedpass. We were a little skeptical to be honest – since a lot of our attendees show up with barely any info/paperwork on them even for paid conferences. The location did not have any fast printers, and it didn’t seem practical to have inkjet printers on us. Printers are pretty heavy to lug around and set up, and we had enough to do without that as overhead. So we made printouts of name tags and raffle tickets, to be safe. Approximately 20-30% of attendees showed up with no printouts, much lower than what we thought. So while the printouts were useful – speedpass largely worked for us and we will use it again.

5 Vendor Area:
Setting up vendor area went very smoothly and all vendors were appreciative of the experience.This is also a landmark event for us in terms of finding local vendor support – we had four local vendors, two of whom was gold sponsors.All of them seemed extremely happy with the experience.

6 Lunch – Our usual vendor Jason’s Deli did a great job this time also with delivering quality food on time at very affordable prices. The only hassle with lunch was that no food was allowed in classrooms and people had difficulties finding areas to sit and eat. This is one of our action items to work on for next year.

7 Speakers and Sessions – Our speakers were a mix of those who were loyal to us and proven good speakers, and new speakers who had submitted interesting sessions. We have recieved great feedback on most, and some small complaints on others. As is the norm this will be considered for selection next year. It is heartening to note that the list of ‘loyalists’ or proven good speakers grows every year, we regard this as an extremely healthy trend.

8 Session timings – We timed sessions to last one hour each with 15 minutes for questions. It seemed to satisfy most speakers – a couple of attendee feedback comments indicated that some were ‘rambling to fill time’ 🙂 We are not sure if this is serious enough for any kind of action – but we will let speakers know of the duration well ahead of time.

9 Professional Growth – We had a dedicated track to professional growth this time that included an awesome panel of speakers for Women in Technology and many other useful sessions. Unfortunately these sessions had very thin attendance – I have seen Professional growth suffer low attendance even in PASS summit so this is nothing unusual but i personally believe many speakers on this track deserved better. Perhaps having the WIT session at lunch and scheduling some of the other sessions around the technical sessions instead of a dedicated track might help in this regard. This is something to experiment with for next year.

All in all the event was a huge success. With 35 tracks and 230 people signing in, 4 local vendors and 4 national vendors, it was bigger than any we had ever hosted. We were proud and happy to have provided quality free learning yet again, and look forward to next year already.

SQL Saturday 122 – Addressing attendee feedback

Most organizers including me usually write one post covering the entire event. This year I decided to break it up into multiple posts simply because the lessons are many and the audience for each post is different – a post on budgeting would probably interest organizers a lot more than an attendee. This post is for attendees, addressing some of their feedback.

A lot of attendees have never been to a sql saturday. A lot of attendees have, but do not know much on basics of how these events operate. At every one of the five events we have hosted – I have explained to wide eyed attendees (including one microsoft employee this time) that this is a completely free event, and nobody makes a dime out of doing it – the organizers as well as speakers, all do it for free, just for the pleasure of learning and community. To add to that a few more facts –

1 There is a lot of feedback on having more vendors and more swag. Starting with vendors – we are thrilled to have as many vendors as we can possibly have and we try very hard to sell our event to as many as possible. But how many vendors we actually get is a combo of budgeting decisions vendors make and the luck factor. This year has been a landmark year for us in terms of finding local vendor support – VSoft Consulting and SIS, both local consulting companies, came in as a Gold Sponsors. New Horizons, another local training company came in as a silver sponsor. Lakeshore Consulting sponsored breakfast, and Republic bank gave us swag bags, as well as 10 attendees for our pre cons. We hope to get more of their support going forward too. As for national vendors, we still had four of them – Quest, Idera, Confio and PASS. But they have a huge choice of events, some events much bigger than ours – we understand that and we have to live with the choices they make.

2 On to SWAG and give aways- many vendors have cut down on swag material due to budgeting decisions. SWAG is cool for an attendee but in reality it is extremely hard to handle – someone has to store it before distribution and someone has to keep the leftovers after, that takes up room in their homes and garages, space that they would rather keep their personal stuff in. Truthfully having less swag has given us more time and energy to organize other parts of the event better. Give aways again, are a vendor call. We do not control any of the decisions they make – if they have an IPad or not, and if they have 3 gift cards instead of one.

3 To clarify both points again – all SQL saturdays are not funded the same. Some of them get 10x more funding than we do (and no, not 10 times more people or more sessions!!). It is a vendor decision to offer more funding to some events and less to others – so if you are at an event with several ipads or television give aways or karaoke parties, do remember that we didn’t get as much funding as they did to make those things happen.The main goal of a sql saturday is in two words ‘free learning’. Any feedback you can give us to make that better can and will be greatly appreciated – but free giveaways and swag are not likely to get on the improvement list easily.

4 Space for lunch – We realize that not having enough tables and eating areas around was a significant issue for several attendees. The location is given to us for free (we cannot afford most paid locations with such facilities). Their request was not to allow food in classrooms – which we had to accomodate in return for 7 awesome classrooms and some vendor display space. This limited networking opportunites and also took away valuable time from having well attended lunch sessions such as WIT or Toastmasters.This is definitely on top of our list of things to improve for next year.

5 Post event party – This is again one thing that comes up for discussion every year and has not happened yet, for several reasons.On top of them is the fact that our small and committed team of volunteers are tired to the bone towards the end of the day. Heading to a party is frankly the last thing on our minds, and it is difficult to have a party without atleast one person there making sure things are going ok. We considered having a job fair kind of a party this time – but the recruiting companies we worked with had already signed up as vendors and done their networking at the event itself.  Lastly, most bars are packed in and around Louisville on friday and saturday nights, and we cannot book any of them for you without dropping a significant sum of $ which we would gladly use for other purposes. All said ,this is also on our improvement list for next year and the goal is to make it happen.

6 ‘Missing’ or bad lunch payments – A couple of attendees claimed they had paid and were showing up as not. There are 3 ways to track a lunch payment – one is if they have a lunch coupon, two is if they have the paypal receipt for the payment, and three is if they show up on our list as paid. If none of the three are available it is really very hard to attach payment to the person or prove he paid (in all probability he just thought he did and didn’t). We did have spare lunches but it was against rules of the school to accept cash payments on site, and also would have been unfair to paid attendees. So all we can say in this regard is to keep your tickets and payment proof handy.

The remarks on various speaker sessions have been taken seriously and passed on to the speakers. We hope you have considered giving them same/similar feedback on the paper forms that were available in each session. Speaker feedback is taken very seriously by speakers and organizers but with reasonable limits attached – so if you went to a design session and complain that you didn’t’ get something to ‘act upon’ immediately (unless you are half way through designing something that is unlikely) – it is really not the speaker’s fault. We have also noted the requests for more developer sessions and will try to accomodate this as well.

Last but not the least – SQL Saturdays happen on a global level, in all countries and all communities. The last place where you expect a racist remark is on feedback for an event, but this time I got one. This person accused ‘one community’ of ‘dominating the event’ and that ‘knowledge is not enough but communication skills are important as well’. Being an organizer has nothing glamorous to it – it is not a position of ‘authority’ or ‘domination’ in any way. You are lucky as an organizer if you get committed volunteers to share your load, like I do. It is a task that makes huge demands on your personal time, makes you handle a lot of $ that is not really yours but you are accountable for it just the same – you get nothing out of it other than a few compliments here and there and you do it just the same because you love the community and the team work. I am a US citizen and living in this country for 17 years now. My team is as american as apple pie. If anything  we did upset this person all I can say is more constructive feedback would be appreciated, and references to communities/domination etc is just plain hurtful.

Judging from the overwhelming number of personal compliments many of us got, and the fact that almost 95 percent of our attendees who responded to the survey want to come back next year and the remaining 5 percent are just a ‘dont know’ – we have done most things right. Now is the time to kick back and relax a while..until next year..thank you everyone!!

SQL Saturday Louisville 2012 Pre Cons – An organizational perspective

We had our fifth sql saturday at Louisville – this time at a much bigger location, the school of business at University of Louisville. We also had a day of pre cons (our first pre con was by Kevin Kline last year, and was moderately successful with an attendance of 23 people. This year we tried 4 pre cons – we were unsure of which subject area to pick mainly, and all the 4 speakers were rated highly previously and among our loyalists). Some of the lessons learnt on the pre cons are as below:

1 The day started with a bit of confusion – one of the speakers had to move their room from what was originally scheduled since there was a class going on. We were relieved to be given an alternative.But much to our dismay this happened one more time, in the afternoon, actually disrupting an ongoing class. We learnt later that the reason was that the school actually has classes, and many happen without schedule. They helped us out greatly the next day by posting notices on doors that our classes cannot be interrupted. We also learnt not to host classes on premises that have their own events going on, particularly on working days.

2 We didn’t have the room number printed on the ticket – this was a gotcha on our part while setting up the ticketing with Eventbrite. Several attendees turned up without reading the email info on pre cons and those of us at the reception didn’t have them on us although our signboards had them. Our lesson was to keep room numbers printed on tickets going forward.

3 Some candidates walked to their rooms directly without checking in. (We assumed they would register/check in). Although we did not find anyone attending without payment – this indicated a possibility of that happening – lesson is to keep the check in process directly outside the room instead of in a common spot.

4 We learnt later from pre con speakers as well as other sql saturday organizers that having 20 attendees is generally considered good for pre cons – and we did nearly touch that number with 3 of them. The lesson to take away is possibly that two pre cons are the best way to go for us – possibly one on BI and one on the DBA track. That might give an above-average count of people for each class and also ease manageability issues.

5 One of the pre cons had an offer for multiple attendees to attend for the price of two. Initially it seemed like it sold well and brought in a few numbers, but many of those who signed up on this deal simply did not show up. Perhaps they did not get the day off or perhaps they thought it was not worth their time – we had to give away the extra lunches we bought for these people. The lesson here is to reduce ‘deals’ since there does not seem to be accountability with no payment.

All that said,  most attendees seemed very happy with what they learnt and wanted to do this again. The teachers seemed happy too since the attendance was well above average. Overall, we would call this event a success and hope to do it again, incorporating the lessons learnt. Our thanks to our teachers – Kevin Kline, Eddie Wuerch, Bill Pearson and Dave Fackler, and to all the students who attended. We don’t have a spot yet to upload their presentations but will email attendees with them – you may also want to follow their blogs for the downloads.

Becoming a DBA

This is in response to John Sansom’s call for posts describing a DBA story. Here is mine –
1 How did you get started?
I was working as a Visual Basic programmer in a leading financial company on Wall Street in the 90s. Despite being a large company with sensitive data they did not have a dedicated DBA – my boss managed a team of developers and did most of the DBA work himself. He was often overwhelmed with many things to do. I offered to learn some of his work, particularly DBA work since databases interested me. He taught me basic dba tasks – how to do backup/restore, how to create and maintain databases and certain other things that were specific to that business. He greatly appreciated my help despite having a lot to do myself. The story went well with both of us helping each other. One day it so happened that he was working late. The company had requirements for people to work late during monthly closes and it was one such night. He decided to go for a walk to give himself a break and walked into a bar. He got back in after a drink too many and dropped a mission critical database, bringing all the activities in the company to a standstill. Those were days when we did not have capabilities to log in remotely or even cell phones – so the phone in my home rang at 2 am. I was asked to get in to work immediately as it was an emergency. When I went in I learnt the story and also that he had been fired. I was able to restore the database and apply the logs. They had only lost 15 minutes worth of data and they were happy. With that came the keys of my first DBA job, and I have not looked back since.

2 Describe what a typical day is for you?
I currently work as a senior DBA in a leading healthcare company. I manage about 150 servers, with a team of 3 other DBAs. A typical day begins with a quick scan of our ticket queue – there may be tickets for failed jobs, backup failures, space issues or login problems. Sometimes these are small issues fixed easily, sometimes they may take longer depending on nature or complexity. Most of our alerting system and ticketing system is automated eliminating the need for checking individual servers since we have many. Following that is checking the queue for change management requests. These may be requests for backups, restores, promotions and the like. Most promotions involve code reviews for standards compliance and also performance – like usage of hints, appropriate indexes and so on. This may take a few minutes or a whole day depending on size of the request. Then there may be meetings to attend – a new application to be rolled out, a server upgrade to a newer version, a standards revision and so on. There may be documentation and internal team discussions on new features of SQL 2012, patches and service packs, scheduling off hour work and so on. In short, rarely a dull moment and lots of opportunities to learn and grow.

3 What advice would you give to someone considering becoming a DBA/DB Developer?
It is probably the same advice I would give to anyone who wants to be good at what they do. Brent Ozar said it very well in a post on time management sometime ago – ‘Decide you want to be incredible’. I have worked in many jobs and most of the time I would look to my collegues and friends to be as motivated as I was. Many people just want a job – they will go to a training if their boss sent them, browse the internet most of the time there too, do their jobs on a purely task basis, go home on friday, return monday, take the yearly vacation and go on again. I got a lot of attitude and a lot of ‘looks’ from people when I got excited about the latest release of SQL Server or the latest great book out there or even if I stayed late trying to fix a query to run faster. It took me a while to get it that if I had to excel it was time to ignore all that and do what is right for *me*. Passion is nothing to be ashamed of, and if you feel a passion for what you do – grow it and find places that will support it. Grow out of the need to be like ‘them’ and you will find more people like you who will inspire and motivate you to be better.

TSQL Tuesday #31: Logging: Case of the Missing LSN

 This is in response to Aaron Nelson’s call for T SQL Tuesday – on the subject of Logging. There are many things that come to a DBA’s mind while talking of logging. For this I chose an incident that happened some years ago. I had joined a new job, and the dba who had taken my spot had been there for several years before she left. She had set up most of the maintenence jobs on existing servers, most of which were on SQL Server 2000 then.

On the second day of my job I was asked to restore a backup as of a certain date/time to a development server to recover some data for an application manager. I was directed to the place where backups were stored. I found the full backup, and hourly transaction logs following that. As I set about restoring, I got a certain log that gave me a missing LSN error. The log job was set to run hourly, and the timestamps showed all logs were there and there were no errors on the job. I looked further to see if anything else was going on at that time when the log was backed up – I found a reindexing job in which the recovery model was being set to simple and back to full again. In 2005 and above if this change is done – the log chain is broken and one gets an error that a full backup is needed before restarting it. But in 2000 there was no such thing. The log chain was still broken but the job was not throwing any errors to show that. The backups were just not usable.
The process had been in place for more than 4 years, and luckily there had been no requirements to use the transaction log backups during this time interval. They even had a testing mechanism for testing backups, but they did not test backups during this particular sequence of operations. After that episode I also changed the testing process to work through job cycle – through all jobs and maintenence windows, in case there was any issue. It was a great lesson for me on backup testing and how many issues can remain dormant for years until one gets them accidentally. Luckily it was not a crisis situation when it was discovered but it might very well have been. Test your backups, and through jobs and processes as necssary, not just during small windows.

SQL Cruise Alaska 2012

I had the good fortune of joining the SQLCruise this year. Below is summary of my experience. I plan to write more detailed posts since there is so much I learnt both personally and professionally, but just had to get this out soon.

Countdown: I landed in Seattle on Thursday, May 24th. In the evening I did a tour of Seattle underground – during this tour got acquainted with fellow cruiser Wayne Sheffield and his family (wife,mom and m-in-law). They were great company on the tour and also in the days that followed. On Friday I did a tour of Snoqualmie falls – which included a visit to two wineries and a chocolate factory.The day ended with SQL Cruise kick off party – which was great fun and organized very well by Tim and Amy Ford. There was food for every taste and lots of fun games/prizes too. I picked up a few of Red Gate swag books for the user group and myself (thank you Red Gate). I left the party early since the next day seemed busy and was still suffering east coast jet lag.
Day 1: I took a cab to the pier around 11 am. The cruiseline promptly took over the luggage and I joined a big crowd of people waiting in the building outside the ship. I met with several fellow cruisers there and the wait was not long before we were called to check in. The check in process was simple – only involved a brief overview of passport and cruise documents, and one was issued tickets and other necessary stuff. By noon we were allowed to board the ship although our rooms were not ready. We were also allowed to eat lunch. It was an awesome first lunch on the sunny deck overlooking seattle harbor with a light breeze blowing in, with several friends for company. The ship took off by around 4 pm – and we were allowed to get into our rooms at the same time. After a short nap/rest everyone was ready to go for the Red Gate discover the ship contest – a fun game where we get a list of things ‘to do’ on board the ship that helped us explore various areas as well as get to know our partners well. I was paired with Jes Borland and her husband Justin – we had a great time getting around the ship and talking to various people for taking pictures with them. Jes is a natural extrovert and just being around her made me feel very upbeat, not to mention the fun we had going around various areas of the ship. By the time the contest was done we were tired – although we did not win the prize it was designed really well and thoroughly enjoyed it. The next day seemed packed with training so retired early.
Day 2: The day started with Brent Ozar‘s presentation on Procedure Cache BI. This is an area I work with a lot – I greatly enjoyed the presentation and discussion that followed. After lunch we continued with Kevin Kline‘s presentation on Leadership Skills for IT Professional. I learnt many things from this, also re confirmed my own assessment of myself – that I would probably do well as a technical expert than a manager. The class was also very interactive and we discussed lots of different scenarios ranging from outsourcing problems to difficult bosses.Kevin also mentioned the Quest give away of a whole suite of tools to all sql cruise attendees  – since I use almost all their products I asked if I could raffle this away at my upcoming SQL Saturday. I think very highly of Quest tools and this is a great give away.  In all this was a great and very enjoyable day. 
Day 3: We landed at Ketchikan bright and early at 7 am. I took a boat tour of Misty Fjords, which lasted 3 hours. The boat went through some amazing landscapes with misty cliffs and silvery waterfalls all around. We also saw some seals, eagles and bears en route (too far away for my little point and shoot camera to capture :(. After lunch we had a session with Allen White on SQL Sentry’s Plan Explorer – an excellent free tool that am already using. Allen showed many scenarios that the tool can be used with which I was not aware of. That was followed by Jeremiah Peschka‘s presentation on Killer Techniques for Database Performance. I was particularly struck by a difference he found between developer and enterprise editions on handling indexed views, and also by the ‘goats in the tree’ funny calender which I plan to order soon :)) Jeremiah also explained of how benchmarking can be doctored for any environment. I have always found his presentations to be funny and informative and this was no exception. The day ended with a fun dinner with several other sql cruise-ers.
Day 4: This day began with 3 glacier helicopter tour at Juneau. Standing on top of a glacier, the ponds of blue ice and the amazing serenity are highlights of my trip and sights i will cherish for a very long time. We spent the afternoon in the suite rented by the BrentOzarPLF team. The views from the suite was amazing. We had a story telling contest where many participants shared their stories of memorable work experiences – Darcy Williams won a Kindle fire prize for her simple,down to earth story.  Brent made mention of every one of our stories and gave each of us a gift that seemed to tie in with our stories in some way. He also took time to do a brief intro summary of his rather famous pre con professional workshop, which seemed informative in itself. That afternoon was great community time teamed up with amazing scenery as the ship sailed through the glacier.
Day 4: We docked at Skagway in the morning. I could not do the hike i had planned earlier due to some minor health issues – but the cruise line kindly accomodated me on a train ride to White Pass in the afternoon. The morning was spent shopping at the amazing art stores in downtown Skagway. The train ride was the best I had ever had in terms of scenic beauty, have a hard time even describing how awesome it was. The skagway break was long and we did not have any class this day.
Day 5: After 4 days of sight seeing this was a day of hard core training and began with Allen White‘s Introduction to Powershell. As someone who has not used much of powershell I learnt a lot from this. Allen also provided several useful links/info on blogs and books for those wanting to learn more on the subject. This was followed by Kendra Little‘s presentation on Sports Medicine for High Transaction Databases – she talked of baselining strategies for busy databases, how to find windows to do maintenence, and several other tips and tricks. The day ended with Robert Davis‘s presentation on backup and recovery strategies.
Day 6: The last day began with Brent Ozar’s presentation on Scaling SQL with Solid State. It was packed with great information on Solid State/Hard drive layout and various strategies to get the best out of it. It was a tough subject for me and i cannot claim I understood all of it but it seemed like a great start to learn more and plan to revisit these slides again soon. The training concluded with Idera Iditarod challenge – a clue based ship search with some sql questions thrown in. I was partnered with Max Gomeniouk. Max was an extremly  agile creative person who handled the ship search swiftly and well, while I fielded the sql questions. Between us we made a good team and managed to win the prize – a Kindle fire, a great start to my ebook reading habit. Thank you Idera for the well designed contest and the wonderful prize!! The afternoon was spent at Victoria, Canada –  I had dinner again with Kevin and his lovely mom Shirley and bid good bye to them.

In conclusion – you can perhaps count the number of times the word ‘amazing’ and ‘awesome’ appears in my post – that is perhaps an indicator of what a great trip this was. It is not easy to organize a training aboard a cruise ship – there is very minimal electronic communication, which is what we use most of the time for events, there is no ‘common’ place where one can post timetables or itineraries and it is hard to find people when you need them. Despite all these challenges Tim and Amy Ford designed a near flawless schedule with awesome trainers and great networking.

From the time i set foot in the boarding room on Day 1 until the time I actually got into a cab to the airport (oh no wait, I met a couple of people at the airport too 🙂 I was talking and socializing with someone from the group, and that in itself speaks for what a well knit, cool team of people we were together. Do consider the next SQLCruise on your travel/training agenda, it is worth every dime you spend. I surely am considering going on the next one,  already :))