Thursday, 9 August 2012

What is a Role in ORACLE?How to Create and Grant Privileges to a Role

What is a Role?
A role is a named group of related privileges that can be granted to the user. This method makes it easier to revoke and maintain privileges.
A user can have access to several roles, and several users can be assigned the same role. Roles are typically created for a database application.
Creating and Assigning a Role
First, the DBA must create the role. Then the DBA can assign privileges to the role and users to the role.
CREATE ROLE role_name;
In the syntax:
Role_name is the name of the role to be created
Now that the role is created, the DBA can use the GRANT statement to assign users to the role as well as assign privileges to the role.
 Creating and Granting Privileges to a Role:
 Create a role
CREATE ROLE manager;
Role created.
Grant privileges to a role
GRANT create table ,create view  TO manager;
Grant succeeded
Grant a role to users
GRANT manager to AJAY,RAHUL;
Grant succeeded

Note: The following four points about roles:
1.  Are named groups of related privileges
2.  Can be granted to users
3.  Simplify the process of granting and revoking privileges
4. Are created by a DBA

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...