Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

790 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