Prepare SP3 for MS SQL 2005 in a clustered environment

Sander StadSysteemontwikkelaar, Database Administrator
Published:
Updated:
Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3.

When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed by 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 during the update?
When I looked closely at the installation I saw that on a certain moment the setup program start 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 what results in a rollback of that part of the installation.
 

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" to a different location.
The "mssqlresource" database isn't visible in SSMS (SQL Server Management Studio) so I had to copy the files from this database.
 

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 resource group 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 the services are down we can copy and rename the "mssqlresource" 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:
 
NET START MSSQLSERVER /f /T3608

Open in new window

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

NET START MSSQL$instancename /f /T3608

Open in new window

 

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:
 
SQLCMD -S servername\instance -U adminuser -P password

Open in new window


If you're authenticated you'll see a prompt like "1>". Now we can send the ALTER queries. Type the following command for the MDF and the LDF file and press the Enter-key after each command.

- MDF File
 
ALTER DATABASE mssqlsystemresource MODIFY FILE (NAME = data, FILENAME = 'mssqlsystemresource_old.mdf')
                      GO

Open in new window

-LDF File
 
ALTER DATABASE mssqlsystemresource MODIFY FILE (NAME = log, FILENAME = 'mssqlsystemresource_old.ldf')
                      GO

Open in new window


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:
 
NET STOP MSSQLSERVER

Open in new window


For servers with multiple instances you can use the following command:
 
NET STOP MSSQL$instancename

Open in new window


Start the service with the following command:
 
NET START MSSQLSERVER

Open in new window


For servers with multiple instances you can use the following command:
 
NET START MSSQL$instancename

Open in new window


Now 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 file names.
0
3,590 Views
Sander StadSysteemontwikkelaar, Database Administrator

Comments (0)

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.