Friday, 14 September 2012

Moving SQL Agent Log file "SQLAGENT.OUT" to a different location


Moving SQL Agent Log file "SQLAGENT.OUT" to a different location


 stored procedure for retrieving SQL Agent properties

sp_get_sqlagent_properties is and undocumented stored procedure to retrive the SQL Agent properties of a particular server. This stored procedure can be found in msdb database.

Usage:
EXEC msdb..sp_get_sqlagent_properties

-------------------------------------------------------------------------------

In one of my previous posts "Undocumented stored procedure for retrieving SQL Agent properties", I had explained how to retrieve the SQL Agent Properties.
In this post I will explain how to change the location of the SQL Agent Log file "SQLAGENT.OUT".

To find the current location of SQLAGENT.OUT file, execute the below SP and look at the value of the column "errorlog_file". This is location where SQLAGENT.OUT file is located.
?
1
2
EXEC msdb..sp_get_sqlagent_properties
GO
Output:

Now, to change the location of SQLAGENT.OUT file, run the below command and re-start the SQL Server Agent Service and you are done.
?
1
2
EXEC msdb.dbo.sp_set_sqlagent_properties 
@errorlog_file=N'<new path>\SQLAGENT.OUT'

No comments:

Post a Comment