Solved

Request assistance granting user permission to execute a sys function from within a package

Posted on 2016-07-27
2
122 Views
Last Modified: 2016-07-27
I'm trying to grant a user execute permissions to SYS.DBMS_UTILITY.GET_PARAMETER_VALUE so I do not need to grant select on the V$ views.

I can grant it on the package DBMS_UTILITY but not the specific function GET_PARAMETER_VALUE:

SQL> grant execute on SYS.DBMS_UTILITY to TEST;

Grant succeeded.

SQL> grant execute on SYS.DBMS_UTILITY.GET_PARAMETER_VALUE to TEST;
grant execute on SYS.DBMS_UTILITY.GET_PARAMETER_VALUE to TEST
                                 *
ERROR at line 1:
ORA-00905: missing keyword

--Attempt at running function logged on as Test user:
SQL> conn Test/test
Connected.
SQL>
SQL> DECLARE
  2    parnam VARCHAR2(256);
  3    intval BINARY_INTEGER;
  4    strval VARCHAR2(256);
  5    partyp BINARY_INTEGER;
  6  BEGIN
  7    partyp := dbms_utility.get_parameter_value('open_cursors',
  8                                                intval, strval);
  9    dbms_output.put('parameter value is: ');
 10    IF partyp = 1 THEN
 11      dbms_output.put_line(strval);
 12    ELSE
 13      dbms_output.put_line(intval);
 14    END IF;
 15    IF partyp = 1 THEN
 16      dbms_output.put('parameter value length is: ');
 17      dbms_output.put_line(intval);
 18    END IF;
 19    dbms_output.put('parameter type is: ');
 20    IF partyp = 1 THEN
 21      dbms_output.put_line('string');
 22    ELSE
 23      dbms_output.put_line('integer');
 24    END IF;
 25  END;
 26  /
DECLARE
*
ERROR at line 1:
ORA-01031: insufficient privileges
ORA-06512: at "SYS.DBMS_UTILITY", line 140
ORA-06512: at line 7

Open in new window


I'm using Oracle 12c and this is in a pluggable database.

Thanks
0
Comment
Question by:Focker513
2 Comments
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 41731890
It would appear that you still need to grant select on the V$_PARAMETER view to allow GET_PARMATER_VALUE to do what it does.

http://blog.dbi-services.com/12c-privilege-analysis-rocks/

You might need to create a wrapper procedure/view to restrict specific parameters and grant select/execute on that to the TEST user.
0
 

Author Closing Comment

by:Focker513
ID: 41731956
Okay thanks for the info
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question