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 Programming
 xp_cmdshell

Author  Topic 

stumbling
Posting Yak Master

104 Posts

Posted - 2008-09-06 : 18:54:37
Hi ALL
I am trying to run the following command that i know works in DOS but when i run it in SQL 2000 it gives access denied errors and i can not figure out why? Any ideas would be greatly appreciated.
Cheers


xp_cmdshell 'copy /Y \\server1\D$\MSSQL\BACKUP\POSBACKUP\*.Bak \\server2\SQL_Backups\Full\folder'

The error i get is
-----------------------------------------------------------------------
\\server1\D$\MSSQL\BACKUP\POSBACKUP\CE90_db_200809070841.BAK
Access is denied.
0 file(s) copied.
NULL

(4 row(s) affected)

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-09-06 : 19:51:45
The SQL Server service account doesn't have access to that location. D$ is an admin share, which requires very elevated permissions. Does the SQL Server service account have local admin permissions on server1?

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

Subscribe to my blog
Go to Top of Page

stumbling
Posting Yak Master

104 Posts

Posted - 2008-09-07 : 18:21:15
Thanks Tara

I checked the details and even tried moving the file and getting ti to work from c: and also a full share on d: and c: but straight away it gets access denied almost like the sql account does not have access to run the cmd.
The service account is running under a local system account and not an sa account.
cheers
Phil
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-09-07 : 21:54:59
Well the service account can't run under the sa account or any SQL account. It also can't run under the local system account if you want it to connect to remote resources. So use a domain account that has local admin privileges on these servers.

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

Subscribe to my blog
Go to Top of Page
   

- Advertisement -