I want to provide grant-all
(All the schema objects) of one user to another user.
I don't want to the table grant-all. What are the user1 having i.e. table, procedure, triggers, synonyms, functions .. etc that should be accessible by user2 in the same database (Oracle).
Actually I created trigger that will provide the grant all privilege to the user2 if anything newly deploying in the user1. But before creating the trigger rest of the schema objects are not privileged. That's my question
Thanks
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;