In this tutorial, We will learn how can we create the Roles in Oracle.
Administration of large numbers of objects can be difficult. Oracle roles allow you to localize the administration of objects. Oracle roles are most helpful when large numbers of users will need the same system and object privileges.
We need DBA access to create the Role in Oracle DB. Once the Oracle role is all setup, you only need grant the Oracle role to users and all the privileges will be transferred along with that grant. Later, you can add additional privileges to the role if required.
Create Roles in ORACLE DB
You create a role with the CREATE ROLE command and then grant the role to the user with the grant command as seen in this command .
SQL> Create role select_role;
SQL> Grant select on emp to select_role;
SQL> Grant select on dept to select_role;
SQL> Grant select on location to select_role;
Now we will see how can we grant a ROLE to a USER.
SQL > Grant Select_role to System;
REVOKE Access from Roles
If you wish to revoke an Oracle role from a user, simply use the revoke command as demonstrated earlier in this chapter:
SQL> REVOKE select_role FROM HR;
Products from Amazon.in
Price: Check on Amazon
Price: INR 29,950.00
Price: INR 15,490.00