Revoke oracle public privleges

1. Introduction of Oracle privilege
A privilege is a right to execute an SQL statement or to access another user's object. Privilege mentioned in this bug is related with package objects.

When dealing with functions and procedures, you can grant users the ability to execute these functions and procedures. The Execute privilege is explained below:

  
ExecuteAbility to compile the function/procedure.
Ability to execute the function/procedure directly.
The syntax for granting execute privileges on a function/procedure is:

           grant execute on object to user;

2. What is the default privilege of  UTL_FILE, DBMS_OBFUSCATION_TOOLKIT, DBMS_LOB ?
UTL_FILE, DBMS_OBFUSCATION_TOOLKIT, DBMS_LOB are Oracle installed packages. By default, they are granted to PUBLIC, which means that all users can use them.

3. How to revoke the public privilege?
Use revoke. Take package UTL_FILE for example:
a. Connect to the database as SYS. 
   SQL> connect / AS SYSDBA
b. Revoke execute privileges on the utl_file package from PUBLIC. 
   SQL> revoke execute on utl_file from public;

4. What would be the impact if we revoke the privilege?
Oracle highly recommends keeping DBMS_SQL, DBMS_JOB, DBMS_LOB granted to PUBLIC just to keep user’s database running. Otherwise lots of things break including some of the utilities like Import/Export, Datapump expdp/impdp, SQL*Loader, etc.

If you still want to revoke privileges from PUBLIC make sure that you re-grant privileges to user that require them and recompile possible invalidated objects:
a. Re-grant permissions only to users that require them. 
   Example:
   SQL> grant execute on utl_file to sadmin;
b. Run any suitable tests to ensure that the application runs properly. 
   One way of checking is to see if any objects become invalid after removing the grants:
   select owner, object_name, object_type from dba_objects
   where status <>'VALID' ;
c. Recompile the invalidated objects.

5. Applying a oracle patch may cause the privileges on these packages are reset to public.
Solution: Put all revoke statements that are non-default in a script that can be run again. You may also want to put the grants you need for individual users in this script, then everytime you  apply a patchset, or you do a mayor upgrade, you can run this custom script again to make sure all grants are as you see fit.


6. Reference in oracle support:
 Note:247093.1 Be Cautious When Revoking Privileges Granted to PUBLIC

 Note:390225.1 Execute Privileges Are Reset For Public After Applying Patchset


转载本站文章请注明作者和出处:http://blog.csdn.net/crazy_samba ,请勿用于任何商业用途

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值