[英]Why does this stored procedure execute when an user does ALTER USER .... DISABLE?
A specific user - Main_user
(with a default database of db_A
) executes特定用户 -
Main_user
(默认数据库为db_A
)执行
USE db_A
ALTER USER another_user DISABLE;
Every time it tries to do so, an error message is shown:每次尝试这样做时,都会显示一条错误消息:
Msg 916, Level 14, State 2, Server ****, Procedure *****sysadmin, Line 32
消息 916,级别 14,状态 2,服务器 ****,过程 ***** sysadmin,第 32 行
The server principal Main_user is not able to access the database db_ZZZ under the current security context.服务器主体 Main_user 在当前安全上下文下无法访问数据库 db_ZZZ。
As you can see, it seems that the procedure tries to execute code that involves db_ZZZ
, which apparently has nothing to do with the ALTER USER
statement.如您所见,该过程似乎试图执行涉及
db_ZZZ
的代码,这显然与ALTER USER
语句无关。
The thing is that I cannot find the procedure ******sysadmin
anywhere (not a trigger, nothing).问题是我在任何地方都找不到程序
******sysadmin
(不是触发器,什么都没有)。 And I can't understand what is the business of it in all this situation.我不明白在这种情况下它有什么用。
What explanations could be plausible?什么解释可能是合理的?
I don't know if it could be useful to mention that Main_user
is a service user of Wherescape RED.我不知道提及
Main_user
是 Wherescape RED 的服务用户是否有用。 I cannot test this code with any other user because I don't have any other with permission to do so.我无法与任何其他用户一起测试此代码,因为我没有任何其他人有权这样做。
It sounds like you have a DDL trigger enabled on your server.听起来您的服务器上启用了 DDL 触发器。 To see if that's the case, look in the
sys.server_triggers
system view or, in SSMS, look under Server Objects → Triggers.要查看是否是这种情况,请查看
sys.server_triggers
系统视图,或者在 SSMS 中查看服务器对象 → 触发器。 From there, you should be able to see what the trigger's definition is and make a decision as to whether you want to keep it (with modifications so that it actually works) or drop it altogether.从那里,您应该能够看到触发器的定义是什么,并决定是要保留它(进行修改以使其真正起作用)还是完全放弃它。
Like Larnu said.就像拉努说的。 You can find the trigger using this query:
您可以使用此查询找到触发器:
SELECT *
FROM sys.triggers AS t
JOIN sys.all_sql_modules AS asm ON asm.object_id = t.object_id
WHERE asm.definition LIKE '%*****sysadmin%';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.