Search This Blog

Friday, September 7, 2012

REVOKE

Revoke command is used to revoke the privileges from the users to whom we have already granted the privileges.

Syntax:
     Revoke privileges on  from ;  

We can revoke privileges from user either INDIVIDUALLY or SET OF or ALL privileges.

Let’s revoke the privileges that user1 have granted in previous lesson to user2 on EMP table.

Revoke Individual Privileges-

SQL> conn user1/pwd
 
SQL>Revoke select on EMP from user2 
 
-- Revoke succeeded

SET OF privileges:-

SQL>Revoke insert,update,delete on EMP from user2 
 
-- Revoke succeeded

ALL Privileges:-

SQL>Revoke all on EMP from user2;
 
-- Revoke succeeded

Connect to user2 and check the access to the EMP table.

SQL> conn user2/pwd
 
If user2 tries to access the table then system will throw an error.
 
SQL>select * from user1.emp;
 
Ouput:
ORA-01031: insufficient privileges

No comments:

Post a Comment