[英]Creating a trigger that grants a role to every new created user
I'm having a problem with creating a trigger that grants a role each time I create a new user how can I do it?我在创建每次创建新用户时授予角色的触发器时遇到问题,我该怎么做?
CREATE TRIGGER grant_role_to_user
AFTER insert ON "here I need the right table"
FOR EACH ROW
BEGIN
GRANT role_1 to : NEW.USERNAME
END;
/
I tried the table all_users, dba_users;我尝试了表 all_users、dba_users; but it gives me an error "can't create a trigger on this view"
但它给了我一个错误“无法在此视图上创建触发器”
using oracle 10g使用 oracle 10g
Include GRANT ROLE
into a script you use to create new users, ie将
GRANT ROLE
包含到用于创建新用户的脚本中,即
create user mike identified by lion;
grant role_1 to mike;
I think you dont need trigger
for it.我认为你不需要
trigger
它。
Just assign this role
to public
and every user will have this role assigned.(including user that will be created in the future).只需将此
role
分配给public
,每个用户都会分配此角色。(包括将来创建的用户)。 But be aware about what you are doing.但要注意你在做什么。 You really mean it.
你是认真的。
grant role_1 to public;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.