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
 SQL Server 2005 Forums
 Service Broker (2005)
 xp_cmdshell from activation procedure

Author  Topic 

alexandru
Starting Member

1 Post

Posted - 2008-12-13 : 06:57:18
I am trying to execute a program as a result of inserting a data to a table. My first idea was to call the program directly from the trigger, but this was too slow and soon the system crashed. Then I discovered the Service Broker technology.
I created queues, messages, etc, and made the trigger send a message to the queue. Then, I created the activation stored procedure on receiving queue, which pops the message and executes the program via xp_cmdshell. The problem here is that the program is not executed, returning the error 15153. I assume it is security problem.
I tried many things, including changing execute as statement in receiving queue definition, creating a user with all possible permissions, adding execute as / revert statement ... but none worked. The stored procedure tells that it is executed as dbo user, and the xp_cmdshell is executed when calling the procedure directy. Please help.

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-12-13 : 07:26:04
security context of the activated sproc is different than if you run it normally.
i know your pain and i really wish the error messages would be more descriptive.
http://rusanu.com/2006/03/01/signing-an-activated-procedure/

___________________________________________________________________________
Causing trouble since 1980
Blog: http://weblogs.sqlteam.com/mladenp
Speed up SSMS development: www.ssmstoolspack.com <- version 1.1 out!
Go to Top of Page
   

- Advertisement -