Results 1 to 9 of 9

Thread: xcopy

  1. #1
    Join Date
    Jan 2003
    Location
    India
    Posts
    523

    Unanswered: xcopy

    hi,
    I have the following statement:
    exec xp_cmdshell 'xcopy f:\data\backup\test1.bak \\server2\backup\ /c'
    it works in command prompt but not in QA. i tried dir on both the machines, it works fine.
    harshal.

  2. #2
    Join Date
    Feb 2004
    Posts
    492

    Re: xcopy

    xcopy seems to churn some output if it finds file(s) present so adding /y might help. Also, xp_cmdshell is executed as the user who runs sqlserver so that user may not have access to the share you copy to. Last: in the past (65, 70, 2000 but not sp3) I had some difficulties executing commands such as 'find' and 'fc', both of which lead to dr. watsons.

  3. #3
    Join Date
    Mar 2004
    Location
    Sri Lanka
    Posts
    3

    Re: xcopy

    Hi.
    xcopy doent work properly with xp_cmdshell .

  4. #4
    Join Date
    Jan 2003
    Location
    India
    Posts
    523

    Re: xcopy

    Originally posted by Kaiowas
    xcopy seems to churn some output if it finds file(s) present so adding /y might help. Also, xp_cmdshell is executed as the user who runs sqlserver so that user may not have access to the share you copy to. Last: in the past (65, 70, 2000 but not sp3) I had some difficulties executing commands such as 'find' and 'fc', both of which lead to dr. watsons.
    yeah but there are files present, tried using /y no change

  5. #5
    Join Date
    Jan 2003
    Location
    India
    Posts
    523

    Re: xcopy

    Originally posted by dishanf
    Hi.
    xcopy doent work properly with xp_cmdshell .
    can u please elaborate? any workarounds for it?
    I tried using copy but it says access denied.
    regards,
    harshal.

  6. #6
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Try doing xcopy to the same location with a different extension as a test...

    I had no problems using xcopy..

    My money is on:

    Your sql server service account does not have rights to \\server2...

    check it out...
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  7. #7
    Join Date
    Nov 2003
    Location
    London
    Posts
    169
    Hi,

    I use a thing called 'Robocopy' and this can be used with xp_cmdshell.

    Do a google search for it

  8. #8
    Join Date
    Jul 2003
    Location
    The Dark Planet
    Posts
    1,401
    master..xp_cmdshell 'C:\WINNT\system32\xcopy.exe c:\foldername \\ntbomosc\foldername\ /S /Y'


    This works fine .. try this
    Get yourself a copy of the The Holy Book

    order has no physical Brett in The meaning of a Kaiser . -database data

  9. #9
    Join Date
    Jan 2003
    Location
    India
    Posts
    523
    Brett, I agree with u, since it works while copying to the same machine but if I try to copy to another server it gives an error. But at the same time the service is under local admin which is the admin, and has got all the rights.

    Enigma, I'll have to try u'r trick, since this problem had occured at the client side, I'll try this when I get back there in a coupla days and let u guys know.

    Thanks for the inputs.
    harshal.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •