Prepare SQL Server 2005 in a clustered environment for SP3



Recently I was asked to create a new high availability solution for MS SQL Server 2005. When I finished the installation of SQL Server 2005, I found myself troubled as to why the installation of SP3 failed with the update of the database services. After a lot of searching I found the solution to my problem.

Because I spend a lot of time figuring out why my installation failed I decided to write this article so other people won’t have to spend so much time and frustration installing the service pack. This article also covers the problem for Service Pack 2. I haven’t tested Service Pack 1 with this method.

What exactly goes wrong?

When I looked closely at the installation I saw that at a certain moment the setup program starts some actions for services and databases. After watching the databases being created and deleted, I noticed that something went wrong at the “mssqlresource” database. The setup program tries to overwrite the “mssqlresource” database but for some reason fails, which results in a rollback of that part of the installation. It looks like the “mssqlresource” database is still in use by SQL Server 2005 what creates teh error.

Below are the steps that you can take to install SP3 on your SQL 2005 cluster nodes.

1: Create Backups

As for any DBA you should always backup your databases before you start the installation of updates or complete service packs. In my case I didn’t have many databases on my server because it was a fresh installation. I created backups of all the present databases and I copied the “master” and the “mssqlresource” backup files to a different location.

2: Take the SQL Services offline

Before you stop the services for SQL Server you should take that part of the cluster down. If you don’t do this, the cluster will try to start the service as soon as it goes down. Go to the “Cluster Administrator” and select the resourcegroup where the services for that node reside. Right click the “SQL Server (instancename)” and click on “Take offline”. Do this for every SQL Service.

3: Copy and rename the mssqlresource database

Now that the services are down, we can copy and rename the “mssqlresource” database.

The “mssqlresource” database isn’t visible in SSMS (SQL Server Management Studio) so I had to copy the files from this database.

Go to the shared array where the database is installed and copy and paste them in that directory. In my case I rename it to “mssqlresource_old.mdf” and “mssqlresource_old.ldf” but you can use any name you want.

4: Start SQL Server in single-user mode

Before we can make any changes to the system databases we put the SQL Server in the single-user mode so nobody except the admins can connect to the server. Open a command prompt and type the following command:

For servers with multiple instances you can use the following command:

5: Alter the mssqlresource database

Through the SQLCMD program we can send queries to the SQL Server. In the command prompt type the following command:

If you’re authenticated you’ll see a prompt like “1>”. Now we can send the ALTER queries. Type the following commands for the MDF and the LDF files and press the Enter-key after each command. For the MDF File:

For the LDF File:

After the completion of both commands you’ll get a message that the changes will take effect after the restart of the SQL Server.

6: Restart the SQL Server

Stop the service with the following command:

For servers with multiple instances you can use the following command:

Start the service with the following command:

For servers with multiple instances you can use the following command:

If you complete all these steps, you’ve done the necessary preparations for installing SP2 and SP3 in a clustered environment. The database files that are renamed will be replaced by new files during the installation with the original filenames.

This article is based on the Technet article on this location: I wrote this so that you don’t have to search for that solution in the first place when you install SP3.

Leave a Reply