Granting of privileges through role does not not for PL/SQL

Version: 11.2.0.2


In our shop, we don't grant privileges directly to a user, give us it to a role, and grant this role to user scheduled grantee.

Granting of privileges through a role seems to be fine with the SQL engine. But it does not PL/SQL engine.

In the example below, the GLS_DEV user is granted access SELECT on SCOTT.pets table through a role called tstrole. GLS_DEV can select the SQL table. But does not seem to PL/SQL engine to find out.

Reproduce the problem:
SQL> show user
USER is "SCOTT"

SQL> select * from pets;

NAME
-----------------------------------
PLUTO


SQL> conn / as sysdba
Connected.


SQL> create user GLS_DEV identified by test1234 default tablespace TSTDATA;

User created.

SQL> alter user GLS_DEV quota 25m on TSTDATA;

User altered.


SQL> grant create session, resource to GLS_DEV;

Grant succeeded.


--- Granting SELECT privilege on scott.pets to tstrole and then grant this role to GLS_DEV.

SQL> conn / as sysdba
Connected.
SQL>
SQL> create role tstrole;

Role created.

SQL> grant select on scott.pets to tstrole;

Grant succeeded.

SQL> grant tstrole to GLS_DEV;

Grant succeeded.

SQL> conn GLS_DEV/test1234
Connected.
SQL>
SQL> select * From scott.pets;

NAME
-----------------------------------
PLUTO

---- All fine till here. From SQL engine , GLS_DEV user can SELECT scott.pets table.

--- Now , I am going to create a PL/SQL object in GLS_DEV which tries to refer scott.pets

SQL> show user
USER is "GLS_DEV"


create or replace procedure my_proc
is
myvariable varchar2(35);

begin
     select name into myvariable from scott.pets ;

     dbms_output.put_line(myvariable);

end my_proc;
/

Warning: Procedure created with compilation errors.

SQL> show errors
Errors for PROCEDURE MY_PROC:

LINE/COL ERROR
-------- -----------------------------------------------------------------
6/2      PL/SQL: SQL Statement ignored
6/41     PL/SQL: ORA-01031: insufficient privileges

SQL>
SQL> 6
  6*    select name into myvariable from scott.pets ;


--- PL/SQL Engine doesn't seem to know that GLS_DEV has select privilege on scott.pets indirectly granted through a role

--- Fix
--- Instead of granting privilege through a role, I am granting the SELECT privilege on scott.pets to GLS_DEV directly.
--- The error goes away, I can compile and execute the procedure !!

SQL> conn / as sysdba
Connected.
SQL>
SQL> grant select on scott.pets to GLS_DEV;

Grant succeeded.

SQL> conn GLS_DEV/test1234
Connected.
SQL>
SQL> create or replace procedure my_proc
is
myvariable varchar2(35);

begin
        select name into myvariable from scott.pets ;

        dbms_output.put_line(myvariable);

end my_proc;  2    3    4    5    6    7    8    9   10
 11  /

Procedure created.

SQL> set serveroutput on
SQL> exec my_proc;
PLUTO

PL/SQL procedure successfully completed.
Has anyone encountered the same problem?

N.Page wrote:
Ok. Thank you all.
There is no work around for this like using the clause AUTHID or something?

Yes. using AUTHID (Summoner vs rights define) can make a difference.
However it makes sense that pl/sql uses roles a little differently. Although at first glance, it is hard to see why. The reasoning is similar to the difference between a user and a schema.

A user is a person who connects to a database. It has a role and this role defines what privileges he gets when you work with data.
A schema consists of several objects that reside in the database. A package is also such an object. This package is valid, it is necessary to have all privileges directly. A role can be enabled and is a sort of temporary right. A direct subsidy has a permanent status. A user will only get the right to run this package/procedure/function. The package is a type of user interface. It encapsulates the privileges necessary to do something about this user.

The logical problem happens only when the user and packaging are in the same scheme. The best approach is to have the package in the normal pattern and have a separate "schema access" with which the user connects. Give then execute privs on the package for this second scheme.

Tags: Database

