Privilege delegation resolves the issue of centralized authorization. By specifying WITH ADMIN OPTION or WITH GRANT OPTION during authorization, users can be granted the permission to delegate corresponding privileges to other users. When revoking object privileges, the corresponding privileges that the user has delegated to other users will also be revoked. For example, if user A grants privilege to user B and user B grants privilege to user C, when user A revokes privilege from user B, privilege of user C will also be revoked. Revoking system privileges does not revoke delegated privileges.
Examples
Log in to an Oracle tenant of a cluster as the
SYSuser. Create users A, B, and C, and grant all the users theCREATE SESSIONprivilege, and grant user A theGRANT ANY PRIVILEGEprivilege.obclient > CREATE USER A IDENTIFIED BY ******; obclient > CREATE USER B IDENTIFIED BY ******; obclient > CREATE USER C IDENTIFIED BY ******; obclient > GRANT CREATE SESSION TO A; obclient > GRANT CREATE SESSION TO B; obclient > GRANT CREATE SESSION TO C; obclient > GRANT GRANT ANY PRIVILEGE TO A;Create a table named
testunder theSYSuser.obclient > CREATE TABLE test (id number(10),name varchar2(10)); Query OK, 0 rows affected (0.050 sec)Grant user A the privilege to query the
testtable of theSYSuser.obclient > GRANT SELECT ON sys.test TO A;Log in as user A and grant user B the privilege to query the
testtable using theWITH GRANT OPTIONcause, so that user B can grant the same privilege to other users.obclient > GRANT SELECT ON sys.test TO B with grant option;Switch to user B and query the
testtable.obclient > SELECT * FROM sys.testLog in as user B and grant user C the privilege to query the
testtable.obclient > GRANT SELECT ON sys.test TO C;If you grant the privilege to user B without using the
WITH GRANT OPTIONclause, the following error message will be returned when user B attempts to grant the same privilege to user C:obclient > GRANT SELECT on sys.test TO C ; OBE-01031: insufficient privileges ```01031: insufficient privilegesSwitch to user C and query the
testtable.obclient > SELECT * FROM sys.test;Privilege delegation is successful if querying the
testtable is possible.