We are using ASA 11.0.1 build 2044. The database runs as a windows service using the local system account. I need to copy data files from our web server to our database server before a stored procedure runs. The xopy command is in a batch file and it works fine if I double-click on it or if I execute it from Start>>Run. However, I need to call it as part of a procedure using xp_cmdsheell. When I try to run it this way, nothing happens. Here is the simple script where 'XXXX' is a parameter I am passing to the batch file:
The copy.bat has the following syntax:
Again, this is being run on the database server and we are trying to get files from the web server. The web server is mapped to the database server in windows explorer as follows: c$ on 'server1' (T:). I've modified copy.bat in different ways to get it to work without success. For example, I've tried the following in an attempt to account for UNC mapping:
What is the correct syntax for the xcopy command in this situation? Is this a rights/permissions issue on the folder I am trying to copy from? Thanks, Tom |
If you do not want to change the service username, you can try using the Sysinternals tool PSEXEC. That will allow you to specify a username/password to use to run the command either as you specify or to run it on the remote system (web) back to the DB system. It all depends on what control you have over the usernames and rights on each system. 4
@All: For those who don't know anything about http://sysinternals.com, not only has it always been a 100%-trustworthy website for downloading Windows utility programs, but it is now owned and operated by Microsoft itself. |