向 new_user 授予角色在 12C 中不起作用
Grant role to new_user is not working in 12C
DBA_USER: create role test_2
DBA_user: grant create session, create any table, create any procedure to test_2;
grant succeeded.....
grant test_2 to new_user
现在new_user:
create table items (item_number number(3) primary key,
item_name varchar2(40),
item_desp varchar2(20),
item_qty number(3));
Error: you have insufficient privilege
准确的 Oracle 错误代码会有所帮助,但首先猜测 new_user
对 SYSTEM
(或其他 tablespace
)没有权限。一般不建议使用SYSTEM tablespace,所以我们先创建tablespace。
为用户创建单独的table空间:
create tablespace tbs_for_new_user
datafile 'tbs_nu.dbf' size 50m;
然后将新建的table空间默认分配给用户
alter user "NEW_USER"
default tablespace "TBS_FOR_NEW_USER"
temporaty tablespace "TEMP"
account unlock; // if you did not unlock new_user account yet
alter user "NEW_USER" quota 50000m on TBS_FOR_NEW_USER;
alter user "NEW_USER" DEFAULT ROLE "TEST_2";
然后尝试创建table。
DBA_USER: create role test_2
DBA_user: grant create session, create any table, create any procedure to test_2;
grant succeeded.....
grant test_2 to new_user
现在new_user:
create table items (item_number number(3) primary key,
item_name varchar2(40),
item_desp varchar2(20),
item_qty number(3));
Error: you have insufficient privilege
准确的 Oracle 错误代码会有所帮助,但首先猜测 new_user
对 SYSTEM
(或其他 tablespace
)没有权限。一般不建议使用SYSTEM tablespace,所以我们先创建tablespace。
为用户创建单独的table空间:
create tablespace tbs_for_new_user
datafile 'tbs_nu.dbf' size 50m;
然后将新建的table空间默认分配给用户
alter user "NEW_USER"
default tablespace "TBS_FOR_NEW_USER"
temporaty tablespace "TEMP"
account unlock; // if you did not unlock new_user account yet
alter user "NEW_USER" quota 50000m on TBS_FOR_NEW_USER;
alter user "NEW_USER" DEFAULT ROLE "TEST_2";
然后尝试创建table。