如何在Oracle中以普通用户身份运行dbms_crypto函数?

Mic*_*las 6 database oracle cryptography

dbms_crypto.hash()在Oracle中使用函数时遇到问题.

我使用sqlplus作为"sys/passwd as sysdba"连接到数据库服务器,然后我安装了dbms_crypto包:

@/home/oracle/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/dbmsobtk.sql
@/home/oracle/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/prvtobtk.plb
Grant execute on dbms_crypto to public;
Grant execute on dbms_sqlhash to public;
Grant execute on dbms_obfuscation_toolkit to public;
Grant execute on dbms_obfuscation_toolkit_ffi to public;
Grant execute on dbms_crypto_ffi to public;
Run Code Online (Sandbox Code Playgroud)

一切看起来都不错,所以我测试了hash()功能:

SQL> select dbms_crypto.hash(utl_raw.cast_to_raw('zorg'), 3) from dual;

DBMS_CRYPTO.HASH(UTL_RAW.CAST_TO_RAW('ZORG'),3)
--------------------------------------------------------------------------------
60C440F9954CA4744204CDA9CC93567059C1EC82
Run Code Online (Sandbox Code Playgroud)

我作为普通用户断开并连接到该数据库,但后来我收到错误:

SQL> select dbms_crypto.hash(utl_raw.cast_to_raw('zorg'), 3) from dual;
select dbms_crypto.hash(utl_raw.cast_to_raw('zorg'), 3) from dual
             *
ERROR at line 1:
ORA-06521: PL/SQL: Error mapping function
ORA-06512: at "MN.DBMS_CRYPTO_FFI", line 131
ORA-06512: at "MN.DBMS_CRYPTO", line 72
Run Code Online (Sandbox Code Playgroud)

为什么我不能像普通用户一样使用此功能?如何让其他用户使用它?

我合作:

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
Run Code Online (Sandbox Code Playgroud)

Mic*_*las 10

问题解决了.我创建包作为错误的用户.合适的方式:

  1. 连接使用:

    sqlplus / as sysdba
    
    Run Code Online (Sandbox Code Playgroud)
  2. 安装包:

    @/home/oracle/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/dbmsobtk.sql
    @/home/oracle/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/prvtobtk.plb
    
    Run Code Online (Sandbox Code Playgroud)
  3. 以普通用户身份连接并使用dbms_crypto包中的功能.