Author: Calin OPREA

  • SQL Server installation tips… NOT

    I have to admit that I shamelessly “steal” any info available on the net when it comes to SQL Server. Just to give you a quick example: Brent Ozar and Jonathan Kehayas both have some neat articles about installing SQL Server. Of course, I use the Next > Next > Finish feature, just as anybody else, but every now and then some wise IT managers are asking me “why did you do this”. Then I get to tell him or her that is because some guys said that this is good practiceJ.

    Anyway, moving on, I want to point out how to change the default installation of SQL Server.

    Change the default installation path

    Truth be told, I have no idea how to change the default installation path for SQL Server per se, but rather to where the Program Files folder will reside. To change the default location:

    1. Go to Registry Editor (regedit); on my local machine (Windows 7), the sequence is Start > type regedit in the Search Programs and Files text box, and click regedit.exe.
    2. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion

    You should see something similar to the window (ok, dialog box; stop it, you technical writers) below:

    As you can see, the CommonFilesDir entry holds the default path of Program Files. Simply change the value data in the Edit String dialog box (double-click the entry to get there) and you’re done.

    I hope this helps.

    Best regards,
    io

  • Strange error in SQL Server 2005… when aplying SP3

    Before going any further, let’s get this straight: I’m not sure whether it’s a bug or not, whether can be reproduced or not, but I care to have this documented.

    A machine was re-installed (Win 2003, SQL 2005), having 3 named instances (no default, just named instances). SP3 was applied… and nothing was like before:-). You could start only one instance (any instance, for that matter), but not all of them.

    Apparently the solution was to install SP3 on all the instances at the same time, and not one after another.

    I know, it’s generic, it might not be relevant because it is that generic, but again, if you ever encounter this, you might want to check this among other things.

    best regards,
    calin


    PS > still couldn’t replicate it, so it must be something else:-)

    PS 2 > now ladies and gentlemen… for the solution: NEVER replicate everything from production to each of the instances (that would mean also the system databases).

    see here and here for additional details.

    as for me, I’m still laughing in tears:-)

  • SQL 2008 DBA now

    I made myself an early Christmas present: since I had a free exam voucher from Microsoft, I said to myself heck, since I’m not paying for the exam, it’s kinda time to upgrade my DBA skills from 2005 to 2008. That is, 70-453.

    OK, I passed, but I want to tell you some impressions:

    • tough exam
    • difficult exam
    • not piece of cake exam

    Having said that, the main idea is this: it’s actually a combination of 70-432 and 70-450 exams, namely you’ll get around 25 questions from each exam – at least this is what I got from my paper, reporting that I passed both MCTS and MCITP exams:-). In addition, make sure you know the stuff, because they are gonna test your skills, ranging from DMVs all the way to disk subsystem configuration.

    The only thing left to be said is the fact that yes, finally, there’s no chance for you to have a single choice question and more than one correct answer. It might seem like, but trust me, it’s not the case. I learned this on my own, as I screwed up some answers to apparently simple questions.

    Final word on preparation materials: there’s a little hidden gem on the net, called SQL Server 2008 Jumpstart, which has been turned into free e-clinics on Microsoft e-learning site by now. Believe me, if you already have some SQL Server knowledge and you’re not taking this learning thing from scractch, there’s nothing much that you need besides these videos.
    The little much that you need, though, are the (famous by now) “Inside SQL Server 2008” series for SQL Server Development, and the SQL Server 2008 Architecture and Internals, all from MS Press. Of course, you can also read the auhtor’s blogs, which are by all measures far more interesting than mine, but I’m working in that direction:-).

    I’ll close with an anecdotical story: I took the test at the same center where I teach SQL Server classes. The guy said: OK, if you fail the exam, at least that was for free. I told him: if I fail this exam, then it means that I did not pay much attention to what the teacher had explained last week, when teaching the administration course.
    You can pretty much guess who was the teacher:-)

  • talking about customer care:-)

    I just received (as an MCT I get all kinds of goodies) a free licence of PerfectDisk 11. So far, so good… but: “the official release isn’t until tomorow, but I wanted to make sure our MCTs had it in their hands a little early”.
    This is what I call “yes, they care about me”.

    best regards,
    io

  • much ado about data types

    I recently (yesterday, in fact), got to see some amazing recommendations regarding the use of data types. Now I have the chance to provide my personal opinions (guidelines):

    • primary keys: monotonous, ever increasing values – personal choice, but it can introduce unnecessary complexity. So, for the case of small tables, use whatever fits you:
      as an example, I have a table with the primary key set to a char(1), which holds 4-5 unique values (something like I, M, C, S). It’s a “large” table, something in the line of 2-3 KB, so I don’t bother changing it just for the sake of introducing unnecessary joins.
    • if you search for a particular column, index it – actually, this is the very first time I heard this:-). I will blog about indexes a lot, later on, but suffice to say that nope, don’t you ever to that.
      It is worth mentioning that Kimberly Tripp (let’s just say that she’s the guru when it comes to indexes) recommends indexing the foreign keys (non-clustered indexes), but this scenario is applicable in few situations. On a high-load production OLTP it might not be such a wise choice, as I have discovered myself a while ago. Yes, she also mentions the fact that there are scenarios in which it is not applicable.
    • the thing for which wars have started: how “large” is a large table – I’m playing with virtual machines (as an MCT) and I query tables that have 10 million rows without a fuss, and all this on a laptop. Saying that one should split tables because they “seem large”… hm… let’s digress a bit.
      I also got to see a database broken down into smaller databases, based on a particular criteria, let’s say “month”. Now the nightmare begins: query 10-12 databases instead of one. Not to mention the monotonous, ever increasing (sorry, I couldn’t help it) transaction logs for the plethora of databases that will be on the server after say, two years. Now, going back to our discussion…
      breaking up databases like that is because they “seem large”. A simple table partitioning would have solved the problem of large tables (subject of another post).

    So, my point is: bad advice comes through the same channels as good advice does. I feel like being a good guy today, so I’m giving you a link that might lighten up the choice: http://sqlblog.com/blogs/aaron_bertrand/archive/2009/10/12/bad-habits-to-kick-using-the-wrong-data-type.aspx.
    Have a good day ahead

  • Simple lesson learned

    KISS (Keep it stupid simple) 🙂

    “System.Data.OleDb.OleDbException: [DBNETLIB][ConnectionOpen (PreLoginHandshake()).]General network error. Check your network documentation.” – that was the wife having an issue.

    I told her: okay, do you have SQLNCLI? Obviously, she had it installed.

    Me: well then, check here:
    http://blogs.msdn.com/sql_protocols/archive/2005/10/22/483684.aspx
    http://blogs.msdn.com/sql_protocols/archive/2005/10/29/486861.aspx

    It turned out that SQL Browser service was not started. Again, KISS or be KISS-ed.

  • "Dreadful" i/o errors

    Okay, now I have to admit that this one is not quite cert related, but still:

    Friend: I tango with a suspect database.
    Me: suspect database? why?
    Friend: well, at some point I got an error telling me that it took too much to write something to the database.
    Me: that would be a premiere… sure it ain’t something else?
    Friend: well, I was lucky, no errors reported by DBCC, and I could bring the database online (yes, ALTER DATABASE stuff).

    Long story short: it was a soft i/o error, 823 (although initially reported by the 1117 error). And it was thrown because they were running out of space in one of their virtual machines. So you can encounter i/o errors in virtualized environments as well, so please bear this in mind.
    Also, mind that i/o error 823 is what we call “soft i/o”, while i/o error 824 is what we call “hard i/o”. While 823 is a reason to worry (but no so much, as I’ve shown you in this post), a 824 error is an indication that your disk subsystem is about to give you some unpleasant surprises.

    I hope this helps.

  • First blog

    Well, for whatever reason I decided to run this blog (it’s just a first step of many more to come); it will actually contain all the bells and whistles I am hearing during my SQL Server 2005 courses, which I’m currently teaching.

    First, a bit about me: MCT in SQL Server 2005 – DBA, Windows 2000/2003, married, one kid, another one on the way. Should be more than enough.
    Purpose of this blog: help you get certified – now, there’s a catch, though: get certified through knowledge (which I’m willing to share) and not just cramming the exam. Reason: just go to a job interview and you’ll get the point.
    Area of (above average knowledge): well, SQL Server 2005 Administration :-).

    Let’s have some fun (in the near future).

    best regards,
    calin