URGENT... Help needed with xp_cmdShell

  • HI, I'm trying to execute bcp from a sotred proc. calling xp_cmdshell and only get this error... what it means? How can I avoid it?

    Msg 50001, Level 1, State 50001

    xpsql.cpp: Error 1813 from GetProxyAccount on line 604

     

    NDM

  • If your sever is configure to use the SQL Agent proxy account and you are running this code from a job and that job owner is not the current login then it means that your proxy account has to be fixed to get access to xp_cmdshell.

     


    * Noel

  • To allow access to XP_CMDSHELL:

    o grant execute on the XP_CMDSHELL (in the Master DB) to your SQL User (or SQL Role)

    o then, determine if a SQL Server Agent Proxy Account exists: EXEC master.dbo.xp_sqlagent_proxy_account N'GET'

    o IF No SQL Server Agent Proxy Account exists:

       - review the examples/documentation below for setting the SQL Server Agent Proxy Account

       - set the SQL Server Agent Proxy Account using the DDL below

       - then, under Ent Mgr's Management tab:

          o right mouse clck SQL Server Agent

          o click Properties then Job System and "un-check" box at bottom - Non-Sysadmin JobStep Proxy Account

    o see Explanations after "live" statements below

    EXEC master.dbo.xp_sqlagent_proxy_account N'GET'

    EXEC master.dbo.xp_sqlagent_proxy_account N'SET',

                 N'CompanyDomain', -- agent_domain_name

                 N'ralph', -- agent_username

                 N'ralph_pwd' -- agent password

    /*  Examples: Setting / Re-Setting the SQL Server Agent Proxy Account

    A. Retrieve the currently assigned SQL Server Agent proxy account

    This example retrieves the account currently assigned for use as the SQL Server Agent proxy account.

    EXEC master.dbo.xp_sqlagent_proxy_account N'GET'

    Domain               Username

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

    NETDOMAIN            john

    B. Set the SQL Server Agent proxy account without a password

    This example sets the SQL Server Agent proxy account to LONDON\ralph without specifying a password. This example will

    receive an error that the extended stored procedure cannot log in if the LONDON/ralph account actually has a password.

    EXEC master.dbo.xp_sqlagent_proxy_account N'SET',

                 N'NETDOMAIN', -- agent_domain_name

                 N'ralph', -- agent_username

                 N'' – agent password

    C. Set the SQL Server Agent proxy account with a password

    This example sets the SQL Server agent proxy account to LONDON\Ralph and specifies a password.

    EXEC master.dbo.xp_sqlagent_proxy_account N'SET',

                 N'NETDOMAIN', -- agent_domain_name

                 N'ralph', -- agent_username

                 N'RalphPwd', – agent password

    */

     

    BT
  • Thanks.

    Changing option in EM/Mgmnt/server Agent/JobSystem worked ok!

     

     

     

  • I love this forum. Saved again for the umpteenth time


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

    Did you know that if you don't drink your milk every morning, the Arla-rabbit will come and shoot you in the head, or sometimes in the belly?

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

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