授予权限时如何解决ORA-04042和ORA-00942错误?
How to resolve ORA-04042 and ORA-00942 errors when granting privileges?
我正在尝试向用户授予 EXECUTE 和 READ 权限。
当我授予执行权限时,我得到:
grant EXECUTE on SYS.KIR_DOKUMENT to ktest2
Error report -
ORA-04042: procedure, function, package, or package body does not exist
04042. 00000 - "procedure, function, package, or package body does not exist"
当我授予读取权限时,我得到:
grant READ on SYS.KIR_DOKUMENT to ktest2
Error report -
ORA-00942: table or view does not exist
00942. 00000 - "table or view does not exist"
*Cause:
但是我检查了 dba_objects
中 table 的状态,它们是有效的。
查询
select owner, object_name, object_type from dba_objects where object_name
给出这个输出:
相同的授权必须给予我数据库中的另一个用户:
如何解决这些错误?
根据你的问题编辑,对象是一个目录;所以你必须包含 DIRECTORY
关键字:
grant READ, EXECUTE on DIRECTORY KIR_DOKUMENT to ktest2;
documentation 说(强调):
The on_object_clause identifies the object on which the privileges are granted. Users, directory objects, editions, data mining models, Java source and resource schema objects, and SQL translation profiles are identified separately because they reside in separate namespaces.)
和
ON DIRECTORY
Specify the name of the directory object on which privileges are to be granted. You cannot qualify directory_name with a schema name.
我正在尝试向用户授予 EXECUTE 和 READ 权限。
当我授予执行权限时,我得到:
grant EXECUTE on SYS.KIR_DOKUMENT to ktest2
Error report -
ORA-04042: procedure, function, package, or package body does not exist
04042. 00000 - "procedure, function, package, or package body does not exist"
当我授予读取权限时,我得到:
grant READ on SYS.KIR_DOKUMENT to ktest2
Error report -
ORA-00942: table or view does not exist
00942. 00000 - "table or view does not exist"
*Cause:
但是我检查了 dba_objects
中 table 的状态,它们是有效的。
查询
select owner, object_name, object_type from dba_objects where object_name
给出这个输出:
相同的授权必须给予我数据库中的另一个用户:
如何解决这些错误?
根据你的问题编辑,对象是一个目录;所以你必须包含 DIRECTORY
关键字:
grant READ, EXECUTE on DIRECTORY KIR_DOKUMENT to ktest2;
documentation 说(强调):
The on_object_clause identifies the object on which the privileges are granted. Users, directory objects, editions, data mining models, Java source and resource schema objects, and SQL translation profiles are identified separately because they reside in separate namespaces.)
和
ON DIRECTORY
Specify the name of the directory object on which privileges are to be granted. You cannot qualify directory_name with a schema name.