Oracle 19c,并行执行情况下的奇怪行为授权

Oracle 19c,并行执行情况下的奇怪行为授权,oracle,Oracle,Oracle 19c,在并行执行的情况下,对角色的包授权执行是不够的, 不得不直接授权给用户,不明白为什么。下面的详细信息,请帮助 有两个用户:ETL和DQ 在DQ包中,创建了测试包: 规格: create or replace package test_pkg authid current_user as procedure test_proc2(in_start number, in_end number); procedure test_pro

Oracle 19c,在并行执行的情况下,对角色的包授权执行是不够的, 不得不直接授权给用户,不明白为什么。下面的详细信息,请帮助

  • 有两个用户:ETL和DQ
  • 在DQ包中,创建了测试包:
  • 规格:

     create or replace package test_pkg
        authid current_user
        as
           procedure test_proc2(in_start number, in_end number);
           procedure test_proc;
        end  test_pkg;
      
    
     
    
    正文:


  • 创建角色etl_流程,将角色授予etl
  • 用户ETL执行:
  • 执行后检查用户\u并行\u执行\u块,注意 区块失败,出现奇怪的错误
  • 挑选* 从用户\u并行\u执行\u块 其中task\u name='test\u task' 按开始说明订购

    错误:

    ORA-06550: line 1, column 7:
    PLS-00201: identifier 'DQ.TEST_PKG' must be declared
    
  • 当我们直接将execute授予etl时,一切都很好
  • 若在包中像下面这样更改过程test_proc(删除并行执行),那个么一切都很好

  • 这种行为既不奇怪,也与19c无关

    请参阅文档中描述以下内容的链接:

    程序或包的所有者必须已被明确授予代码主体内引用的所有对象的必要对象权限;所有者不能通过角色获得所需的权限

    如果您从调用包中删除
    authid current\u user
    ,您将获得预期的行为,这两种情况下直接执行和通过包
    dbms\u parallel\u execute执行都会导致异常
    PLS-00201


    您可以通过添加
    authid current_user
    来缓解前一种情况,因为在这种情况下会考虑角色权限,但显然您不能继承
    dbms_parallel_execute
    包中的当前用户权限,所以它继续失败。

    回答了你的问题吗?@marmite bomber谢谢你的回答,但我不能再理解一件事了。在您的回答中引用文档-这是关于编译过程/包的附加要求,而不是调用它,对吗?我只是试图从已经编译的包中调用过程(请参阅更明确的文档。例如,在任何使用定义者权限执行的命名PL/SQL块中,所有角色都被禁用。@marmite bomber,但在我的示例中,代码是使用调用者权限执行的(我使用了authid current_user)在文档中我可以看到:当前角色用于调用程序的rights PL/SQL块中的特权检查
    create role etl_process;
    grant etl_process to etl;
    grant execute on dq.test_pkg to etl_process;
    
    call dq.test_pkg.test_proc();
    
    ORA-06550: line 1, column 7:
    PLS-00201: identifier 'DQ.TEST_PKG' must be declared
    
    procedure test_proc
       as
       begin
          dq.test_pkg.test_proc2 (in_start=>1, in_end=>1);
       end;