About Granting Application Privileges to Principals

This section contains the following topics:

About Granting an Application Role to an Application User

This section contains the following topics:

Creating a New Application User and Granting This User an Application Role

Example: Creating a New Application User and Granting This User an Application Role shows how to grant an application role, appl1_regular_role, to an application user, lwuser1, when the application user account is created.

To find a listing of existing application roles, query the DBA_XS_ROLES data dictionary view.

Example: Creating a New Application User and Granting This User an Application Role

sqlplus sec_mgr
Enter password: password
Connected.
BEGIN
  SYS.XS_PRINCIPAL.CREATE_USER('lwuser1');
  SYS.XS_PRINCIPAL.GRANT_ROLES('lwuser1', 'appl1_regular_role');
END;
/

Granting an Application Role to an Existing Application User

Example: Granting an Application Role to an Existing Application User shows how to grant an application role, appl1_regular_role, to an existing application user, lwuser1. You cannot grant dynamic application roles to an existing application user.

You can find a listing of existing application user accounts by querying the DBA_XS_USERS view.

Example: Granting an Application Role to an Existing Application User

sqlplus sec_mgr
Enter password: password
Connected.
BEGIN
  SYS.XS_PRINCIPAL.GRANT_ROLES('lwuser1', 'appl1_regular_role');
END;
/

Granting an Application Role to Another Application Role

Example: Granting a Regular Application Role to Another Regular Application Role shows how to grant a regular application role to another regular application role. You cannot grant dynamic application roles to other regular application roles, but you can grant other regular application roles to dynamic application roles. To find a listing of existing application roles, query the DBA_XS_ROLES view (see “DBA_XS_ROLES”).

Example: Granting a Regular Application Role to Another Regular Application Role

sqlplus sec_mgr
Enter password: password
Connected.
BEGIN
  SYS.XS_PRINCIPAL.GRANT_ROLES(grantee => 'app_regular_role', role => 'appl1_regular_role');
END;
/

Granting a Database Role to an Application Role

To grant a database role to an application role, use the SQL GRANT statement. You can find a listing of existing database roles by querying the DBA_ROLES data dictionary view.

Example: Granting a Database Role to an Application Role shows how to grant the database role, cust_role, to the application role app_regular_role.

Example: Granting a Database Role to an Application Role

sqlplus sec_mgr
Enter password: password
Connected.
GRANT cust_role TO app_regular_role;