Oracle Database Role
Published by : Obay Salah , November 19, 2024
Imagine with me that you are working as a database administrator with more than 1000 users, these users are at different levels of permissions, let's assume that they are at five levels.
What do you do then? Do you give each user his permissions individually? Then you need a long hard work.
The solution is simply in the ROLES.
The idea is that a set of permissions can be combined into one object called ROLE. The previous scenario is for a database administrator who manages a database with more than 1000 users at different levels, which are five simpler levels than you can imagine. We need to create five ROLES, then grant permissions to these ROLES according to the levels and from Then grant it to users.
This solution makes it easier for us to manage permissions. Instead of managing more than 1000 users, we need to manage five ROLES. Also, when modifying any of the ROLES, the modification is automatically reflected on the users.
This makes the modification process easier for us, and this process also improves the tool. Let's assume that we want to create a new ROLE called OBAY, we give this ROLE some permissions, let them be RESOURCE & CONNECT, after that we give this ROLE to the user TEST.
CREATE ROLE OBAY;
It should be noted that the ROLE name must be unique in the database so that the name is not used as a user or a role in the database.
Now we give this ROLE some permissions.
GRANT CONNECT,RESOURCE TO OBAY;
We give this role to the user TEST.
GRANT OBAY TO TEST;
Note: The WITH ADMIN OPTION option can be selected when granting the ROLE, this option allows the user after owning the ROLES to grant it to other users.
The ROLE can be withdrawn from the user in the same way as withdrawing the System Privilege.
Modifications can also be made to the ROLES, let's assume for example that we want to create a password for the ROLE.
ALTER ROLE OBAY IDENTIFIED BY OBAY;
The ROLE can be deleted by command.
DROP ROLE OBAY;
When a role is deleted, the ORACLE SERVER automatically deletes this role from all users who were granted this role.
Comments
no comment yet!