0

I have one job to recycle error log every night and it is failing every night with the below error-

Server\MSSQL11.MSSQLSERVER\MSSQL\Log\ERRORLOG' to 'D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Log\ERRORLOG.1' 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." [SQLSTATE 42000] (Error 17049) DBCC execution completed. If DBCC printed error messages, contact your system administrator. [SQLSTATE 01000] (Error 2528). The step failed.

Please advice how to find and kill the process which is using the error log file.

Giorgos Betsos
  • 71,379
  • 9
  • 63
  • 98
user3412628
  • 63
  • 1
  • 1
  • 4
  • Could be access issues, could be permissions, could be kerberos, could be share issues, could be a hung spid, or some other third party app copying/backingup. The error is telling you this already, it's up to you to walk through all these scenarios and any other not mentioned. – Steve Mangiameli Oct 12 '15 at 19:20
  • 1
    You can try downloading and installing [Process Explorer](https://technet.microsoft.com/el-gr/sysinternals/bb896653.aspx): *Process Explorer shows you information about which handles and DLLs processes have opened or loaded* – Giorgos Betsos Oct 12 '15 at 19:20
  • What @GiorgosBetsos said, there are tools you can download that can help you find the process that has the file locked and then you can kill the process. All of this can be done by upstream steps in your job. This post has information about a command line tool that could help... http://stackoverflow.com/questions/241178/command-line-tool-for-finding-out-who-is-locking-a-file – Eric J. Price Oct 12 '15 at 20:53

0 Answers0