Similar Questions

  • Netflix bought through iTunes does not give me the option 4K

    Netflix bought through iTunes does not give me the option 4K

    What, instead, have you done so far? Netflix Checked site help or a FAQ section? Contacted Netflix? If none of these give a solution contacted iTunes Support (http://reportaproblem.apple.com)?

  • Application role does not properly

    Hello

    I have an authorizattion init block which assigns the following values when a user "pconde"

    USER: pconde

    GROUP: ManagerGroup

    I have the catalogue of group "ManagerGroup" created through the option manage catalog groups. Now, I created a new role of application with the following details:

    Name - Manager

    Display name - sales managers

    I also added the "ManagerGroup" group to this application role.

    I assigned filters to the data level the 'Manager' via Manage application role-> identity

    When I connect through my pconde of the user, level data filters are not get picked up. The application role Manager sees all the data yet that the weblogic user see. It seems that the application role may not correctly setup.

    What I am doing wrong?

    Yes I did. In fact, my problem is different. The session of ROLES was not get properly completed. I rectified this and my problem was solved.

  • Backup DataPump when demand through crontab does not work!

    Hi Master,
    I had a script to save the export. I've changed to keep datapump backup instead of the export of conventinal. And since then, the cron job has stopped running.

    The oriiginal script was:

    #! / bin/bash
    CD/opt/ora10gr2
    . . Profile
    / backup/oracle10g/EBACKUP/scripts/daily_run CD.
    kdat = 'date + %d '.
    kmon = 'date + %b.
    While read i
    do
    Touch /backup/oracle10g/EBACKUP/db/daily_backup/logs/exp_log\_$kdat\_$kmon.log
    echo 'start time' $i > > /backup/oracle10g/EBACKUP/db/daily_backup/logs/exp_log\_$kdat\_$kmon.log
    Date of > > /backup/oracle10g/EBACKUP/db/daily_backup/logs/exp_log\_$kdat\_$kmon.log
    exp system/manager@$i file='/backup/oracle10g/EBACKUP/db/daily_backup/dumps/'$i\_$kdat\_$kmon'.dmp' log=/backup/oracle10g/EBACKUP/db/daily_backup/logs/$i\_$kdat\_$kmon'.log'= direct owner = sysadm statistics = none
    'save successfully done for' echo $i > > /backup/oracle10g/EBACKUP/db/daily_backup/logs/exp_log\_$kdat\_$kmon.log
    echo "end time" $i > > /backup/oracle10g/EBACKUP/db/daily_backup/logs/exp_log\_$kdat\_$kmon.log
    compress ' / backup/oracle10g/EBACKUP/db/daily_backup/dumps/'$i\_$kdat\_$kmon'.dmp'
    Date of > > /backup/oracle10g/EBACKUP/db/daily_backup/logs/exp_log\_$kdat\_$kmon.log
    fact </backup/oracle10g/EBACKUP/scripts/daily_run/list_DB

    The names of the databases are stored in a list_DB file.

    After modification, the script looked like:
    #! / bin/ksh
    CD/opt/ora10gr2
    . . Profile
    / backup/oracle10g/EBACKUP/scripts/daily_run CD.
    kdat = 'date + %d '.
    kmon = 'date + %b.
    While read i
    do
    Touch /backup/oracle10g/EBACKUP/db/daily_backup/logs/exp_log\_$kdat\_$kmon.log
    echo 'start time' $i > > /backup/oracle10g/EBACKUP/db/daily_backup/logs/exp_log\_$kdat\_$kmon.log
    Date of > > /backup/oracle10g/EBACKUP/db/daily_backup/logs/exp_log\_$kdat\_$kmon.log
    expdp system/manager@$i DUMPFILE=$i\_$kdat\_$kmon'.dmp' LOGFILE=$i\_$kdat\_$kmon'.log' SCHEMAS = sysadm DIRECTORY = JOB_NAME = daily_backup PARALLEL landfills = 4
    'save successfully done for' echo $i > > /backup/oracle10g/EBACKUP/db/daily_backup/logs/exp_log\_$kdat\_$kmon.log
    echo "end time" $i > > /backup/oracle10g/EBACKUP/db/daily_backup/logs/exp_log\_$kdat\_$kmon.log
    gzip ' / backup/oracle10g/EBACKUP/db/daily_backup/'$i\_$kdat\_$kmon'.dmp'
    Date of > > /backup/oracle10g/EBACKUP/db/daily_backup/logs/exp_log\_$kdat\_$kmon.log
    fact </backup/oracle10g/EBACKUP/scripts/daily_run/list_DB

    This change scripts when running standalone command line. But does not work when run through crontab.

    Any help will be much appreciated.

    Thank you
    Anoop

    Hello

    Two things I want to tell U.

    1 redirect the CRON output to the log file & check the errorlog file.
    example: -.

    43 17 * 1-4 /backup/oracle10g/EBACKUP/scripts/daily_run/exp_bkpdb_temp1.sh > /backup/oracle10g/EBACKUP/scripts/daily_run/cron_expdb.log

    2. in command line, you set all the necessary of the PATH, where he executed. But when you run the same script CRON, you must manually set the PATH in your script.
    Do the below in the command line: -.

    echo $PATH

    Add the output of the above command in your script as below & try.

    #! / bin/ksh
    export PATH =

    -Elango R

  • WindowsUpdate_C0000005""WindowsUpdate_dt000" Have you tried everything, updates, installation of Admin privileges and still does not work. etc...

    system displays 2 messages saying 2 large installations cannot be updated. Tried to install and run them as an administrator and do not work.

    He does not think I open word, Excel, pdf document or file. Get the following message... Windows cannot find the following file... Please make sure file name is correctly written.

    Hello

    see if that helps to fix:

    How to reset the Windows Update components?

    There is also an automatic 'fix - it' here

    http://support.Microsoft.com/kb/971058

    Also, try to put the KB numbers in the search on the link below and then manually download the

    http://www.Microsoft.com/downloads/en/default.aspx

    or please repost your question in the correct windows update forum

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_vista-windows_update?page=1&tab=all

    _______________________________________________________

    also run the sfc/scannow command.

    http://support.Microsoft.com/kb/929833

    Use the (SFC.exe) System File Checker tool to determine which file is causing the problem and then replace the file. To do this, follow these steps:

    1. Open an elevated command prompt. To do this, click Start, click principally madeprograms,Accessories, right-clickguest, and then clickrun as administrator. If you are prompted for an administrator password or a confirmation, type the password, or clickallow.
    2. Type the following command and press ENTER:
      sfc/scannow

      The sfc/scannow command analyzes all protected system files and replaces incorrect versions with appropriate Microsoft versions

    How to analyze the entries in the log file generating the program Checker (SFC.exe) resources of Microsoft Windows in Windows Vista

    http://support.Microsoft.com/kb/928228#appliesTo

    If SFC detects the main problems it can't fix you may need to borrow a Microsoft dvd vista not an acer, HP etc. recovery disk and do a repair installation

    read the below tutorial on how to perform a repair installation

    http://www.Vistax64.com/tutorials/88236-repair-install-Vista.html

    ________________________________________________________

    and make sure that your computer is malware free

    an anti-virus can not find any problems

    you need to scan with a good anti-malware program

    Download update and scan with the free malwarebytes anti-malware version

    http://www.Malwarebytes.org/MBAM.php

  • Facebook, Gmail and MétéoMédia works does not for me with the last update, even in safe mode

    That pretty much sums up it. Since yesterday, with the most recent update, firefox does not display correctly these sites. Someone else posted a question similar to this topic. It has been marked as resolved, but there is no solution posted. Here's his question: https://support.mozilla.org/en-US/questions/963125 I have the same problem as him with fb. In addition to the problem with fb, Gmail doesn't end loading. And MétéoMédia do not display the weather forecast. I'm sure that many other sites are affected as well.

    All sites work properly in Seamonkey, which I use once again, now. I went to oldapps download v. 22 of ff, but whatever the most recent update changed only came when I installed v.22. The problem persists. I could uninstall it completely and then new installation v.22, I guess, but I'm afraid that my browsing history, sessions, passwords, etc., would be affected, and I don't want to find all the files and support first. It's a hassle. Since the sites work in Seamonkey, I'm guessing that's not the fact that I have updated flash at the same time. I don't know how much these sites use flash, either. But if it's a problem of flash, I tell myself I should have the same problem in Seamonkey, and I did not.

    I wish that you guys would have an easy option to restore your updates because it's pretty darn annoying when they cause problems. Usually, they are not lethal problems, however, and the browser still works. Now ff does not work for some sites I use most often.

    Hello

    Many issues of the site can be caused by corrupted cookies or cache. To try to solve these problems, the first step is to clear cookies and cache.
    Note: This will be you temporarily disconnect all sites, you're connected to.
    To clear the cache and cookies to do the following:

    1. Go to Firefox > history > clear recent history or (if no Firefox button is displayed) go to tools > clear recent history.
    2. Under "Time range to clear", select "all".
    3. Now, click the arrow next to details to toggle the active details list.
    4. In the list of details, see the Cache and Cookies and uncheck everything.
    5. Now click the clear now button.

    More information can be found in article to clear your cache, history, and other personal information in Firefox .

    __________________________________________________________________

    Also, some Firefox problems can be solved by performing a clean reinstall. This means that you remove Firefox program files, and then reinstall Firefox. Please follow these steps:

    Note: You can print these steps or consult them in another browser.

    1. Download the latest version of Firefox from http://www.mozilla.org office and save the installer to your computer.
    2. Once the download is complete, close all Firefox Windows (click on quit in the file menu or Firefox).
    3. Remove the Firefox installation folder, which is located in one of these locations, by default:
      • Windows:

        • C:\Program Files\Mozilla Firefox
        • C:\Program Files (x 86) \Mozilla Firefox
      • Mac: Delete Firefox in the Applications folder.
      • Linux: If you have installed Firefox with the distribution-based package manager, you must use the same way to uninstall: see Install Firefox on Linux. If you have downloaded and installed the binary package from the Firefox download page, simply remove the folder firefox in your home directory.
    4. Now, go ahead and reinstall Firefox:
      1. Double-click on the downloaded Setup file and go through the steps in the installation wizard.
      2. Once the wizard is completed, click to open Firefox directly after clicking the Finish button.

    This will remove not essential info unless you check the box "delete all my personal data too.

    Please report back to see if this helped you!

    Thank you.

  • Satellite A100: webcam works does not for windows live messenger on Vista

    I recently lost my picture when working for video calls in windows live messenger, the sound of two ways and I can see them, but no one can see me.
    I also bought an external webcam, and it does not work either.

    When I go to Device Manager it says that the two cams don't work properly.
    I tried to update the drivers but they are up-to-date.
    I wonder if it's a problem of Windows live or Toshiba.
    I use Windows Vista Home Premium and the new version of messenger.

    > I also bought an external webcam and it doesn t work either.
    > When I go to Device Manager it says that the two cams don't work properly

    For me, it looks like a windows system problem.
    Usually two webcams operate independently from each other and so I don t think that it is a webcam driver problem I think that it s windows or windows live messenger problem
    Maybe something confused keys registry or files may be some updates to update or similar

    In your case, I recommend you to uninstall the software of webcam software, internal external webcam and the windows live messenger.
    Then, you must clean the BONES and the registry tool like CCLeaner cleaning, for example. It the free tool.

    After this, reinstall the Chicony webcam software and test functionality without installation of windows live messenger.
    If the webcam will be functions then you could install the windows live messenger again.

  • Want Dv6 - 7300st: finger print works does not for Windows 10

    Hello

    I've updated 10 64-BIT windows. then after I find, validity wbf ddk driver does not. It engages and works in the background

    Please help me driver for windows 10 64-BIT

    Hi @mahmutbasar,

    There is no newer driver for Windows 10 fingerprint sensor. It seems that the old driver is not compatible with the Windows 10 either. So, if the fingerprint work in previous windows, it's a matter of software with Windows 10.

  • I have a SSIS package that uses ODBC to connect to a progress database that does not work in SQL Agent

    I have a SSIS package that uses ODBC to connect to a Progress database.  It works fine in Visual Studio and it works very well in a batch file calling DTEXEC from the Windows Task Scheduler, but it does not work in the work of the SQL Agent.  It says that it cannot find the driver information.

    Hi Curt_DBA,

    The question you posted would be better suited in the MSDN Forums. I would recommend posting your query in the MSDN Forums (SQL Server Integration Services).

    MSDN Forum (SQL Server Integration Services)

    http://social.msdn.Microsoft.com/forums/en-SG/sqlintegrationservices/threads

    I hope this helps.

  • ITunes 9.1 works does not for Windows Vista

    I've recently updated itunes 9.1 and when I click to open the program, nothing happens

    It is open in the process in the Task Manager

    I tried to uninstall, download of the installer on the itunes site and still does not work

    I am running Windows Vista

    Help would be greatly appreciated, thanks

    Hi all

    You can watch on the Apple site for troubleshooting iTunes and Windows Vista.

    http://www.Apple.com/support/iTunes/

    The article watch is titled: iTunes for Windows Vista or 7: Troubleshooting unexpected quits unexpectedly, freezes, or launch issues

    I hope this helps.

    Sincerely,

    Marilyn
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think

  • BlackBerry Smartphones QWERT keyboard does not for text messages.

    My keyboard does not appear when I switch my phone when I check my e-mail or text messages. If I use my browser or anything else needing a keyboard, it works fine. Anyone who has an idea on what could be the cause?

    Excellent! Batt-pop reboots are as restart a PC - a healthy thing!

  • Webcam works does not for windows 8

    Hello

    Yesterday I installed GoogleVoiceandVideoSetup to use Gtalk WebCam but after installing it, my webcam does not work.
    It doesn't show any picture, can someone help me on this.
    Kind regards
    Gaurav Dey

    I found the solution: -.

    I went to the Device Manager. Rode to the previous setting, and after that I re-installed the latest drivers and it works for me.
    :)
  • Lights up does not, for anything!

    I'm doing a cool video with some models of a video game, one of them is a giant robot and I imported into the 3-d element with it's diffuse texture so that I could composite it inside the after-effects.

    The only problem is that lights does not work on anything WHATSOEVER, except ambient lights that makes everything more clear. The model turns black when the light is activated (point, point, and parallel)

    It's very weird, the rendering mode is set to classic 3D and draft mode is off.

    Is there something I need to keep in mind when adding lights that I missed browsing Google for an answer?

    THX

    I solved the problem. 3D of the element normals were not be shaded because I had only broadcasts a texture, so I had to check the box "Auto-normales" to get the lights to work with the model.

  • Compact/shrink *.vmdk does NOT (for Ubuntu guestOS)

    I have a Ubuntu guestOS installation running on a Win7 hostOS.

    The corresponding *.vmdk file has a size of about 8.5 GB (!).

    When I start the virtual machine and enter in a terminal:

    DF h

    then I can see that the partition contains only 3.9 GB (= 'used').

    So he has a lot of space that can be compacted/shrunk.

    I leave the guestOS and go to the menu:

    Machine settings VMware-> hardware-> drive-> utilities-> Compact

    and began an operation of "compact".

    Much to my surprise the *.vmdk file is subsequently (or almost) big as before.

    If compacting doesn't seem DO NOT work.

    Why?

    A defragmentation does not help.

    Some with VmWare Player.

    And even with the command cmdline

    VMware - vdiskmanager.exe - k Ubuntu.vmdk

    If not, how can I compact shrink the *.vmdk?

    Matt

    Assuming that the VMware virtual disk is not previously affected and the file system is ext4, you will need to manually prepare to be narrowed.

    In the virtual machine, in a Terminal, become root and then copy and paste the following command, as is and then press ENTER:

    dd if=/dev/zero of=wipefile bs=1024x1024; rm wipefile
    

    Wait for the prompt to return, then press stop the virtual computer, then the settings of the Virtual Machine for the hard drive to select the Compact command from the utility button.

  • Hotel Web does not for formmail cgi script. What should I use instead, and how to run it?

    Hello

    I'm close tothey done with my new site of clslow and just found out that his webhotel does not offer the simple cgi-script I usually use

    Any suggestions that I can use instead (I guess PHP and it's Greek to me...), but how do I do it?

    Address on the site and the actual page is here: http://www.kennelmannequins.se/ToftaBilII/servicebokning.html (it is in Swedish, so don't be scared if you don't understand the language)

    I hope you can help me!

    Carolin

    Try NateMail or ProcessForm from the link below. Both come with a simple step by step pdf, set up the guide.

    The two are old enough but will get the job done.

    http://www.MindPalette.com/archives/ProcessForm/

Maybe you are looking for