← Security
Oracle · Security

How to revoke a system privilege from a user or role in Oracle

Revoke a system privilege from a user or role, after checking the current grant, then verify it is gone.

Tested on11g12c18c19c21c23ai26ai

Revoke a system privilege from a user or role.

This removes access and can break an application that depends on it. Confirm the grantee no longer needs the privilege first.

-- Check the current grant (read-only)
SELECT grantee, privilege, admin_option
FROM   dba_sys_privs
WHERE  grantee = UPPER('&&grantee')
ORDER  BY privilege;

REVOKE &&privilege FROM &grantee;

-- Verify (read-only): should return no rows
SELECT privilege
FROM   dba_sys_privs
WHERE  grantee = UPPER('&grantee')
  AND  privilege = UPPER('&privilege');
SecurityPrivilegesREVOKE