1

I recently migrated my system databases to a new location.

I then experienced failures of my SQL Agent jobs with the following error:

2015-10-03 01:53:10 - ! [136] Job  -     reported: Unable to open Step output file.

I can set the location for the step output file by accessing the 'Job Step Properties - Advanced' tab, but it is blank.

Where is the default location for this?

I have found resources which specify it is The default location depends on the location of your

C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Log\xxxxx.txt

but this is not the case on my server. Is there an environment variable that holds the path to MSSQL\Log as I changed the directory and this would explain why the failures occurred. I would like to update the default without having to enter a static location for every job.

I initially thought this could be set by using the sp_set_sqlagent_properties store procedure like so:

USE MASTER
GO
EXEC msdb.dbo.sp_set_sqlagent_properties 
@errorlog_file=N'U:\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\SQLAGENT.OUT'
GO

But this still allows existing jobs to fail.

Is there a way to script the update of the step file location from one drive to another but using the same file paths and names?

5
  • Does the job owner has sufficient privileges or access to the default folder? Could that be the reason job is not able to open the O/P file location?
    – KASQLDBA
    Commented Oct 5, 2015 at 14:57
  • The default was never c: despite this being the location to which the installation was done. I think it is related to the location of the system databases, as these are what I moved along with the directory structure. Permissions are not an issue, the error was caused as the path to the file no longer exists, but I want to move it anyway, not just recreate the path removed.
    – Thronk
    Commented Oct 5, 2015 at 15:01
  • 1
    I just tried adding a job with output directed to "test.txt", however the job reported the same error you're seeing "Unable to open Step output file". This leads me to believe you must specify the path, not just the name of the file.
    – Hannah Vernon
    Commented Oct 5, 2015 at 15:20
  • I believe if you do not specify anything, it will work though. Don't specify the name of the file OR the path to it and it has worked previously.
    – Thronk
    Commented Oct 5, 2015 at 15:30
  • I stand corrected. You are correct in that a file name should be listed. I believe my answer sets this file name as the default for jobs, but I won't accept it until I have tested it.
    – Thronk
    Commented Oct 5, 2015 at 20:09

1 Answer 1

0

If the Job Step runs a Maintenance Plan, then the logging is perhaps being done in the "Maintenance Plan" which is somewhat common. Choose the specific Maintenance Plan (from SSMS -> Management -> Maintenance Plans) that is referenced by the Agent Job, click on the circled icon for "Reporting and Logging" and check the logging location on it as shown in the dialog below:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.