Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 E-mail Us
 Oracle Articles
New Oracle Articles

 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog

 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Oracle Support

 SQL Tuning

 Oracle UNIX
 Oracle Linux
 Remote s
 Remote plans
 Application Server

 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S


 Consulting Staff
 Consulting Prices
 Help Wanted!


 Oracle Posters
 Oracle Books

 Oracle Scripts

Don Burleson Blog 









Oracle Concepts - Use Of Roles

Oracle Tips by Burleson Consulting

Use Of Roles

Using roles has several benefits, including:

* Reducing the number of grants and thereby making it easier to manage security.

* Dynamically changing the privileges for many users with a single grant or revoke.

* Selectively enabling or disabling depending on the application.

Roles can be used for most system and object privileges. Privileges granted through a role cannot be used for creating an object (views, packages, procedures, and functions). You need to grant privileges directly to the user for this.

Creating Roles

You need to create the role first and then grant system and object privileges to that role. When you create the role, there are three password options available:

* No authentication

* Operating system authentication

* Password authentication

You can set operating system authentication either when the role is created or by using the database initialization parameters OS_ROLES=TRUE and REMOTE_OS_ROLES=TRUE. If you are using the multithreaded server option, you cannot use operating system authentication for roles.

To create a role, you must have the CREATE ROLE system privilege. You can create roles with Server Manager or at the command line in SQL*Plus. The command syntax for creating a role is seen in Listing 39.

Listing 39: Syntax for creating a role.

A role can also be identified globally by using the GLOBALLY keyword in the IDENTIFIED clause. This means the role will be authenticated by the Oracle Security Server.

Here is an example:

CREATE  ROLE   appusers

To alter a role, you must have the ALTER ANY ROLE system privilege or have been granted the role with the WITH ADMIN OPTION. The creator of any role automatically has the WITH ADMIN OPTION for that role.

Grants To Roles

To grant a role to a user, you must either be the creator of that role or have the GRANT ANY ROLE privilege. You can grant roles to users with Server Manager or at the command line in SQL*Plus. Grants to roles will not take effect for a user if that user is currently logged into the database with that role. When the user exits or sets another role, the changes will take effect. Once roles have been granted to a user, they can be enabled and disabled.

Here is an example:

GRANT  enduser
TO  patrick ;

Here is an example for a role:

GRANT  create  session
TO   enduser;

Here is an example of granting an object privilege to a role:

GRANT  select
ON  john.emp
TO  enduser;

The only system privilege which cannot be granted to a role is the UNLIMITED TABLESPACE grant, however, it is implicitly granted whenever the DBA or RESOURCE role grant is made to a user. Grants on objects can be passed to other users or to roles if the grantee has been given the WITH GRANT OPTION. However, you cannot assign a privilege that includes the WITH GRANT OPTION to a role. The INDEX and REFERENCES privileges cannot be granted to a role; they must be granted only to a user. You can grant that role to a user or to another role. However, you cannot grant a role to itself.

You can look at the data dictionary tables shown in Table 21 for information on views for roles.







Name of the role


Yes, No, Global or External for operating system authentication





Name of the user or role receiving the grant


Name of the role


Y if it was granted with the admin option


Y if this is the grantee?s default role





Name of the role receiving the role grant


Name of the role granted the role


Indicates the role was granted with the admin option





Name of the role receiving the system privilege


System privilege being granted


Indicates the grant was with the admin option

Table 21:  Data dictionary views for roles.


This is an excerpt from the eBook "Oracle DBA made Simple".

For more details on Oracle database administration, see the "Easy Oracle Jumpstart" by Robert Freeman and Steve Karam.  It?s only $19.95 when you buy it directly from the publisher here.

Related Oracle Role Articles:

Oracle Roles
General Oracle Security
Monitoring User Roles


Oracle Training at Sea
oracle dba poster

Follow us on Twitter 
Oracle performance tuning software 
Oracle Linux poster


Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


Copyright © 1996 -  2017

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

Remote Emergency Support provided by Conversational