dbTalk Databases Forums  

Rights Issue Executing DTSRun in Stored Procedure

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Rights Issue Executing DTSRun in Stored Procedure in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Sheldon Penner
 
Posts: n/a

Default Rights Issue Executing DTSRun in Stored Procedure - 07-07-2008 , 04:44 PM






I am working on an Access application which must execute a DTS package.
Since the workstation that will run this application does not have any SQL
Server components installed, I cannot use the DTS objects in my VBA code.
Instead, I am using ADO to execute a stored procedure containing the
following code:


SET NOCOUNT ON
exec master.dbo.xp_cmdshell 'dtsrun -E -Scasvr\busdiv -N"Import_TO_MyDB"'


When run on a workstation where the user is a sysadmin, this code executes
correctly, as does the entire Access application. To enable other users to
execute the xp_cmdshell extended stored procedure, I did the following:

1. Established a sql agent proxy account by running the following code in
Query Analyzer:

use master
go

xp_sqlagent_proxy_account N'SET'
, N'<mydomain>'
, N'<ntuser>'
, N'<ntuser's password>'
go

-- retrieve the proxy account to check that it's correct.
xp_sqlagent_proxy_account N'GET'
go

2. Granted the intended user access to the master database

use master
sp_grantdbaccess 'NewUser'

3. Granted EXEC permission to the intended user to xp_cmdshell

grant exec on xp_cmdshell to NewUser

4. Unchecked the "Only users with SysAdmin privileges can execute CmdExec
and ActiveScripting job steps" checkbox on SQL Server Agent Properties.

The intended new user is now listed as a User of the Master db with exec
rights on xp_cmdshell. Nevertheless, when I test the application on his
workstation, I get the following:

DTSRun: Loading...
DTSRun: Executing...
DTSRun OnStart: DTSStep_DTSExecuteSQLTask_1
DTSRun OnFinish: DTSStep_DTSExecuteSQLTask_1
DTSRun OnStart: DTSStep_DTSDataPumpTask_1
DTSRun OnError: DTSStep_DTSDataPumpTask_1, Error = -2147467259 (80004005)
Error string: Unspecified error
Error source: Microsoft JET Database Engine
Help file:
Help context: 5000000
Error Detail Records:
Error: -2147467259 (80004005); Provider Error: 0 (0)
Error string: Unspecified error
Error source: Microsoft JET Database Engine
Help file:
Help context: 5000000
DTSRun OnFinish: DTSStep_DTSDataPumpTask_1
DTSRun: Package execution complete.

Evidently, xp_cmdshell is able to run and to load dtsrun.exe. The error
occurs during the execution of dtsrun, and it is apparently related to the
issue of user rights because it does not occur when run on my own workstation
or with anybody else who has sysadmin rights.

I would appreciate any advice on what needs to be done to enable use of this
application by a non-sysadmin user.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.