Sql-server – SQL Server Agent Job – Unable to open Step output file. The step succeeded

restoresql serversql-server-2017sql-server-agent

I have seen many posts with "Unable to open Step output file.", but can't find any references where the step succeeded. I have my output file location set to:

$(ESCAPE_SQUOTE(SQLLOGDIR))\$(ESCAPE_SQUOTE(JOBNAME))_$(ESCAPE_SQUOTE(STEPID))_$(ESCAPE_SQUOTE(STRTDT))_$(ESCAPE_SQUOTE(STRTTM)).txt

Many other jobs on the same server are using the exact same output location (verified exact character match). This job is owned and being executed as the same user as the jobs which are successfully creating output files.

The job is performing a database restore of a user database with the job config pointed at the master database. This is the only job pointing at master, but I would be surprised if that made the difference.

Any thoughts?

Best Answer

It was recommended that I review the job name for any characters that would resolve to a bad windows file path since I am using a variablized path. This ended up being due to a '/' in the SQL Server Agent Job name.