4

I'm running into a problem when trying to run any of the jobs created by Ola's script:

The process could not be created for step 1 of job 0x19DAD4A7019FB04D9C984027FCA2F4E3 (reason: The system cannot find the file specified). The step failed.

I've made sure that sqlcmd is in the PATH environment variable, and I've also put the sql agent service account in local administrators to make sure it isn't a permission issue.

When I log into the server locally with an account that has local admin rights and sysadmin on the sql server and try to run sqlcmd.exe I get the following:

Sqlcmd: Error: Microsoft ODBC Driver 11 for SQL Server : Named Pipes Provider: Could not open a connection to SQL Server [2]. .

Sqlcmd: Error: Microsoft ODBC Driver 11 for SQL Server : Login timeout expired.

Sqlcmd: Error: Microsoft ODBC Driver 11 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and i f SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..

Has anyone else run into this issue?

  • 2
    Sounds like you have a proxy account running. I'd find any proxy accounts and verify if it's executing the cmd in place of the sql agent. Then you can adjust the accounts privilege as necessary or adjust the account itself. – Shaulinator Apr 4 '18 at 14:47
  • Not sure how that would even happen. I just set up this server, so it shouldn't have any shenanigans going on. – UIowaJeremy Apr 4 '18 at 16:52
  • Is the service account running the job in the sysadmin role in SQL Server? – Shaulinator Apr 4 '18 at 16:57
  • When it is called by a user that is not a member of the sysadmin fixed server role, xp_cmdshell connects to Windows by using the account name and password stored in the credential named ##xp_cmdshell_proxy_account##. If this proxy credential does not exist, xp_cmdshell will fail. docs.microsoft.com/en-us/sql/relational-databases/… – Shaulinator Apr 4 '18 at 17:01
  • The service account I created and assigned to sql agent upon installation isn't in the sysadmin group. Shouldn't the sql server install do that? – UIowaJeremy Apr 4 '18 at 19:17
1

This ended up being a permission issue to the path where sqlcmd resides.

  • 3
    I understand that it's your question and answer, but you may want to provide some additional detail here about how you fixed it so anyone else who has a similar problem can find some value in it. – Erik Darling Apr 6 '18 at 14:31
0

Sqlcmd: Error: Microsoft ODBC Driver 11 for SQL Server : Named Pipes Provider: Could not open a connection to SQL Server [2]. .

Sqlcmd: Error: Microsoft ODBC Driver 11 for SQL Server : Login timeout expired.

Sqlcmd: Error: Microsoft ODBC Driver 11 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and i f SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..

To fix the error above, log into the SQL Server and open up the SQL Server Configuration Manager. Navigate to SQL Server Network Configuration -> Protocols for [Instance Name]. Right-Click and enable Named Pipes.

Enabling the Named Pipes protocol will require a restart of the appropriate SQL Server Database instance service in order to take effect.

Once the SQL Server Database Engine service is restarted, you will be able to run SQLCMD.

0

I ran into a very similar error "Executed as user: NT Service\SQLSERVERAGENT. The process could not be created for step 1 of job 0x0E4E0C4738AF0D4C8A1F629146CE1EFE (reason: The system cannot find the file specified). The step failed."

I had previously updated my Ola scripts and had not recreated the jobs. I did copy over the new scripts within the jobs but overlooked changing the job type from CmdExec to T-SQL.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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