Unable to cycle error log file from '' to '' due to OS error '32(The process cannot access the file because it is being used by another process.)'.
You try to recyle your Error log file say using EXEC sp_cycle_errorlog or you have scheduled a Job to recycle your Error log file on periodic bases and sometime you might come across below error
"Unable to cycle error log file from '' to '' due to OS error '32(The process cannot access the file because it is being used by another process.)'.A process outside of SQL Server may be preventing SQL Server from reading the files. As a result, errorlog entries may be lost and it may not be possible to view some SQL Server errorlogs. Make sure no other processes have locked the file with write-only access."
DBCC execution completed. If DBCC printed error messages, contact your system administrator."
There might be other operations which might be currently accessing the errorlog.
So what next now, what can you do. You can run the below query and get the processes which are access your Error Log, kill them or wait until they complete and then Re Issue the recycle log statement
USE MASTER GO SELECT SPID, ER.command,ER.blocking_session_id, SP.DBID,LASTWAITTYPE, DB_NAME(SP.DBID) AS DBNAME, SUBSTRING(est.text, (ER.statement_start_offset/2)+1, ((CASE ER.statement_end_offset WHEN -1 THEN DATALENGTH(est.text) ELSE ER.statement_end_offset END - ER.statement_start_offset)/2) + 1) AS QueryText, TEXT,CPU,HOSTNAME,LOGIN_TIME,LOGINAME, SP.status,PROGRAM_NAME,NT_DOMAIN, NT_USERNAME FROM SYSPROCESSES SP INNER JOIN sys.dm_exec_requests ER ON sp.spid = ER.session_id CROSS APPLY SYS.DM_EXEC_SQL_TEXT(er.sql_handle) EST where ( text = 'xp_readerrorlog' OR text = 'sp_cycle_errorlog')