Starting to catch up (finally)………………………. and, Happy New Year!

I had started to write this blog post when we (Paul and I) were on our way back from Zurich on November 21. We had been in Zurich presenting a TechNet DeepDive on Database Maintenance Best Practices…after presenting at ITForum in Barcelona…after presenting at SQLConnections in Las Vegas (well, we did spend 30 hours at home in between those last two conferences :)). Once we returned to the US on Wednesday night, it was just before Thanksgiving and well, a few personal things prevented me from getting as much work done as planned in December… and then the holidays hit… and then I realized I was horribly behind and so I’ve been playing catchup ever since. Ah, Happy New Year. 


Now, I’m really back in the swing of things and I wanted to let you know what we’ve done!


First things first – we’ve posted almost all of our resources from our conferences in November (we still have a few more to tweak/post). We’ll catch up with the remaining scripts this week! Check them out on our Past Events page here: https://www.sqlskills.com/pastConferences.asp.


And, now, here are my thoughts as I wrote them on November 21 – with a few updates along the way in this font:


**********


It’s been a great 2.5 weeks with 4 full-day workshops, 17 sessions, 3 interviews and 8 flights to conferences/events in 3 countries. OK, Paul has been with me too and that hasn’t stopped him from blogging (I know you’re all thinking this :) but, he blogs shorter blogs posts and I go for quality rather than quantity (TOTALLY kidding…lol…I am SO in trouble for that one (update: I’m glad I didn’t post this until after the holidays!)). And, well I’ve also been pushing through a bit of a cold (and, Paul doesn’t sleep ;=).


So, here’s a long post to catch you up on all the travels and even some of the great questions we’ve been asked while running around from conference to conference. First, it was a great week in Vegas for SQLConnections. We ended that week with a full-day workshop that was all hands-on on SQL Server 2005. Our 80+ attendees downloaded a VPC image and used that for the base environment for labs on Database Mirroring, Database Snapshots, Partitioning, Partial Database Availability and Online Piecemeal Restore… (Update: We received our evaluations from this session (only 37 evals were submitted) but they really seemed to enjoy it! Our reviews were fantastic (literally 4 of 4) and so, we’re planning to do this again for the Spring SQL Connections. More details coming.)


