title: Revoking Oracle Permissions to multiple users at once
body: <p>We're rationalising our database user permissions and to that end we'd like to revoke all select permissions across all tables in a schema granted to all users (but not a specific role).</p>
  <p>With some regular expressions I've tried creating a universal <code>revoke</code> for each table giving something like:</p>
  <blockquote>
  <p>revoke select on TABLE1 from USER1,USER2,USER3...;</p>
  <p>revoke select on TABLE2 from USER1,USER2,USER3...;</p>
  </blockquote>
  <p>However as not all users were granted permissions to all tables, this results in the oracle error:</p>
  <p><code>01927. 00000 -  &quot;cannot REVOKE privileges you did not grant&quot;</code></p>
  <p>Which makes sense but isn't helpful.</p>
  <hr />
  <p>I also tried using <code>All_Tab_Privs</code> to get a list of all tables with the requisite grants to be revoked, and this works, but I can't see how to easily get from this to actually revoking the permissions.</p>
  <p><code>SELECT * From All_Tab_Privs where grantor = 'GRANTING_USER' and grantee != 'READROLE' and grantee != 'PUBLIC' and grantee != 'SYS';</code></p>
  <p>Any suggestions for how to do this without spending hours in a spreadsheet? I'm guessing some PL/SQL? Thanks.</p>