Revoking user privileges and roles - Oracle DBA

REVOKE

Use to revoke privileges already granted to other users.

For example to revoke select, update, insert privilege you have granted to Sami then give the following statement.

revoke select, update, insert on emp from sami;

To revoke select statement on emp granted to public give the following command.

revoke select on emp from public;

To revoke update privilege on ename column and insert privilege on empno and ename columns give the following revoke statement.

revoke update, insert on emp from sami;

Note :You cannot take back column level privileges. Suppose you just want to take back  insert privilege on ename column, then you have to first take back the whole insert privilege and then grant privilege on empno column.

This section describes aspects of revoking user privileges and roles, and includes the following topics:

Want To Get DBA Training From Experts? Enroll Now For Free Demo On Oracle DBA Training.

Revoking system privileges and roles:

You can revoke system privileges and/or roles using either the revoke system privileges/roles dialog box of enterprise manager or the sql command revoke.

Any user with the admin option for a system privilege or role can revoke the privilege or role from any other DATABASE user or role the grantor does not have to be the user that originally granted the privilege or role. Also, users with the grant any role can revoke any role.

The following statement revokes the create table SYSTEM PRIVILEGE and the accts_rec role from tsmith:

Sql>revoke create table, accts_rec from tsmith;

Revoking object privileges and roles:

You can revoke object privileges using enterprise manager or the sql command revoke.

To revoke an object privilege, the revoker must be the original grantor of the object privilege being revoked.

For example, assuming you are the original grantor, to revoke the select and insert privileges on the emp table from the users jfee and tsmith, you would issue the following statement:

Sql>revoke select, insert on emp  from jfee, tsmith;

The following statement revokes all privileges (which were originally granted to the role human_resource) from the table dept:

Sql>revoke all on dept from human_resources;

Checkout Oracle DBA Interview Questions

Revoking column selective object privileges:

Although users can grant column selective insert, update, and references privileges for tables and views, they cannot selectively revoke column specific privileges with a similar revoke statement. Instead, the grantor must first revoke the object privilege for all columns of a table or view, and then selectively re-grant the column specific privileges that should remain.

 MindMajix YouTube Channel

For example, assume that role human_resources has been granted the update privilege on the deptno and dname columns of the table dept. To revoke the update privilege on just the deptno column, you would issue the following two statements:

Sql>revoke update on dept from human_resources;
Sql>grant update (dname) on dept to human_resources;

The revoke statement revokes update privilege on all columns of the dept table from the role human_resources. The grant statement re-grants update privilege on the dname column to the role human_resources.

Explore Oracle DBA Sample Resumes! Download & Edit, Get Noticed by Top Employers!Download Now!

 

Job Support Program

Online Work Support for your on-job roles.

jobservice

Our work-support plans provide precise options as per your project tasks. Whether you are a newbie or an experienced professional seeking assistance in completing project tasks, we are here with the following plans to meet your custom needs:

  • Pay Per Hour
  • Pay Per Week
  • Monthly
Learn MoreGet Job Support
Course Schedule
NameDates
Oracle DBA TrainingNov 19 to Dec 04View Details
Oracle DBA TrainingNov 23 to Dec 08View Details
Oracle DBA TrainingNov 26 to Dec 11View Details
Oracle DBA TrainingNov 30 to Dec 15View Details
Last updated: 28 Sep 2024
About Author

 

Technical Content Writer

read less