CmdExec Job Problems

  • I'm having trouble with a CmdExec step:

    "\\nfs001\it\projects\SQL Projects\Migrate_NAZD_1\Load_code_tables.cmd" z nazhqdb02 opal_test

    When I run the Load_code_tables.cmd manually from a command prompt it works just fine no matter who I run it as (the dbuser/pw it uses are stored in the .cmd file).

    However, when I try to run it as a job, it give me:

    Executed as user: NAZNT\bgordon. The process could not be created for step 1 of job 0xAE0D6E4D27E949458122D9B6802E85C5 (reason: Access is denied).  The step failed.

    The NAZNT\bgordon user is an admin on the SQLServer Box, A member of the sysadmin role on SQL Server, the SQLServer Agent service is running as this user, and the user has the same permission as my user does to the folder where the .cmd file is located.  I've set the job up to be owned by this user, and it is executing using the SQL Agent service acct.

    Anyone have any idea about what I'm missing that would be causing this error?

    Thanks!

    The Redneck DBA

  • I think you answered your own question "executing using the SQL Agent Service Acct.".  All network connections and file permissions will be based off the Account that SQL Agent is running under. You may want to setup a xp_cmdshell proxy account as specified in http://support.microsoft.com/kb/890775/en-us 

    I have not tried it, but you can probably get what you need to run in xp_cmdshell with the permissions you need if you spawn "runas" and the command you need to be run.

  • I know that it runs as the sql server agent account.  But I've had the network guys set that account up to have the same permissions that my account has across the network, and I can run the command just fine.

    The Redneck DBA

  • Hmm. Maybe you need to see that the account which SQL Agent runs has "Run as batch job" right.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply