Multiple choice

Evaluate the following SQL script:

CREATE USER hr IDENTIFIED BY hr01;

CREATE ROLE manager;

CREATE ROLE clerk;

GRANT clerk TO manager;

CREATE ROLE director;

GRANT manager TO director;

GRANT director TO hr

/

How many roles will the HR users have access to?

  1. 0

  2. 1

  3. 2

  4. 3

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

When roles are granted to other roles, access cascades through the role hierarchy. HR is granted DIRECTOR, which is granted MANAGER, which is granted CLERK. Therefore HR has access to all three roles: DIRECTOR (directly), MANAGER (via DIRECTOR), and CLERK (via MANAGER). This hierarchical role granting is a key feature of Oracle's role-based access control.