Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

What is "ALTER USER <username> DEFAULT ROLE ALL;" command for ?

Peter77Jul 5 2023

DB version: 19.11

As I understand "ALTER USER <username> DEFAULT ROLE ALL;" command is enable all granted roles for user to be active when it logs in.

But, as you can see below, I grant TEST_ROLE2 role to gypsy user. And without executing "ALTER USER gypsy DEFAULT ROLE ALL;" command, TEST_ROLE2 role is active for GYPSY user when gypsy logs in.

Is "ALTER USER <username> DEFAULT ROLE ALL;" not relevant for 19c or am I missing something here ?

SQL> alter session set container = PDB_SALES;
Session altered.

SQL> create role TEST_ROLE2;
Role created.

SQL> grant select any table to TEST_ROLE2;
Grant succeeded.

SQL> create user gypsy identified by Sec#vac835 ;
User created.

SQL> GRANT CREATE SESSION TO gypsy;
Grant succeeded.

SQL> grant TEST_ROLE2 to gypsy;
Grant succeeded.

SQL> conn gypsy/Sec#vac835@PDB_SALES
Connected.

SQL> select * from session_roles;
ROLE
--------------------------------------
TEST_ROLE2

SQL> select * from SCOTTY.EMP_ACCESS;

EMPLOYEE_NAME             FLOOR_ACCESS
------------------------- -------------------------
STANDARD                  FLOOR 0
STANDARD                  FLOOR 1
STANDARD                  FLOOR 2
STANDARD                  FLOOR 3
STANDARD                  FLOOR 4
JOHN                      FLOOR 0
JOHN                      FLOOR 1
JOHN                      FLOOR 2
JOHN                      FLOOR 3
STANDARD                  FLOOR 5

10 rows selected.
This post has been answered by Mike Kutz on Jul 5 2023
Jump to Answer
Comments
Post Details
Added on Jul 5 2023
2 comments
11,737 views