When I finished applying the patch I received this error message on all instances and decided to look for the reasons of it.
First thing was to analyze the installation log file at:
C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\PATCH_DATE_AND_TIME\INSTANCE\Detail.txt
On it I found the following messages that explained part of the problem
2012-10-25 22:23:54 SQLEngine: –PerfmonRegistration: Failed to delete file ‘C:\Windows\system32\perf-MSSQL$INSTANCE-sqlctr10.52.4000.0.dll’. Error: Access to the path ‘C:\Windows\system32\perf-MSSQL$INSTANCE-sqlctr10.52.4000.0.dll’ is denied.. Marking it to be deleted on reboot
2012-10-25 22:23:58 Slp: Microsoft.SqlServer.Setup.Chainer.Workflow.ActionExecutionException: File C:\Program Files\Microsoft SQL Server\MSSQL10_50.INSTANCE\MSSQL\Binn\DllTmp64\sqlagentctr100.dll could not be copied to file path C:\Windows\system32\perf-MSSQL10_50.INSTANCE-sqlagtctr.dll. —> Microsoft.SqlServer.Configuration.ScoExtension.CopyFileException: File C:\Program Files\Microsoft SQL Server\MSSQL10_50.INSTANCE\MSSQL\Binn\DllTmp64\sqlagentctr100.dll could not be copied to file path C:\Windows\system32\perf-MSSQL10_50.INSTANCE-sqlagtctr.dll. —> Microsoft.SqlServer.Configuration.Sco.ScoException: The process cannot access the file ‘C:\Windows\system32\perf-MSSQL10_50.INSTANCE-sqlagtctr.dll’ because it is being used by another process. —> System.IO.IOException: The process cannot access the file ‘C:\Windows\system32\perf-MSSQL10_50.INSTANCE-sqlagtctr.dll’ because it is being used by another process.
So, the installation could not remove the file “C:\Windows\system32\perf-MSSQL$INSTANCE-sqlctr10.52.4000.0.dll” (and then marked it to be removed during the next boot) and could not replace the file “C:\Windows\system32\perf-MSSQL10_50.INSTANCE-sqlagtctr.dll”.
After searching on the web I noticed that some people had already faced this problem and opened a ticket with Microsoft and their solution was to do this process manually.
So I decided to try it with the following procedure.
Used the two files created by the installation on the folder:
C:\Program Files\Microsoft SQL Server\MSSQL10_50.INSTANCE\MSSQL\Binn\DllTmp64\
and checked their existence on the folder “C:\Windows\system32”.
The first file had already been copied to the destination folder, so I just had to delete the old file (C:\Windows\system32\perf-MSSQL$INSTANCE-sqlctr10.52.4000.0.dll).
With the second file I first had to stop the instance in question and then replace it (obviously I kept the old file until everything was verified when I could finally delete it).
With these procedures done I executed the patch installer again just to make sure everything was fine. This time everything was fine!
Obviously the best thing to do would be to call Microsoft and let them deal with it (in the case you have a support agreement). You should only do this if you are REALLY sure of the impacts a change like this can cause and you have no other alternative.
After writing this article I found this other one from Microsoft about this exact same problem, but hope mine is useful to someone.