In this case we were installing hotfix http://support.microsoft.com/?kbid=960089
Microsoft SQL Server 2005 Service Pack 2 Cumulative Hotfix 3077
The Hotfix Setup would rollback. You will see the below error in the Hotfix.log file
06/24/2009 16:15:38.994 MSP Error: 29538 SQL Server Setup did not have the administrator permissions required to rename a file: d:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\mssqlsystemresource1.ldf. To continue, verify that the file exists, and either grant administrator permissions to the account currently running Setup or log in with an administrator account. Then run SQL Server Setup again.
Now if you peep into the Data folder you would see a mssqlsystemresource1.ldf and mssqlsystemresource1.mdf file which were supposed to be renamed.
It obviously looks like a Permission issue.
Running a Procmon would give you the below result. An access denied on the resourcefile.
MsiExec.exe SetRenameInformationFile D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\mssqlsystemresource1.ldf ACCESS DENIED ReplaceIfExists: True, FileName: D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\mssqlsystemresource.ldf C:\WINDOWS\system32\MsiExec.exe Computer\User
Running Process explorer would show SQLServer having the handle to the Mssqlsystemresource file
If you look at the SQL Server Error logs you will see that SQL Server is running while the Setup is trying to rename the MssqlSystemResource files. This would give and obvious Access Denied error.
SQL Error Log
2009-06-24 16:14:54.18 spid5s Starting up database 'mssqlsystemresource'.
06/24/2009 16:15:38.994 MSP Error: 29538
When we look into the log file SQL9_Hotfix_KB960089_sqlrun_sql.msp,
You will see before the FileRename function call, there is a call to start the SQLWriter service.
In this case SQL Writer was dependent on SQL Service and when Setup would start SQL writer the Service Control Manager would start the SQL Service before and this was the root cause for the file rename to fail.
Add SQLSErver as dependency for SQLWriter. Then tried to install the hotfix and it failed with the same error
sc config "SQLWriter" depend= "MSSQLSERVER"
Now install the hotfix and it should fail
Remove the dependency by running
sc config "SQLWriter depend= ""
1. Look in the SQL9_Hotfix_KB960089_sqlrun_sql.msp file you will see that the function "Do_sqlFileRename" being called to rename the Resource database
2. Create a System Variable named SqlStop and the value as Do_sqlFileRename
3. Run the hotfix. The setup would halt and prompt you when it starts the function "Do_sqlFileRename"
4. Now go to the services panel and stop SQL Server. (You should see a prompt to stop the dependent services as well)
5. Continue the Setup Prompts to finish the installation
TL, Microsoft SQL Server