简体   繁体   English

xp_cmdshell代理未执行

[英]xp_cmdshell Proxy not Executing

I created a Proxy account with Sysadmin access. 我创建了具有Sysadmin访问权限的代理帐户。 Users use this to execute a bcp command of their choosing. 用户使用它来执行自己选择的bcp命令。

However when the users want's to execute the proc they get: EXECUTE permission was denied on the object 'xp_cmdshell', database 'mssqlsystemresource', schema 'sys' 但是,当用户希望执行proc时,他们得到: 对对象'xp_cmdshell',数据库'mssqlsystemresource',架构'sys'的EXECUTE权限被拒绝

Here is my Proc: 这是我的程序:

CREATE PROCEDURE spCMDProxy 

( 
@SQLSTATEMENT VARCHAR(1000), 
@FILENAME VARCHAR(1000) 

) 
WITH ENCRYPTION 
AS 
BEGIN 
DECLARE @PrepStatement VARCHAR(1000) 
SET @PrepStatement = 'bcp ' + '"'+ @SQLSTATEMENT + '" queryout C:\SamsungEDI\' + @FILENAME + ' -U************ -P************ -c -t"||" -S UECZAERP01' 
EXEC xp_cmdshell @PrepStatement 
END 

My Proxy account is a local Sysadmin account. 我的代理帐户是本地Sysadmin帐户。

I found the problem, Could not execute due to the fact that the user cannot execute on xp_cmdshell: 我发现了问题,由于用户无法在xp_cmdshell上执行而无法执行:

USE master
GRANT EXECUTE on xp_cmdshell to [mydomain\myAccount]

Also found this Article 还发现了这篇文章

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM