Home > Archive > MS SQL Server > December 2006 > xp_cmdshell ACCESS IS DENIED









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author xp_cmdshell ACCESS IS DENIED
Joe K.

2006-12-13, 12:13 am


I am trying to use xp_cmdshell to daily copy a SQL Server database backup
file from server A to B.

USE Master
GO
EXEC 'xp_cmdshell D:\NMEX_db_12122006.BAK \\b\K$'

Output Results: Access is denied

When I map a drive to Server b and drive K, I am able to copy the
D:\NMEX_db_12122006.BAK file to the K drive using Windows Explorer.

Please help me determine why I receive "Access is denied" error from
xp_cmdshell within SQL Query Analyzer. But I am able to complete this task
with windows explorer by mapping the server and drive and copying the file
with windows explorer.

Thanks,
Arnie Rowland

2006-12-13, 12:13 am

Perhaps the Proxy account does not have permission to write to \\b\K$...

Or you are not a admin on the SQL Server and don't have permissions to use
xp_cmdshell...

--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc

Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous

You can't help someone get up a hill without getting a little closer to the
top yourself.
- H. Norman Schwarzkopf


"Joe K." <JoeK@discussions.microsoft.com> wrote in message
news:F1E6ABFA-C00A-42EA-A49E- 22B699E8D34F@microso
ft.com...
>
> I am trying to use xp_cmdshell to daily copy a SQL Server database backup
> file from server A to B.
>
> USE Master
> GO
> EXEC 'xp_cmdshell D:\NMEX_db_12122006.BAK \\b\K$'
>
> Output Results: Access is denied
>
> When I map a drive to Server b and drive K, I am able to copy the
> D:\NMEX_db_12122006.BAK file to the K drive using Windows Explorer.
>
> Please help me determine why I receive "Access is denied" error from
> xp_cmdshell within SQL Query Analyzer. But I am able to complete this task
> with windows explorer by mapping the server and drive and copying the file
> with windows explorer.
>
> Thanks,



Geoff N. Hiten

2006-12-13, 12:13 am

If you are trying to backup across the network you should use UNC names
rather than mapped drives. Here is a KB article on exactly how. The focus
is on the maintenance wizard, but the requirements are the same when using a
command-line backup.

HowTo: Backup to UNC name using Database Maintenance Wizard
http://support.microsoft.com/?kbid=555128

--
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP


"Joe K." <JoeK@discussions.microsoft.com> wrote in message
news:F1E6ABFA-C00A-42EA-A49E- 22B699E8D34F@microso
ft.com...
>
> I am trying to use xp_cmdshell to daily copy a SQL Server database backup
> file from server A to B.
>
> USE Master
> GO
> EXEC 'xp_cmdshell D:\NMEX_db_12122006.BAK \\b\K$'
>
> Output Results: Access is denied
>
> When I map a drive to Server b and drive K, I am able to copy the
> D:\NMEX_db_12122006.BAK file to the K drive using Windows Explorer.
>
> Please help me determine why I receive "Access is denied" error from
> xp_cmdshell within SQL Query Analyzer. But I am able to complete this task
> with windows explorer by mapping the server and drive and copying the file
> with windows explorer.
>
> Thanks,


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com