And, speaking of the VPC/DVD… We’ve had a lot of requests for these resources (the DVD, the lab manual, the utilities, etc.) and we’re already working on an updated version of this for SQL Server 2008 CTP5 which just came out on Friday (November 16) (update 1/13/2008: we’ve finished the November CTP update and it will be available on the SQL Server 2008 Readiness Kit). And, that’s just a start! (update 1/13/2008: we’ve also released the DDM, check out Paul’s post here). With 9 labs on the current SQL Server 2005 version, a few new exercises planned for the first 2008 version (the labs include exercises on automatic page repair for Database Mirroring AND updates for Peer to Peer including the Peer Topology Viewer, etc.) AND a second DVD on Manageability (already working on labs for SQL Server Policy-based Managment and Performance Studio (update 1/13/2008: these two are done too and they will also be available on the SQL Server 2008 Readiness Kit). I think we’ll have a TON of resources to help you get started with SQL Server 2008 by the time it releases. We’re also looking (for the first time!) to put together a way for you to access these resources more directly. I *promise* we’ll keep you posted on that as soon as we have the final outcome! (update 1/13/2008: and, that’s the Readiness Kit! Now, we just need to find out all of the details on how/when you can access it. We’ll let you know as soon as it’s available! It’s likely that you will receive it as an attendee at a launch event – February 27, 2008. Check out the launch portal here and you can see when/where a launch event is coming to you: http://www.microsoft.com/heroeshappenhere/register/default.mspx. I can’t promise that they’ll all give out the Readiness Kit but, that’s the most likely place (of which I’m aware at this point) where you’ll receive one. If I find out any additional information, I’ll post it on my blog.)


As for some of the favorites from the labs – people seem to love the Database Mirroring SQLCMD master script that sets up the High Availability Configuration for Database Mirroring. So, I thought that this might be an interesting script to post here: GenericDatabaseMirroringSetup.sql (16.73 KB). And, to make it even more flexible, I have modified this script quite a bit and made almost everything parameterized (PrincipalServer, PrincipalDNS, PrincipalPort, MirrorServer, MirrorDNS, MirrorPort, WitnessServer, WitnessDNS, WitnessPort, Database2Mirror, RestoreWithMove, BackupLocation). Also, you can decide to “move” the database being restored on the mirror (to the mirror instance’s default data root) OR keep the database backup directories exactly the same (which is generally the recommended configuration). In our lab, we move the database to the instance’s default directory when it’s restored on the mirror because all three instances are on the same virtual machine. However, in a real-world database mirroring environment, you want to try and avoid moving the database to a different drive location on the mirror because future changes might cause the mirroring partnership to become broken. So, if you want to play with this script, be sure to modify the parameters at the beginning of the script and then make sure you test this in your environment (and, let me know if you run into any snags… I know this works in our VPC but I just whipped up the modified script relatively quickly so it’s a *learning* script more than anything!). And, here are a few tips for successfully implementing a database mirroring partnership:



  1. Make sure that the principal and mirror server are either identical to each other (in every way) from disk to memory to CPU, etc. When the principal and mirror are identical, you are more likely to minimize performance problems during a failover AND you’re less likely to have additional slowdowns on the principal (in a synchronous mirroring configuration) by slower hardware on the mirror. If you don’t have identical hardware then you want to either choose an asynchronous database mirroring configuration OR be sure to thoroughly test your before and after failover configurations to ensure that performance is “good enough” in a failover sitation. Some shops find it acceptable to run slower during a diaster (v. having downtime) and therefore they choose a secondary server (for the mirror) that’s not quite as powerful as the principal… However, beware that if you’re in a synchronous mirroring configuration then your mirror’s performance might affect the performance of the principal.
  2. Test BOTH your OLTP activity load as well as your batch load AND be sure to test over an entire business cycle. You might be surprised to find that month end processing might surprise you AND/OR a batch process that runs maintenance (for example an index rebuild OR an index defrag over a heavily fragmented table). We’ve seen a few customers that had network problems when under a significant load and if not tested, this could compromise your mirroring partnership by not allowing the mirror to stay in sync OR it might cause “throttling” at the principal. If the database mirroring partnership has over 1MB of of unsent log waiting, then performance on the principal will be slowed to try and help the mirror catch up.
  3. Be sure not to make any assumptions about the way that database mirroring works – even if you have multiple databases being mirrored on the same server. Database mirroring is always between only ONE “principal” database and it’s mirror copy. If you want to mirror multiple databases on the same server – to the same secondary server – that’s possible. However, this presents additional problems in that a failover is between ONLY a single database and it’s mirror. If you have an isolated database failure that causes one of (let’s say four) related databases to failover, then three-part naming will suddently start failing as you have a combination of mirrors and principals on the same server and local (three part naming) won’t work against a mirror database as the mirror database(s) cannot be accessed directly. As a workaround, you could create an alert on the WMI event: database_mirroring_state_change which then forces a failover for the remaining databases… Effectively all four would then failover. While this will work – and, the alert will fire relatively quickly after the first database fails over, it’s important to realize that alerts (and this WMI event) are all *after* the actual failover. The secondary failovers would be asynchronous, response-based events. As a result, there could be a few transactions that fail between the first database failing over and the remaining databases failing over. In a diaster case however, this might be acceptable and if your application is well designed, you might be able to make this relatively seemless…

Also, within the SQL Server 2005 Always On VPC, we found a bug (yes, I know… the shame of it!! ;-) but (and this is our saving grace…) it’s fairly minor and only requires a couple of quick changes to database mail configuration options. We decided late in the game (which is always a bad mistake) that we needed wanted to change the Windows Server name (and we all know what a pain that is!). In fact, there have always been problems associated with a server name change (at least problems for SQL Server picking up this change):



  • The server’s @@servername setting will not be correct. There are actually a few problems that can occur as a result of this but it’s also very easy to fix. The steps are quick and Tibor (an MVP in Sweden) already blogged them here: http://www.karaszi.com/SQLServer/info_change_server_name.asp so I won’t repeat.
  • Jobs will have problems when edited. The problem with jobs is that they have a different “originating_server” than the new (when changed) servername and so when you open a job and try to modify it, SQL Server thinks that the server is a target server in a master/target environment. And, when you’re just a target server receiving jobs from a master, those jobs cannot be modified, they can only be executed. As a result, the job cannot be changed. If you’re going to change your servername, you need to make sure that your jobs change with it. Tibor also blogged the update to msdb.dbo.sysjobs that’s necessary.
  • This one is NEW for SQL Server 2005 – The Windows groups that SQL Server creates on non-failover cluster servers (if you’re on a failover cluster, you must create the security groups manually – check out this whitepaper for more details on failover cluster setup: http://www.microsoft.com/downloads/details.aspx?FamilyID=818234dc-a17b-4f09-b282-c6830fead499&DisplayLang=en) will no longer correspond to the server name (after the change). So far, I have not seen nor heard of a case where this creates a problem – but I won’t be surprised if one of you responds with an issue or two! SQL Server 2005 uses security GROUPs to manage security and service/component-level permissions so that service account changes don’t require permissions to be removed from that account name (in 2000 they did this and the side-effect was that permissions that had already been granted for some other reason – and just happened to be duplicated with the required SQL Server permissions – were removed when you changed the service account. As part of the service account name change and cleanup, they removed all of the permissions needed to run an instance of SQL Server. In SQL Server 2005, they changed this model solely to put you into the correct server group (like SQLServer2005MSSQLUser$servername$instancename) and take the former service account out.

And, of course, there are potentially a lot of [additional/other] external dependencies when you make a servername change… and, well, that’s where we missed one. Part of it is because we also setup a POP3/SMTP mail server inside the VPC and when we changed the servername, we also changed the mailserver name (and then forgot to change the Database Mail settings, Outlook Express Account and SQL Server Agent Operator settings). So, you need to change the references to it. The servername was SQLHASP1 and in the June edition of the Always On DVD, we upgraded to SP2 and changed the servername to SQLHAVPC (notice the more generic name… duh!). For completeness, I’ll put a bit more detail here:


Database Mail – Manage account, View existing account, check correct domain and server name
SQL Agent – Ensure operators have correct domain and NET SEND address
Outlook Express – Ensure correct server name + domain name



And, now, you should be able to sucessfully use this POP3 mail server in the lab exercises on WMI Events with Database Mirroring. For more details and references (even if you don’t have the lab content) check out the links to all of the Database Mirroring whitepapers here: https://www.sqlskills.com/whitepapers.asp. (update: Paul blogged about a bunch of new whitepapers here and some of these are very new!)


**********


And, that’s all I had in my November 21 version of the blog post (see, this is what happens, I write a huge post and then start researching things and put the post on the side to post later… and, later is WAY later in this case…. Sadly, I have a bunch of half-finished posts like this. More posts than time :)


So, a lot more to post over the coming days/weeks as the SQLskills team is heads down in SQL Server 2008 working to create some great content (for example, the labs mentioned above).


And, HAPPY NEW YEAR! (at least I said this before January was even over :)


Cheers,
kt

Leave a Reply

Your email address will not be published. Required fields are marked *

Other articles

Wow! Wow! Wow! THANK YOU!

I announced my retirement from SQL/tech here and your comments on my blog, on LinkedIn, and on Facebook were overwhelming and humbling! I’m so touched

Explore

Imagine feeling confident enough to handle whatever your database throws at you.

With training and consulting from SQLskills, you’ll be able to solve big problems, elevate your team’s capacity, and take control of your data career.