question

cstephen avatar image
cstephen asked

xcopy to copy db files from one server to another server

hi i need to configure the sql jobs to copying sql server backup files from one server to another server with using xcopy method.
copy-databasecopysql-backup
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Grant Fritchey avatar image Grant Fritchey ♦♦ commented ·
This web site works by voting. For all helpful answers below, indicate this by clicking on the thumbs up next to those answers. If any one answer lead to a solution, indicate this by clicking on the check mark next to that answer.
0 Likes 0 ·
eswar avatar image
eswar answered
In order to do this you need to write a procedure in the destination server you need to NETUSE command and map the server and then need to write a code to copy using XCOPY or ROBOCOPY(much faster than XCOPY)and then you can schedule a job using this proc.
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

KenJ avatar image KenJ commented ·
I haven't used xcopy in years. Does it really require the network drive to be mapped?
0 Likes 0 ·
iainrobertson avatar image
iainrobertson answered
You could also use PowerShell (either via robocopy or using the Copy-Item cmdlet) to do this. Might be a bit less involved. Certainly a bit more current. But whether you can depends on your environment and circumstances. Copy-Item: http://technet.microsoft.com/en-us/library/hh849793.aspx Run PowerShell via SQL Agent: http://msdn.microsoft.com/en-us/library/hh213688.aspx
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.