Rodney

  • Competitive Communities: Ring Generalship and SQL

    Posted Thursday, February 12, 2009 7:15 PM | 0 Comments

    I was invited to a press conference a few days ago where Roy Jones Jr., Pensacola, Florida native and at one time considered to be the pound for pound best boxer on the planet, talked about his upcoming fight with Omar Sheika on March 21st.  Throughout the 90's I avidly followed Roy’s career, paid to view every fight, and cheered when he won.  He grew in stature (figuratively and literally) and eventually became a multi-millionaire from his talents. After every fight, in front a worldwide audience, he always made sure to mention Pensacola. "Pensacola's in the house!" and I filled with pride for my hometown, for what we as a community could rally behind and come together in partnership and praise of our own hometown hero. We followed Roy through his career, ups and downs, wins and losses and never gave up hope. He had achieved everything he had wanted including moving up from middle weight to heavy weight and defeating John Ruiz, WBA champion at the time.

    Fighting in Pensacola, possibly for the last time, Roy is giving back to the community who has followed him all of these years and I for one, a mild mannered DBA and author in Pensacola, cheer him for his efforts.

    Now the segue to SQL…

    We started a SQL Server users group in Pensacola last year in June. By “we”, I mean myself and my beloved fiancée, Karla. Our first meeting brought in about 12 people. It was at an airport conference room, a room overlooking a huge poster of Roy Jones Jr. coincidentally that people see when entering or leaving Pensacola.  The next meeting doubled the initial numbers and continued on in this vein until our Christmas party which brought in close to 60 people, who by this time were all acquainted with one another. We did not know what to expect when we started. We knew only that we wanted to be part of something that brought people with common interests together for an evening of camaraderie and sharing our knowledge on SQL Server. It could have been a knitting group, rock collecting, paranormal research, what mattered is that we had an interest and we found that others did as well. We began to learn what companies in Pensacola hired and sustained IT professionals, developers, and DBAs. People came from surrounding areas like Alabama who were running their own users group, like LANUG (Lower Alabama .Net Users group) and Gulf Coast .Net Users Group. The world expanded rapidly. We were now visible. Attention was being given to Pensacola...what we wanted all along. It was not personal. It was for all of our user group members...our friends...our hometown.  It was our tiny life raft we set adrift in a coastal community long forgotten as a potential IT market.

    During this time, I traveled throughout Florida speaking at SQL Saturday events and I met many SQL MVPs and other professionals living right here in our fine state.  These free, one day, multi-track events brought in 200 to 300 people. These were in bigger cities like Jacksonville, Orlando and Tampa.  We HAD to have our own SQL Saturday! Can we get 200 to 300 people here in our little hometown of 50,000 people? Sure we can.  The point is that SQL Saturday is the championship of SQL events, like a heavy weight fight. We are bringing it to Pensacola with the help of our friends we have met this past year.  We spend many waking hours discussing, planning, e-mailing, and pulling resources to make sure this is going to be a success. Why?

    Because now more than ever with the economy and some our new friends and user group members losing their jobs, it is important for us to maintain a point of contact, to keep the community alive. One of the most supportive sponsors for our group is an IT recruiting company (Tek Systems…shameless plug) and has helped some of our members be placed in other positions. We also post information on our various websites about other opportunities where we can.

    We know our efforts will not have the huge impact of a Roy Jones Jr. bout.  We will not ever fill an 8000 seat arena of people wanting to watch two DBAs go toe to toe on who can bulk load data the fastest. But, I have been working out lately. I think this year I will challenge another Florida SQL MVP to a showdown on DBA trivia right here in my hometown and charge admission via pay per view.  I am not naming names, but I know who I want! And you know who you are.  See you at our Pensacola SQL Saturday in June. Bring your Pumas and your Power Point! "Pensacola's in the house!"

     

  • The Holy Scrolling NO WAY Gold Nugget (Script Data) SSMS 2008

    Posted Monday, December 08, 2008 8:21 PM | 2 Comments

    Tonight, I set about blogging about something I thought was interesting, funny and marginally useful (IFmU)...or wait...funny, useful and marginally interesting (FUmI). Part of the blog post I had envisioned would be to create a database, it's objects and data to reproduce the FUmI that I wanted to impart. However...as I was creating said database I stumbled upon a new feature in SQL Server Management Studio that caused a gasping pause followed by a "No FUmIng WAY!" So, apparently no one told me that SSMS now includes an option when scripting databases to script the data too. I had to make sure so naturally I searched and despite a few obscure blog posts, there was little mention.  Fair to say though, that several have already discovered this gold nugget...but I wanted to post it here for the ones who may not know.

    In SSMS 2008, right click a database and select Tasks\Generate Scripts to initiate the Script Wizard. On the third page of the wizard, there it is if you scroll down..."Script Data".  I scrolled thinking, 'Wow, it would be so...um...yeah cool if I saw something like ‘script data’”.  And boom, there it was just like my first ever use of single quotes in double quotes like at the end of the last sentence.

    So, yes, it does exist. And here is a sample of the INSERT statements created. For the record this works with 2008 and 2005 databases. I have not tried 2000 but I am hopeful.  Also, it is smart enough to batch the transactions each several thousand rows.

    INSERT [dbo].[IN] ([BETWEEN], [LIKE]) VALUES (N'AVG ', NULL)

    INSERT [dbo].[IN] ([BETWEEN], [LIKE]) VALUES (N'ABS ', NULL)

    INSERT [dbo].[IN] ([BETWEEN], [LIKE]) VALUES (N'AND ', NULL)

    INSERT [dbo].[IN] ([BETWEEN], [LIKE]) VALUES (N'BACKUP ', NULL)

    GO

    print 'Processed 2800 total records'

    I saw several articles lately talking about a new feature in SQL Server 2008 about how we can now declare and assign variables in line without a separate SET assignment. That was in the marginally interesting (mI) bracket for me prior. That feature now falls into the "whoopie freakin do" category comparatively.

    And those of you wondering about these crazy inserts, please read the subsequent blog post.  

  • Keywords, Brackets, Identifiers and Ridiculous.

    Posted Monday, December 08, 2008 10:07 PM | 3 Comments

    One of my DBAs recently reported to me that our indexing job was failing because a database included in the re-indexing code was actually named after a T-SQL keyword. I think I actually guffawed, not because it was impossible, but just because this "actually" happened. So, being inquisitive, I took this whole idea that a database could be named a keyword to the next few levels. How about tables, fields and the data itself? What follows is the query to create the "SELECT" database and a couple of keyword-named tables. It is an excercise in the ridiculous for sure, but makes one wonder. What if you failed to identify your objects with brackets or quoted identifiers?

    Query to build SELECT database. Also, this script was created from the new "Script Data" section of the SSMS 2008 "Generate Scripts" wizard to save a few steps (see previous blog).

    --BEGIN SCRIPT

    USE [master]

    GO

    /****** Object: Database [SELECT] Script Date: 12/08/2008 22:15:22 ******/

    CREATE DATABASE [SELECT] ON PRIMARY

    ( NAME = N'SELECT', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\SELECT.mdf' , SIZE = 3072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )

    LOG ON

    ( NAME = N'SELECT_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\SELECT_1.ldf' , SIZE = 9216KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)

    GO

    ALTER DATABASE [SELECT] SET COMPATIBILITY_LEVEL = 90

    GO

    USE [SELECT]

    GO

    /****** Object: Table [dbo].[IN] Script Date: 12/08/2008 22:15:22 ******/

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    CREATE TABLE [dbo].[IN](

    [BETWEEN] [nchar](25) NULL,

    [LIKE] [nchar](10) NULL

    ) ON [PRIMARY]

    GO

    INSERT [dbo].[IN] ([BETWEEN], [LIKE]) VALUES (N'AVG ', NULL)

    INSERT [dbo].[IN] ([BETWEEN], [LIKE]) VALUES (N'ABS ', NULL)

    INSERT [dbo].[IN] ([BETWEEN], [LIKE]) VALUES (N'AND ', NULL)

    INSERT [dbo].[IN] ([BETWEEN], [LIKE]) VALUES (N'BACKUP ', NULL)

    INSERT [dbo].[IN] ([BETWEEN], [LIKE]) VALUES (N'BEGIN ', N'END ')

    INSERT [dbo].[IN] ([BETWEEN], [LIKE]) VALUES (N'BETWEEN ', NULL)

    INSERT [dbo].[IN] ([BETWEEN], [LIKE]) VALUES (N'CHECKPOINT ', NULL)

    INSERT [dbo].[IN] ([BETWEEN], [LIKE]) VALUES (N'HAVING ', NULL)

    INSERT [dbo].[IN] ([BETWEEN], [LIKE]) VALUES (N'EXIT ', NULL)

    INSERT [dbo].[IN] ([BETWEEN], [LIKE]) VALUES (N'IF ', N' ')

    INSERT [dbo].[IN] ([BETWEEN], [LIKE]) VALUES (N'LIKE ', N'LIKE ')

    /****** Object: Table [dbo].[FROM] Script Date: 12/08/2008 22:15:22 ******/

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    CREATE TABLE [dbo].[FROM](

    [Where] [int] NULL

    ) ON [PRIMARY]

    GO

    INSERT [dbo].[FROM] ([Where]) VALUES (1)

    INSERT [dbo].[FROM] ([Where]) VALUES (2)

    INSERT [dbo].[FROM] ([Where]) VALUES (3)

    INSERT [dbo].[FROM] ([Where]) VALUES (4)

    --END Script

    And what do you do with a database named SELECT with tables named FROM and IN? Well of course, you populate them with other keywords and query those values. Without explanation we delve deeper with a couple of interesting queries that actually work.

    The first:

    select * from [Select]..[FROM] WHERE [WHERE] > 1

    And finally (my favorite):

    Select *

    from [IN]

    WHERE ( [BETWEEN] BETWEEN 'AND' AND 'BETWEEN'

    OR [LIKE] LIKE 'LIKE%'

    ) OR [BETWEEN] IN ('BETWEEN')

    So I could have continued on, adding stored procedures named "BEGIN" or "EXEC"...but stopped with well enough. Plus my lunch break was over. Tomorrow's lunch: sp_who_knows?

  • DBA Decision #1 - New Hardware, Index Tuning or Application

    Posted Thursday, October 16, 2008 8:37 PM | 9 Comments

    So I am sitting here doctoring (not nursing) a beer listening to Jimmy Eat World and Nerf Herder and thinking about a huge decision I had to make this week.  The more I thought about it, the more I wanted to pose this scenario, this quote unquote real-world scenario to get some feedback on how other DBAs or managers might handle the same situation.  I know from doing this for so long and the people I have met, that this happens quite a bit to DBAs. 

    The scenario:

    You have a slow running front end application. It has been getting progressively slower over the past few months, however, it has always had issues with certain processes. You, as the DBA,  know you are dealing with millions of records in some tables. These tables have a tossed salad approach to indexes, one clustered index and up to 30 or more non-clustered indexes. You discover that a former DBA has added non-clustered indexes based on the sound advise of the index tuning wizard or database tuning advisor (dta). When things run slow you analyze and see thousands of sustained shared locks on one of the dta indexes; no blocking but users complain of slowness. You also know that developers are working on a solution to address a potential bottleneck with code you can not see.

    Business is...well...pissed. A decision is made to move to a new, bigger server. This always fixes problems with code, right?  The other variable is that since we are moving to a new server, why not go ahead and go from a 32-bit SQL 2000 Enterprise install to a 64-bit Standard SQL 2005 install? It would be WAY easier to manage and should gain a 20 to 30% performance increase OOTB.

    Okay, so User Acceptance Testing (UAT) has been performed on SQL 2005 but for functionality only.

    You also learn late in the game that the server you want to move to is a single RAID 5 array of local disks, not SAN attached.

    Wait...you also just learn the vendor does not officially support SQL Server 2005. They have customers there but do not know how it will work for us.

    Two days prior to moving to this new server with double the processors with the same version of SQL (2000) the vendor responds and says they now will support 2005 and beckon us to go there.

    Now you have to decide:

    1.) Do you stall the upset users and work to address the slow running code by working with the developers and tuning/deleting the dta indexes in hopes that this will buy enough time to test SQL Server 2005 for a future upgrade (within two weeks)

    2.) Do you go ahead with the SQL Server 2000 migration to the new server over the next weekend in hopes that it will address the users slowness and loss of productivity, though the problem may still exist on the new faster server.

    3.) Do you move forward with SQL Server 2005 64 bit Standard, knowing, wow, knowing there is no easy way back if there are problems.

    4.) Do you spend the next two days testing with the developers, delete the ferel index from dta, re-create all of the large clustered indexes late on a non-maintenance weeknight knowing that SQL 2000 does not have an online rebuild functionatliy and will require whatever is not completed to be rolled back and could impact production?

    5.)  Add you own decision here.

    I will relay what I did (ed - will have to do) with this scenario in a reply.

  • Spiderlings and Kiting in a Hurricane

    Posted Tuesday, September 02, 2008 8:16 PM | 3 Comments

    So it has been several months since my last blog entry. And this one is going to ramble a bit after a long day of vigilantly overseeing many SQL Servers come back up after a hard shutdown in the middle of the night when UPSs and generators failed when one uncontrollable SPF (single point of failure) actually failed.

    I moved this weekend in Pensacola, Florida. I moved 3 miles up the road. All of our belongings were placed load by load in an open trailer and carted to the new place. We were done before the rain of Hurricane Gustav hit. I watched as the house we were in emptied two years worth of accumulation.  I also had to stop several times at the new house to deal with disk space issues because I also had the fortune of being on call due to...well...that is another rambling blog entry.  

    During the move, I kept stopping to watch our spider. I say it is "our" spider, but since I was the only one who did not want to kill it violently, I should call it my spider. It was and at the time of this writing still is an orb weaver or the argiope variety. It looks exactly like the pictures in the following link and is just as ominous. I am sure it could take down a wily raccoon.

    http://home.att.net/~larvalbugrex/argiope.html

    This particular spider had laid two eggs in the two weeks prior to the move. Again, like large Southern pecans, just like the pictures. It built a brand new large web every evening. I would check it out every morning with amazement. I had hoped against all odds that the spiderlings would hatch just before our departure or shortly thereafter. I do not know why. I just could not bring myself to kill something so beautiful that posed no direct harm. It is kind of like snakes...but again...another blog.

    So, in my mind, knowing that all of my servers came back online with only 1 suspect DB out of 1400, I am thinking that this spiders eggs after two days have hatched and have spun their kiting webs to flutter off by the thousands to new places in the woods out back.

    Hope.....

    I know that will not be the case. I know that the landlord will most likely blow torch them all. I know that a BB gun or target archery set would be required to extinguish this beast and its prodigy. But I also knew, while waiting for the servers to come back online today (the SAN to fire up clean and SQL recovery of each individual database) that we would be dealing with corruption, suspect databases, backups that were incomplete, stress, "DB HELL". But that did not happen. All was good. Everything was fine.

    So I will check the web tomorrow, the long-lived yellow bodied survivor with its two large eggs, before my landlord arrives with a blow torch to see if the hurricane wind has blown them to safe haven.

     

     

  • SQL Saturday Thoughts and SQL Alphabet

    Posted Monday, May 05, 2008 10:52 PM | 3 Comments

    With gas prices here in the panhandle of Florida where I comfortably reside soaring to over $3.60 per gallon, I knew I would spend at least $110 toting myself and my beautiful fiancee from Pensacola to Jacksonville, host city of the most recent SQL Saturday event this past weekend. Another $89.00 per night for 2 nights, not to mention food and beer (the biggest cost) all so I could present my session on a DBA repository that I have put together over the past year using SSIS and SSRS. In hindsight, it was certainly money well spent for a chance to participate in a most worthwhile event. Imagine..a free day of training with regional presenters, authors and developers most of whom have MVP tagged to their illustrious careers. 

    Cheers to Brian Knight, who obviously worked very hard to organise the event with the help of many SQL PASS volunteers from Jacksonville.  Chris Rock, Andy Warren, Tim Mitchell and Joe Healy are a few other that I met who were most cordial. It is not always easy to tolerate a 6 foot 5, 270 lb obnoxcious oaf like myself who has pounded down 5 strong micro brew IPAs and wants to play SQL alphabet and win at pool.

    By the way, I highly recommend SQL alphabet. Simply start with "A" and everyone has to choose a keyword or term from SQL services before continuing to "B".

    Generally it moves quickly. "ABS()", "AND", "AVG", etc. It gets more difficult with more than 4 participants and more fun after each beer. By the time you get to "P" (pun intended) it is a stretch. I thought I had everyone out matched with "Publication" but the last person on line came up with "Partition" without hardly thinking.

    I know there will be a convergence on Orlando next month for TechEd. I hope to see everyone there. Maybe we can finally get past "X". Extended stored procedures do count.

     

  • Weekly Status Report and How DBA Managers Lose Their Edge...

    Posted Thursday, April 24, 2008 9:03 PM | 3 Comments

    So each week, I am required to turn in a weekly status report that demonstrates in summary fashion what I have accomplished the previous week. In a smoothly running SQL infrastructure of even 90+ servers, DBA managers may find themselves in a repetitive rut of similarity week to week.  And for the DBA who reports to a network engineer, it really boils down to "SQL Good" or "SQL bad". When "SQL bad", which should happen less than 3% of the time heroic action is required. 

    It just so happened recently, reported fully in my WSR, that I noticed that an MSDB database had grown to over 8G and was growing by at least 100M per day.  There was about 1G left on the C: drive where SQL was installed (not recommended) so I did not panic but I had to find out. I could have asked one of my proficient DBAs to investigate, but with the side-sagging over glut of non-grunt work, I was feeling like I would take this...I got it, seriously.  First...find out where the 8G was coming from. Not as easy as it should have been.  sp_msforeachtable to get row sizes did not work on the system database. I could have investigated. However, why not a quick cursor to get row counts. Still nothing revealed but my own skin-scraped embarassment at spending more than 20 minutes on this.  I eventually came by and by to the sys.sysxmitqueue table.  Being that it is a sys. table, it was not easily accessible, nay, it was unobservable by standard means.  With a quick bit of research, I found the view that exposes this sys table and that is: sys.transmission_queue. There were close to a million records there.  This all happened because someone long ago wanted to understand Service Broker..a noble idea, but without the understanding of how to turn it off, even after disabling Service Broker itself, or the endpoint that was created.

    The database, msdb, was still enabled for the Broker and was apparently trying to send many many messages that it could not send.

     SQL Bad.

    Surely it would only be a matter of minutes to clean all of this up. Well, kind of.  Because the data file was so full, shrinking was not going to be useful.  I had to remove these failing messages. The way I discovered to do that was to create a new broker, which would flush out all messages, supposedly.

    Alter database msdb Set New_BROKER

    This did nothing that I saw but get blocked behind other processes (BRKR_Task as I recall but this was the beginning of the week and I do not keep good notes for my WSR)

    So, next I disabled it.

    Alter database msdb Set Disable_BROKER

    This worked but did not flush anything but my face.

    So I tried to end the conversation, which should have definitely flushed everthing.

    END CONVERSATION '{1F9B06DB-7B4B-DC11-B999-005056A249D6}' WITH CLEANUP ;

    And it began surely to remove data. But..unfortunately, it must have used delete statements because in about 10 minutes the log file filled to almost a gig. Remembering that I only had a Gig left to begin with, this was obviously not good. With 7.94Megs left on the drive, I now panicked.

    Kill process...roll back...shrink log...turn in report.

    At least, I thought, it will not try to send any more messages. The next day I discovered that I had 3G available...a small unexpected gift.  So, it did work. 

    When I was in the trenches and doing this everyday, I would have wanted to know exactly what happened and I still do..the difference now is that I do not have to stay up until 3:00AM duplicating the issue just so I can sleep. 

    I AM losing the edge.

     

     

     

  • Diagnosis....More Diagnostics.

    Posted Monday, October 01, 2007 8:42 PM | 0 Comments

    Sometimes in my career as a DBA I feel like a doctor. Actually, this started before my stint as DBA...way back in my help desk days. Someone on the other end of the phone begins to impart their symptoms and like an ER intern, I listen intently to every detail. Often, like most good practioners, I interjected my questions at the appropriate pause, all the while formulating my conclusions that I would unveil when the person had exhausted themselves with putting together sentence after sentence.  A recent case study went something like this (and as I parenthetically do in these little snippets, I will "sign post" my point - I ultimately would resolve how multiple Windows group membership in SQL worked and pretend all along to have known this while diagnosing the disease of the ODBConomia Braingonemisis):

    "Several users can not connect to our new budget application. They have the same rights as all of the other users who can connect. We have tried for 3 days to figure this out so while you are in town, we wanted to see if you could help," the conversation began.

    I pondered for a moment and finally asked, "So other users can connect?"

    "Yes," came the reply.

    "And do the users who can not connect get an error message?"

    I knew the response would be affirmative, but lacking the crucual details. It always happens that way. "They can not connect" is generally as far as it gets.

    "So what did it say?"

    "It is an ODBC error. I did not write it down."

    "Is there a user we can test this on?"

    "Yes, but she is at lunch."

    "Ok.." I wanted desperately to dispatch the interrogator to the corner office to sit an wait for said user while I moved on to other interesting issues. But I was caught in the web of mystery. That is how it goes. I can not give up until I know.

    "Who is the user?" I asked finally. I will check out the database.

    I got the name. I got the database. I got the server. I got it all. I was onsite with a group of people whom I had met only once and I had all of the information I needed to troubleshoot and damn I troubleshooted (just wanted a past tense there) until I had the answer.  I am skipping ahead swiftly because I am bored with the dialogue. In reality I waited for the user to return from lunch and go through the rote task of making an ODBC connection from her computer and recreated the problem myself...on and on..until all at one I was satisfied. Here it is with no more Quotes.

    In SQL, this user had her Windows account assigned to two groups...Group 1) Anatomically Correct and Group 2) Bipolar Dissonance. (Surely these are made up...but we can call them Group A and B..the point being alphabetically sequential.)

    In Group A she was assigned to a default database to which she had no access. In Group B she had been granted all required access to the budget database to which she was trying to connect.

    I determiend that her group membership alphabetically in Group A, having no access, was preventing Group B from allowing access. (and the other users having identical problems - two birds two birds two birds)

    Simply changing the default database for Group A to "Master" to which everyone has access (publicly) allowed her to fall through like Marshall, Will and Holly to Group B and finally get past the ODBC error that had been driving everyone mad for 3 days prior to my arrival.

    I explained this in detail to everyone, again as if I had known all along that group membership in SQL Server is apparently alphabetical. And I then quietly finished this blog waiting for all of the readers to dispute this with long treatises on how it really works and making me feel worse and worse until finally I break down and write another book on Reporting Services....Sans dialogue.

     

  • MSDB and the History of the World

    Posted Wednesday, September 05, 2007 6:49 AM | 3 Comments

    A few weeks ago I was tasked with moving SQL Agent jobs from one SQL box to another.  In my life as a DBA, these types of requests come up several times a year.  On a server with 2 or 3 jobs, even 5 to 10, it is easy enough to right-click your way through SSMS to create scripts for each job that can be run on the new server. Remember, two wrongs don't make a right, but three rights make a left. As far as I know there is no right-click Nirvana to "Copy All Jobs" or "Script All Jobs". 

    So what if you have 30 to 100+ jobs? Well, for one you probably do not get much sleep at night unless you hide your Blackberry in a casserole dish in the cupboard. Secondly, the task of creating scripts in this one-off fashion would take the better part of a morning.

    There are several other ways, of course, like scripting the task yourself. 

    Or restoring the entire MSDB database to the new server, assuming that you can lose the one that is there now. This works well in a pinch, but this is an all or nothing endeavor and all of the jobs that are restored have the same status as the source. What if you only want 1/3 of the 100+ jobs to actually be enabled. This creates additional work.

    Enter...Transfer Jobs Task in SSIS.  With this little tool from the BIDS toolbox you have the choice of moving all jobs or choosing from a list of jobs one or more to move. In addition, you can select if the jobs are to be enabled on the destination and also choose whether to overwrite or skip the job if it exists or fail the task entirely.

    MSDB is an often overlooked database in terms of  importance.  I used to not give it a second glance. That was back when I had less than 10 servers to contend with. With 100+, it is critical and I make sure it is backed up and fed every night and take it outside for a walk every now and again just to let it know I care.

     

  • Funny thing about a fractured hand for a blogger/author/coder....

    Posted Thursday, August 16, 2007 8:17 PM | 5 Comments

    They tend to not write as much and make very long titles to their blog entries.  Though I have about 35 ideas right now that I want to get down from my recent travels to a Houston SQL PASS chapter meeting, I can only effectively get down 1 because the back-space key is making me want to drink to curb the pain. Funny thing about beer....hard to drink left handed, like everything else when you are a righty.

    But...I wanted to send a quick thank you to the folks in Houston who had many good ideas that will eventually make their way into my daily work. One is the bane of batch processing, waiting for one task to complete (error free) before the next begins. On restores of 100+G databases, this is,of course, not efficient. The solution (avoiding linked servers) is to kick off a threaded SSIS package or SQL Agent job instead, which should not require a return code before the next can be initiated. Failure becomes the responsibilty of the called server/package, though.

    Ouch....bone pain and back space.

    I would like to thank those of you who read, voted and commented on my recent article on temporarily changing the sa password. Given godspeed healing powers, I hope to have the follow up article (as true to life as the previous) done and posted in the next week. 

    Going numb...must quit soon.

    The final thought is pronunciation of some SQL terms. We all know that SQL is pronounced S - Q - L not sequel, right? Well, how do you pronounce the following?

    GUID.

    I said "Goo Id" for the last 5 years until a conference when a MS techno pronounced it like "SQUID".

    So...now where is the calimari? Getting hungry for SEQUEL.

    Forgive the spelling. If I could just...reach....my....utility....belt.

     

  • AD and SQL and Mark Twain Shall Meet

    Posted Wednesday, July 18, 2007 9:51 PM | 0 Comments

    What does Mark Twain have to do with SQL Server?

    If the atoms that comprised his living flesh did not succumb to entropy he most probably would have been a SQL user and would have had a Windows domain account somewhere.  Really, I just used Twain to tie AD and SQL for the phrase, "...never the Twain shall meet". 

    However, in truth , SQL Server and Windows domain accounts do meet, often. But...if that windows domain account is introducing itself to SQL via a Windows group membership, DBA's may find it difficult to dig a direct ditch to the user. 

    Take for example, the default BUILTIN\Administrators group.

    Who is in this group? How can I, as a lowly DBA, tell?

    With most tasks, there are many ways. LDAP queries, xp_cmdshell to DSQUERY perhaps...

    Follows a query I use that takes advantage of a stored procedure that incorrectly identifies itself as extended with "xp_".

    I am referring to xp_logininfo. If you run:

    xp_logininfo 'BUILTIN\Administrators','members'

    AND you have rights to so such a thing, you will see the members of this group. And it follows that you can do the same for any group.

    What xp_logininfo does not show is the server name of the SQL Server on which the query is run. This is important to me when building a full repository of the SQL Server infrastructure. Below is a query that I have used in SSIS to build a table with the output of xp_logininfo that includes the server name.  The query can be run independently through SSMS for kicks. You might be surprised at what you find. The code is not ideally formatted. I am awaiting purchase of RedGate's SQL Refactor to do the code up right.  Damn expired trial and a ditch diggers salary.

    The following query gets all Windows groups on the server and all its members, which might otherwise be invisible to SQL.

    SET NoCount ON

    SET quoted_identifier OFF

    DECLARE @groupname VARCHAR(100)

    IF EXISTS

    (SELECT * FROM tempdb.dbo.sysobjects

    WHERE id = OBJECT_ID(N'[tempdb].[dbo].[RESULT_STRING]'))

    DROP TABLE [tempdb].[dbo].[RESULT_STRING];

    CREATE TABLE [tempdb].[dbo].[RESULT_STRING] ( Account_Name VARCHAR(2500),

    type varchar(10),

    Privilege varchar(10),

    Mapped_Login_Name varchar(60),

    Group_Name varchar(100) )

    -- Cursor to hold database names to be backed up

    DECLARE Get_Groups CURSOR

    FOR Select

    name from master..syslogins

    where

    isntgroup = 1 and status > 9 or Name= 'BUILTIN\ADMINISTRATORS'

    -- Open cursor and loop through database names

    OPEN Get_Groups

    FETCH NEXT FROM Get_Groups INTO @groupname

    WHILE ( @@fetch_status <> -1 )

    BEGIN

    IF ( @@fetch_status = -2 )

    BEGIN

    FETCH NEXT FROM Get_Groups INTO @groupname

    CONTINUE

    END

    Insert into [tempdb].[dbo].[RESULT_STRING]

    Exec master..xp_logininfo @Groupname, 'members'

    FETCH NEXT FROM Get_groups INTO @groupname

    END

    DEALLOCATE Get_Groups

    Alter TABLE [tempdb].[dbo].[RESULT_STRING] Add Server varchar(100) NULL;

    GO

    Update [tempdb].[dbo].[RESULT_STRING] Set Server = CONVERT(varchar(100), SERVERPROPERTY('Servername'))

    Select * from [tempdb].[dbo].[RESULT_STRING]

    SET NoCount OFF

     

     

     

  • SQL Server and The Holy Grail

    Posted Thursday, June 21, 2007 9:57 PM | 5 Comments

    That title should garner some comments, I suspect, or if not then the following questions should:

    Does there exist a way to provide real-time - or a close proximity thereof - replication from a SQL production database to a reporting database with the following rquirements:

    1.) No source shema changes (even assuming that the source DB does not have primary keys defined)

    2.) Does not require SQL Server replication and the overhead and administration implied therein.

    3.) Is not a failover/data mirror non-accessible representation of the source data that has to have snapshots for reporting.

    4.) Costs less than 60,000 pounds or whatever astronimical amount that translates to in US dollars.

    5.) Does not require a team of sales people to meet with you and your boss in person to discuss the "solution" over a lunch that they will pay for surely, preferably after hours, so that they can get you slogged enough to believe that 60,000 pounds is reasonable.

    I dare say I have yet to find such a solution. Shall I handcraft one for myself and my company, languish in the accolades for a few weeks and then sell it? I could do it. Really, I could. BUT...that would take precious time away from me babying my other hard working SQL servers that complain little and work for next to nothing.

    With the myriad questions in this post, I expect to see some comments. Okay, all 431 of you viewers...stop reading and write something. Does it exist?

  • How Much Space Would An Index Take If An Index Did Take Space

    Posted Tuesday, June 12, 2007 8:58 PM | 1 Comments

    This would be my TechEd post. 

    I was at TechEd for all of one day, on the first day. The only relationship I can make to the title of this blog and TechEd is the word space. The Orange County Convention Center is incredibly large. Even when you add several thousand IT professionals.  The free beer on Monday evening made it seem a bit smaller because I was walking askance or askew or asksomeoneelse I dont remember.  I enjoyed meeting everyone again. I met Tony again this year and treated him to some American beer, Mr Samuel Adams...Sorry, Tony that the only good bar we could find had no good ale.  And I met one of my SQL heroes, Itzik Ben-Gan.  I am sure I scared him with my inebriated homage. After all I am 6 foot 6, 260 pounds and can be a bit intimidating, but he towers above me mentally.

    So..how much space does an index take if an index did take space.

    Thinking of Katmai and the unrelational datastore, I have to offer this: If Microsoft does use SQL Server in the furture to store Windows file system information I put forth my idea for the name of the index scheme to use: Windex.

    So with that incredibly horrible remark, I will retire to my small room which is about 1/1,000,000 the size of TechEd and ponder SQL Server 2011.

    Rodney

     

  • If ONLY (administrator = TRUE) BEGIN...

    Posted Tuesday, May 22, 2007 9:31 PM | 2 Comments

    It has been a full two weeks, actually more, since my last post. You may recall my last entry dealt with my inability to find quality DBA's after months of searching. I am happy to report (and recant part of my frustrated recitation on not finding anyone) that I now have two very solid DBAs on my team....but that is not the subject tonight.

    Tonight, I wanted to post a quick little query for those who shun best practices. I am sorry, I seem to be doing this much lately. I should say, really, I adhere to security manifestos as part of my job and I eschew, like other DBAs, any security privilege that is unnecessary in practice. That being said, here is a query that I use to ascertain the service accounts used to fire up and run any SQL Service on any server. It uses WMIC (Windows Management Instrumentation Console) and xp_cmdshell, both of which require special privileges to run. However, assuming the service account for SQL Server has administrator pivileges or is Local System, the script should work just fine. When dealing with 40+ SQL Servers and requirments to change known passwords (in an imperfectly secured glass box world) the following script can be a cornerstone of a plan to get the ball rolling in that direction.  The few things worth noting in this simple script is the pipe to findstr "grepping" SQL and the use of the charindex function to parse the service name and service account. Give it a shot IF you have admin privileges with your account or IF you have your SQL Server logon credentials for the service with admin privileges (not advised as best practice and defintely not going to garner me any Microsoft MVP nominations). One server? Yeah do the work manually...two?Sure...same...20+ servers?...IF THEN ELSE.

    If exists ( Select Name from tempdb..sysobjects where name like '#MyTempTable%' )

    Drop Table #MyTempTable

    Create Table #MyTempTable

    (

    Big_String nvarchar(1000)

    )

    Insert Into #MyTempTable

    EXEC master..xp_cmdshell 'WMIC SERVICE GET caption,StartName | findstr /I "SQL"'

    Select @@ServerName as ServerName,

    Rtrim(Left(Big_String, charindex(' ', Big_String))) as Service_Name,

    RTrim(LTrim(Rtrim(Substring(Big_String, charindex(' ', Big_String),

    len(Big_String))))) as Service_Account

    from #MyTempTable

    where Big_String is not null

     

  • Too Much HR, Not Enough Guts and Glory

    Posted Wednesday, April 18, 2007 10:15 PM | 10 Comments

    At some point in a DBA's career, assuming he or she has had the mettle to withstand the onslaught of mediocrity and ineptness in its various forms (I may qualify this bold statement in a future post), there comes a time when said DBA is asked to manage other DBAs.  This "management" includes mentoring, coaching, training, and often gaining new perspectives from other's experiences.

    I have read a post on this very site speaking of DBA interviews that have gone tragically awry, when the interviewers realize that the anticipated knowledge level of the interviewee versus the actual knowledge is several feet (meters) below the bar. Having gone through at least 20 interviews since the turn of the year, I would say this holds true. As a manager putting together the "fantasy team" of DBAs for a, dare I use the term, 24/7 shop, has been quite toilsome.

    I have found that there are two types of DBAs, and I am not speaking of the developer/architect versus the command line, bare metal, day-in-day-out DBA; I am talking about the DBA who has started out as computer operator on mainframes, learned a snippet of COBOL, knows what an IP stack and CIDR is, and understands the difference between Itanium (EPIC) architecture and X86-64, though may never have loaded SQL Server in a 64 bit environment. The second type of DBA has chosen the migratory path from developer in a few short years, and has not benefited from the trials and tribulations that experience provides.

    Is it enough to know that AWE is a setting that could enhance performance, or does the DBA need to know about the /3G and /PAE switches? And SQL 2000 Enterprise versus SQL 2005 Standard and memory configurations for a Windows 2003 Enterprise environment? Of course, the DBA should know these differences and much more. I/O, RAM and CPU are paramount. SAN, NAS and RAID levels for local drives are all critical components and will affect performance.

    Can a DBA get by with knowing just SQL? Yes, absolutely...for a bit. Will there come a time when that DBA's knowledge-level is questioned; when a configuration option is set incorrectly because they did not understand the hardware architecture? I believe it will.  This is not a "better than thou" entry from a arrogant *** DBA who thinks he knows it all. Not one bit. I have a world to learn and strive to do so every day.  Now, when DBAs are commanding higher salaries than .Net developers, I am just trying to divine if I am the only frustrated manager or if this is a common experience.

    So...by posting this entry I know that there might be some backlash. I will state that I know that there are many talented and qualified DBAs out there who all work dilligently every day to keep their company data intact. I am just frustrated that there seem to be so few. I will chalk it up to chance and my own geographically challenged, less-than-metro locale on the coast of a penisular state.

More Posts Next page »


















<February 2010>
SuMoTuWeThFrSa
31123456
78910111213
14151617181920
21222324252627
28123456
78910111213
Finding Stuff in SQL Server Database DDL
 You'd have thought that nothing would be easier than using SQL Server Management Studio (SSMS) for... Read more...

Mission Critical: SQL Server 2008 Performance Tuning Task List
 In which Buck Woody imagines how the US military would have tackled DBA checklists for... Read more...

Simple Query tuning with STATISTICS IO and Execution plans
 A great deal can be gleaned from the use of the STATISTICS IO and the execution plan, when you are... Read more...

Switching rows and columns in SQL
 When they use SQL Server, one the commoner questions that Ms Access programmers ask is 'Where's the... Read more...

Writing Efficient SQL: Set-Based Speed Phreakery
 Phil Factor's SQL Speed Phreak challenge is an event where coders battle to produce the fastest code to... Read more...