In this post the focus is on fixing the SQL Server 2008 R2 RTM repair issue. I was trying to apply the windows server 2008 r2 sp1 patch on SQL Server 2008 R2 RTM and it errored out with the following message:
A failure was detected for a previous installation, patch, or repair for instance 'MSSQLSERVER'. In order to apply this patch package, you must resolve any issues with the previous operation that failed. View the summary.txt log to determine why the previous operation failed.
To fix that I was trying to do a repair and then I was facing the following error whenever I tried to do a repair. I tried to reboot the server (this is a test environment) but still could not get around this. Here is the error info:
The following error has occurred: The process cannot access the file 'C:\Windows\system32\perf-MSSQL10_50.MSSQLSERVER-sqlagtctr.dll' because it is being used by another process. Click 'Retry' to retry the failed action, or click 'Cancel' to cancel this action and continue setup.
Fix: My search on internet pointed me to the right location. The link for the fix is here
1) Stop any custom performance monitor logs (Data Collector Sets)
2) Stop Windows Management Instrumentation Service (and any services which depend on it). 3) Install the update in question. Steps 1 & 2 seem to take the relevant perf-MSSQL10_50.*-sqlagtctr.dll files out of use.
The repair completed successfully after stopping the above service and I was able complete my update.
Hope this helps!