Solved

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

Posted on 2016-07-27
2
78 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.

Join & Write a Comment

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

758 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now