开发者

Problem with GRANT in Oracle 10

I have the user admin who has admin privileges and default oracle XE user hr. User admin has created table CAR, role S and has granted to this role SELECT on table CAR. Then admin granted role S to use开发者_JS百科r hr. But when hr tries to select * from admin.car, database gives an error that such table or view doesn't exist. here is code:

create role S;
grant select on admin.car to S;
grant S to hr;

what is the problem?


When a user logs into Oracle, all default roles are enabled, but non-default roles must be enabled with the SET ROLE statement:

SET ROLE S;

Setting a role as DEFAULT Role

A default role means that the role is always enabled for the current session at logon. It also makes it no longer necessary to issue the SET ROLE statement. To set a role as a DEFAULT role, you need to issue the ALTER USER statement:

ALTER USER hr
DEFAULT ROLE S;

Reference:

  • Roles
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