From the course: Oracle Database 12c: Security

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Creating, assigning, and dropping roles

Creating, assigning, and dropping roles - Oracle Database Tutorial

From the course: Oracle Database 12c: Security

Start my 1-month free trial

Creating, assigning, and dropping roles

- [Instructor] Let's see some demos of Oracle Database roles in action. We'll start by creating a new role in our Oracle Database. To do that, we'll first have to connect to our orcl pluggable database as the sysdba user. So I'll type sqlplus sys/oracle@orcl as sysdba. And now, let's use the create role command to create our new role. So, I'll type create role and the name for the role, say sales in our example. Once the role has been created, we can assign individual privileges or permissions to the role, such as system privileges. So, I can type grant create session to and specify the role name, sales. We can also grant object privileges, such as selecting data from tables owned by user2. Remember that the user2 is the database user we created in our previous chapter. So I can type grant select on user2.my_data, which is a table in the user2 schema to and the role name. Now, let's see how we can assign this role to a database user. For the purpose of our demo, we will create a new…

Contents