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
 Easy Explanation for Alternative to xp_cmdshell?

Author  Topic 

kzabbott
Starting Member

1 Post

Posted - 2014-10-17 : 17:40:08
I've inherited the care and feeding of some SQL Servers, including a new SQL2012R2 server running on Windows 2012R2.

I'm trying to enable native SQL backups on the SQL2012R2 box to a remote CIFS share (mapped as a local drive) following what I've found installed on some of the SQL2008R2 boxes I inherited.

What I have discovered is that my predecessor uses xp_shell which is enabled on the servers, and maps the drive by calling a batch file.
So, I tried enabling xp_shell and mapping the drive and viola! the remote share is accessible as a backup destination via SQL.

However, what I have read in the forums here and elsewhere leads me to believe that leaving xp_shell enabled is insecure, and cumbersome to enable it, run the backup, and disable it (although doable, I suppose).

So what can I do that is secure to make my mapped drive available for my backup job?

The SQL commands are run as local server administrator
mapping of share is done by a network account created solely for that purpose.

K. Zachary Abbott

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-10-17 : 17:43:06
Use a UNC path instead of a mapped drive. Mapped drives are so 1980.

backup database db1
to disk = '\\server1\share1\dir1\file1.bak'

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -