export with bcp and xp_cmdshell fails when network cable unplugged

  • Hi

    i have export procedure, implemented with bcp and executed with xp_cmdshell

    and it works fine when the machine connected to network ; )

    but when i unplug the network cable i'm getting "Login failed. The login is from an untrusted domain and cannot be used with Windows authentication."

    i check it both with sa connection and with local windows administrator

    also bcp export works offline from command line,

    and xp_cmdshel executes other commands

    the command looks like this

    exec xp_cmdshell 'bcp "exec MyDB.dbo.MySP" queryout "%temp%\file.csv" -T /SComputerName\InstanceName /c /t,'

    environment is Express 2008 R2 on XP

    any one knows what happens there ?

    10x !!

  • server cannot connect to domain server to verify the windows login.

    Plug the cable back in! 😀

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

  • An alternative is to enable mixed mode authentication, setup a SQL Login that has permissions to run the query in your bcp command and change from using -T to supplying a username and password to the bcp command.

    You'll also want to make sure that either your executing the xp_cmdshell command under a login in the sysadmin role or make sure your xp_cmdshell proxy account is setup to log into the instance using a local Windows account (i.e. not domain account or you'll have the same issue).

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • i thought that bcp gets same account as xp_cmdshell ; )

    thank you orc !!

  • Tania-346155 (3/1/2011)


    i thought that bcp gets same account as xp_cmdshell ; )

    thank you orc !!

    Not always...it depends on who is executing it. Have a look at the "Remarks" section of BOL for more details: http://msdn.microsoft.com/en-us/library/ms175046.aspx

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • opc.three (3/1/2011)


    Tania-346155 (3/1/2011)


    i thought that bcp gets same account as xp_cmdshell ; )

    thank you orc !!

    Not always...it depends on who is executing it. Have a look at the "Remarks" section of BOL for more details: http://msdn.microsoft.com/en-us/library/ms175046.aspx

    i changed sql server service be running with local system account and it works now !! ; ))

    thank you very !!

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

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