Recycle error log and SQL Server agent error log (SQLAgent.out) file | SansSQL

Wednesday, June 6, 2012

Recycle error log and SQL Server agent error log (SQLAgent.out) file

Recycle Error log:
When we run the below command, it Closes the current error log file and cycles the error log extension numbers just like a server restart.
Permission Requiredsysadmin fixed server role
USE msdb 
GO
EXEC sp_cycle_errorlog
GO

Recycle SQL Server Agent error log (SQLAgent.out):
When we run the below command, it Closes the current SQL Server Agent error log file and cycles the SQL Server Agent error log extension numbers just like a server restart.
Permission Required: sysadmin fixed server role
USE msdb 
GO
EXEC dbo.sp_cycle_agent_errorlog 
GO

1 comment:

Azhar Khalid said...

Found this while taking a breather from researching dissertation writing services for my postgraduate work — the sp_cycle_errorlog command is something I had been looking for ages without knowing what it was actually called. Clean and straight to the point, exactly the kind of practical SQL reference that deserves to be bookmarked immediately!

Post a Comment

Ads