Oracle 角色、权限和自定义类型分布在不同的模式中

Oracle Roles, Privileges, and custom types spread across different schemas

我有一个架构,其中包含我的项目 DEV2 中的绝大多数表。

此外,我有一个包含 DEV2 使用的 oracle 自定义类型的模式:PUBLIC_TYPES。

我希望能够在 DEV2 上创建触发器来访问 PUBLIC_TYPES 中的角色,但更愿意使用角色来执行此操作,这样当我创建 DEV3(DEV2 的克隆)时,我可以在编译触发器之前将角色授予 DEV3。

目前,如果我执行以下操作:

grant all on public_types.type_name to DEV2;

然后(在 DEV2 用户上)我输入:

desc public_types.type_name;

我得到了类型的正确描述。

但是,如果我改为执行以下操作:

create role TABLE_PRIVS;
grant all on public_types.type_name_2 to TABLE_PRIVS;
grant table_privs to DEV2;

(然后切换到我的DEV2用户,然后desc)

desc public_types.type_name_2

我明白了

ORA-04043: object public_types.type_name_2 does not exist

我错过了什么?我已将特权授予角色,并将角色授予用户。这对类型有不同的影响吗?

提前致谢!

尝试将角色添加为默认用户

grant table_privs to DEV2;
ALTER USER DEV2 DEFAULT ROLE table_privs;

否则你需要使用SET ROLE