{"id":2615,"date":"2013-04-13T10:13:02","date_gmt":"2013-04-13T10:13:02","guid":{"rendered":"http:\/\/enjoyasp.net\/?p=2615"},"modified":"2013-04-13T10:13:02","modified_gmt":"2013-04-13T10:13:02","slug":"ssb%ef%bc%9aactivation-execution-context","status":"publish","type":"post","link":"https:\/\/enjoyasp.net\/index.php\/2013\/04\/13\/ssb%ef%bc%9aactivation-execution-context\/","title":{"rendered":"SSB\uff1aActivation Execution Context"},"content":{"rendered":"<pre class=\"brush:sql;first-line:1;pad-line-numbers:true;highlight:null;collapse:false;\">\r\nException Message:\r\nThe activated proc [dbo].[storedprocedure_name] running on queue [QUEUE_NAME] output the following:  &#39;The server principal &quot;sa&quot; is not able to access the database &quot;AnotherDBName&quot; under the current security context.&#39;\r\n \r\nSOLUTION:\r\nThe problem is that the activation execution context is trusted only in the database, not in the whole server, like other stored procedures or DB. So when the activated SP calls another SP located in the other DB, the above exception will occur.\r\n \r\nThe simplest solution is to mark the database [SERVICE PROGRAM RUNNING ON IT] as trustworthy.\r\nALTER DATABASE [DBNAME] SET TRUSTWORTHY ON\r\n\r\n\u5f15\u81ea\uff1a<a href=\"http:\/\/www.cnblogs.com\/guanjie20\/archive\/2011\/08\/31\/2160959.html\">\u3010SSB\u3011Activation Execution Contex<\/a>t\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Exception Message: The activated proc [dbo].[storedproc [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[],"class_list":["post-2615","post","type-post","status-publish","format-standard","hentry","category-sql-server"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts\/2615","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/comments?post=2615"}],"version-history":[{"count":0,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts\/2615\/revisions"}],"wp:attachment":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/media?parent=2615"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/categories?post=2615"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/tags?post=2615"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}