我想将grant-all
一个用户的(所有架构对象)提供给另一个用户。我不想全部授予表。用户 1 拥有哪些表、过程、触发器、同义词、函数等,用户 2 应该可以在同一数据库 (Oracle) 中访问这些内容。实际上,我创建了触发器,如果在 user1 中有任何新部署,它将向 user2 提供所有权限。但是在创建触发器之前,其余的模式对象没有特权。这是我的问题 谢谢
CREATE OR REPLACE PROCEDURE myddl
(p_ddl IN VARCHAR2) IS
BEGIN
EXECUTE IMMEDIATE p_ddl;
END;
/
CREATE OR REPLACE TRIGGER new_obj_grant_prv
AFTER CREATE ON schema
DECLARE
l_jobno NUMBER;
BEGIN
IF ora_dict_obj_type IN ('TABLE','VIEW') THEN
dbms_job.submit(l_jobno,'myddl(''GRANT ALL ON '||ora_dict_obj_owner||'.'||ora_dict_obj_name||' TO user2'');');
END IF;
IF ora_dict_obj_type IN ('SEQUENCE','PACKAGE') THEN
dbms_job.submit(l_jobno,'myddl(''GRANT ALL ON '||ora_dict_obj_owner||'.'||ora_dict_obj_name||' TO user2'');');
END IF;
IF ora_dict_obj_type IN ('TRIGGER','SYNONYMS') THEN
dbms_job.submit(l_jobno,'myddl(''GRANT ALL ON '||ora_dict_obj_owner||'.'||ora_dict_obj_name||' TO user2'');');
END IF;
IF ora_dict_obj_type IN ('PROCEDURE','FUNCTION') THEN
dbms_job.submit(l_jobno,'myddl(''GRANT ALL ON '||ora_dict_obj_owner||'.'||ora_dict_obj_name||' TO user2'');');
END IF;
END;