Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 How to copy files between two non-SQL servers

Author  Topic 

schan8593
Starting Member

13 Posts

Posted - 2012-07-12 : 12:37:47
Hi, I'm new to using SQL, and I have the task to copy files between one server and another. Both are non-SQL based servers, with one server being of type VSS and the other being just a regular server that holds files. I was wondering, is it possible to use SQL server 2012 to copy files from the VSS server to the file server? If so, can anyone go through a detailed process on how to do it? I'm new to using SQL server and I was hoping if someone could point me in the right direction. My SQL server is being virtualized on VMware but the other two aren't. Any help is appreciated. Thanks.

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2012-07-12 : 12:43:46
Depends on the connectivity.
You could give access to the sql server service account or a cmdshell proxy, enable xp_cmdshell then
exec master..xp_cmdshell 'copy \\sourceloc\sourcefile.ext \\destloc\destfile.ext'

The string can be a variable which you build in a query.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

schan8593
Starting Member

13 Posts

Posted - 2012-07-12 : 12:55:47
What do you mean give access to the SQL server service account or cmdshell proxy? Sorry I'm a bit new to SQL. Also could you please elaborate what you mean on the connectivity? And would I just type in that string after I hit new query?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2012-07-12 : 13:08:19
Why would you use SQL Server to do this? This is a job for Powershell on either the VSS or the file server. This process does not belong on the database server.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

steve_r18
Yak Posting Veteran

59 Posts

Posted - 2012-07-13 : 12:00:59
This can be easily batched and run by the SQL Server Agent, but as Tara said, this does not really belong on the database server unless the intent is to copy local database files (could also be remote I suppose), but beyond that power shell is your best friend for simple tasks like this.

Steve
Go to Top of Page
   

- Advertisement -