Oracle
如何解決 ORA-04042:過程、函式、包或包主體不存在以及 ORA-00942:表或視圖不存在
我正在嘗試將兩個表的 EXECUTE 和 READ 權限授予使用者 ktest1。
grant EXECUTE on SYS.KIR_DOKUMENT to ktest2; grant READ on SYS.KIR_DOKUMENT to ktest2;
當我執行授權時,我得到以下錯誤
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 中表的狀態,它們是有效的。
友善的建議。
這不是您授予目錄權限的方式。
SQL> create or replace directory KIR_DOKUMENT as '/tmp'; Directory created. SQL> select owner, object_type, status from dba_objects where object_name = 'KIR_DOKUMENT'; OWNER -------------------------------------------------------------------------------- OBJECT_TYPE STATUS ----------------------- ------- SYS DIRECTORY VALID SQL> grant read on SYS.KIR_DOKUMENT to bp; grant read on SYS.KIR_DOKUMENT to bp * ERROR at line 1: ORA-00942: table or view does not exist SQL> grant execute on SYS.KIR_DOKUMENT to bp; grant execute on SYS.KIR_DOKUMENT to bp * ERROR at line 1: ORA-04042: procedure, function, package, or package body does not exist
使用
GRANT privilege ON DIRECTORY ...
as:SQL> grant read on directory SYS.KIR_DOKUMENT to bp; Grant succeeded. SQL> grant execute on directory SYS.KIR_DOKUMENT to bp; Grant succeeded. SQL>