Can a role be granted roles+privileges in oracle all at the same time

oracleoracle-12cpermissionsrole

I know that you can grant a role:

  • Other roles
  • System privileges
  • Object privileges

But, can you grant to the same role all at once? I mean, for example you grant a role:

  • 2 roles
  • 1 system privilege
  • 1 object privilege

Is this possible?

If so, what is the priority of the grants? Are roles the top priority, or the privileges?

Best Answer

Yes, you can grant as many roles or privileges to a role as you want. The order or priority does not matter because a role or privilege always permit something. Unlike for example Windows file permissions you don't have "allow write" and "forbid write" - where the priority/precedence matters.

Either the role gets a privilege or he does not.

However, you can create ROLES as use the ROLE as marker in PL/SQL at DBMS_SESSION.IS_ROLE_ENABLED(...), there is would be possible to "restrict by granting" and the order and priority could matter. But such design would be quite ugly and is not recommended.