简体   繁体   English

Oracle 12c触发器创建权限不足

[英]Oracle 12c not sufficient privileges on trigger creation

I want to execute code on user IDK : 我想对用户IDK执行代码:

CREATE OR REPLACE TRIGGER sal_trig
  AFTER UPDATE OF status ON TAB1
  FOR EACH ROW
  WHEN (new.status = 'ZAK')
CALL log_sal(1, 5, 8);

I have following grants: 我有以下补助金:

GRANT CREATE PROCEDURE TO IDK;
GRANT CREATE SEQUENCE TO IDK;
GRANT CREATE TABLE TO IDK;
GRANT CREATE TRIGGER TO IDK;
GRANT CREATE TYPE TO IDK;
GRANT UNLIMITED TABLESPACE TO IDK;
GRANT SELECT ON TAB1 TO IDK;

What grants i need more? 我需要什么补助金? I won't get update/delete/insert on TAB1 . 我不会在TAB1上获得更新/删除/插入。 I am getting error: not sufficient privileges . 我收到error: not sufficient privileges

I created procedure from user IDK : 我从用户IDK创建了过程:

CREATE OR REPLACE PROCEDURE log_sal (
  emp_id NUMBER,
  old_sal NUMBER,
  new_sal NUMBER
)
AS LANGUAGE JAVA
NAME 'CaseWatch.logSal(int, float, float)';

According to your comments the TAB1 table created by different User, so the table is in a different schema, this is the main key. 根据您的评论,TAB1表是由不同的用户创建的,因此该表处于不同的架构中,这是主键。 When you want to grant privileges to create a trigger on a table in different schema then you need to use: 当您想授予特权以不同模式在表上创建触发器时,您需要使用:

GRANT CREATE ANY TRIGGER TO IDK;

CREATE TRIGGER => in fact giving permission to create a database trigger in the grantee's schema, in your case if TAB1 created by IDK then this privilege is enough. 实际上, CREATE TRIGGER =>授予在被授予者的模式中创建数据库触发器的权限,在您的情况下,如果IDK创建了TAB1,则此特权就足够了。

Regarding the CREATE ANY TRIGGER here you can find some more interesting info: 关于CREATE ANY TRIGGER ,您可以在此处找到一些更有趣的信息:

  1. https://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_9013.htm https://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_9013.htm
  2. Grant create any trigger vs grant create trigger 授予创建任何触发器与授予创建触发器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM