oracle 用户权限之执行存储过程权限不足

时间:2024-02-25 08:28:33

操作系统版本:

[[email protected] ~]$ uname -a
Linux se31 3.8.13-44.1.1.el6uek.x86_64 #2 SMP Wed Sep 10 06:10:25 PDT 2014 x86_64 x86_64 x86_64 GNU/Linux
[[email protected] ~]$ cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.6 (Santiago)
[[email protected] ~]$ 

数据库版本:

[[email protected] ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Tue Jun 20 10:52:57 2017
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE 11.2.0.4.0 Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production
SQL> 

今天,开发同事使用drgs执行存储过程包报错权限不足,如下图:


报错提示很明显,就是drgs没有执行存储过程的权限,原因估计是最近数据安全取消了drgs用户的dba权限执行revoke dba from drgs导致的;

回收drgs的dba权限后,需要细粒度赋权限:

[[email protected] ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Tue Jun 20 09:59:52 2017
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select username from dba_users where username=\'DRGS\';
USERNAME
------------------------------
DRGS
SQL> grant resource to drgs;

Grant succeeded.

SQL> grant create any procedure to drgs;

Grant succeeded.

SQL> grant execute any procedure to drgs;

Grant succeeded.

SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[[email protected] ~]$ 

细粒度赋权限后,经开发同事测试drgs能够正常执行存储过程了。