SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Unable to recycle SQL Agent log: SQLServerAgent Error: 32.

Today the maintenance job that recycles the SQL Agent error log failed on one of our production SQL Server with the following error message:

Message: Executed as user: MyDomain\_svcSQLServer. SQLServerAgent Error: 32. [SQLSTATE 42000] (Error 22022). The step failed.

This job uses [dbo].[sp_cycle_agent_errorlog] procedure that resides inside msdb, which enables you to cycle the error log files without stopping and starting the server. When I tried to execute the [dbo].[sp_cycle_agent_errorlog] manually in SQL Server Management Studio it failed with following error message:

Msg 22022, Level 16, State 1, Line 0
SQLServerAgent Error: 32.

I researched this issue and found that the SQL Agent log file was locked by other process. I killed the process that was locking the SQL Agent log file, restarted the SQL Server Agent service and this time job successfully recycled the SQL Agent error log.

Basit's SQL Server Tips

Basit Farooq is a Lead Database Administrator, Trainer and Technical Author. He has more than a decade of IT experience in development, technical training and database administration on Microsoft SQL Server platforms. Basit has authored numerous SQL Server technical articles, and developed and implemented many successful database infrastructure, data warehouse and business intelligence projects. He holds a master's degree in computer science from London Metropolitan University, and industry standard certifications from Microsoft, Sun, Cisco, Brainbench, Prosoft and APM, including MCITP Database Administrator 2008, MCITP Database Administrator 2005, MCDBA SQL Server 2000 and MCTS .NET Framework 2.0 Web Applications.


Leave a comment on the original post [basitaalishan.wordpress.com, opens in a new window]

Loading comments...