How Oracle role enables number limits

Source: Internet
Author: User

Oracle allows up to 148 enabled when user roles are enabled.

In fact, this limit is strange, because 148 and 2 of the power difference is large, do not know what the reason for Oracle to determine this value:

Sql> CREATE USER U_role identified by U_password;

User has created.

sql> GRANT CREATE role to U_role;

The authorization was successful.

Sql> GRANT CREATE session to U_role;

The authorization was successful.

Sql> CONN U_role/u_password

is connected.

Sql> BEGIN

2 for I in 1..148 LOOP

3 EXECUTE IMMEDIATE ' CREATE role r_ ' | | I;

4 End LOOP;

5 end;

6/

The PL/SQL process has completed successfully.

Sql> SELECT * from Session_roles;

No rows selected

Sql> CONN U_role/u_password

is connected.

Sql> SELECT COUNT (*) from Session_roles;

COUNT (*)

----------

148

sql> CREATE role r_149;

The role has been created.

Sql>connu_role/u_password

ERROR:

Ora-28031:maximum of 148 enabled roles exceeded

Warning: You are no longer connected to Oracle.

This column more highlights: http://www.bianceng.cn/database/Oracle/

Because the role is enabled when the session is logged on, the record is not queried from the session_roles after 148 roles have been created. The 149th character was created, and Oracle made an error when landing again.

Sql> Conn/as SYSDBA

is connected.

sql> DROP role r_149;

The role has been deleted.

Sql> CONN U_role/u_password

is connected.

sql> CREATE role r_149;

The role has been created.

sql> SET role All;

SET role All

*

Line 1th Error:

ORA-28031: exceeds the maximum number of enabled roles 148

Note that the total number of authorized roles limits includes the number of roles that are directly authorized and those that are authorized to the role:

sql> DROP role r_149;

The role has been deleted.

sql> DROP role r_148;

The role has been deleted.

Sql> Conn/as SYSDBA

is connected.

sql> CREATE role r_148;

The role has been created.

Sql> GRANT r_148 to U_role;

The authorization was successful.

Sql> CONN U_role/u_password

is connected.

Sql> Conn/as SYSDBA

is connected.

sql> CREATE role r_149;

The role has been created.

Sql> GRANT r_149 to r_148;

The authorization was successful.

Sql>connu_role/u_password

ERROR:

Ora-28031:maximum of 148 enabled roles exceeded

Warning: You are no longer connected to Oracle.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.