This topic describes how to revoke privileges from a user.
Prerequisites
When you revoke an object privilege, you must have the privilege to be revoked. For example, for the
test1user to revoke theSELECTprivilege on thet1table from thetest2user, thetest1user must have theSELECTprivilege on thet1table. In addition, you must have theGRANT OPTIONorGRANT ANY OBJECT PRIVILEGEprivilege.When you revoke a system privilege or a role, you must have the privilege or role to be revoked and have the
GRANT OPTION,GRANT ANY PRIVILEGE, orGRANT ANY ROLEprivilege.To revoke the
ALL PRIVILEGESandGRANT OPTIONprivileges, you must have the globalGRANT OPTIONprivilege or theUPDATEandDELETEprivileges on the table.
For information about how to view your privileges, see View user privileges. If you do not have the required privileges, contact the administrator to obtain the privileges.
Considerations
When you revoke multiple privileges from a user, the privileges must be separated with commas (,).
When you revoke privileges from multiple users, the usernames must be separated with commas (,).
If
GRANT OPTIONis not specified when you grant privileges to a user, privilege revocation does not extend to dependent users. For example, if thetest1user has granted some privileges to thetest2user, when the privileges of thetest1user are revoked, the privileges granted to thetest2user will not be revoked.
Examples
Revoke system privileges
Revoke the
CREATE SEQUENCEprivilege of thetestuser.obclient> REVOKE CREATE SEQUENCE FROM test;Revoke object privileges
Revoke the
SELECTandUPDATEprivileges on theemp_viewview from thetestuser.obclient> REVOKE ALL PRIVILEGES FROM user_name;
For more information about the REVOKE statement, see REVOKE.