Oracle19c -在表空间下创建角色用户

问题描述 投票:0回答:1

你好,我如何创建角色与

ReadOnly(Select any Tables under the tablespace)

还有

InsertUpdateRoleOnly(To insert and update Data ,not delete)

在我的表空间下,有本地访问权限的用户,如何创建只读角色(选择表空间下的任何表)和只插入更新角色(插入和更新数据,而不是删除)?

oracle oracle11g oracle12c oracle18c oracle19c
1个回答
1
投票

表的所有者是 某人. 所有者授予其他用户或角色权限;在你的情况下,它将是一个角色。由于角色不依赖于 表空间 (你提到的),你会把它创建为简单的。

create role r_read_only;

然后,业主会给予 SELECT 在其表上的特权授予该角色,例如。

grant select on emp  to r_read_only;
grant select on dept to r_read_only;

这样的角色将被授予其他用户,如

grant r_read_only to littlefoot;

和用户 littlefoot 将能够从这些表格中选择。


你的另一个角色也是如此,没有区别。

create role r_upd_ins;
grant insert, update on emp to r_upd_ins;
grant r_upd_ins to bigfoot;

0
投票

权限不能在表空间级别授予。你必须向特定的表授予权限,例如

create role read_data_role;
grant select on [owner].[table_name] to read_data_role;

create role update_data_role;
grant insert, update on [owner].[table_name] to update_data_role;

grant read_data_role, update_data_role to [username];
© www.soinside.com 2019 - 2024. All rights reserved.