How to run dbms_crypto functions in Oracle as regular user?

筅森魡賤 提交于 2021-02-07 13:55:18

问题


I have problem with using dbms_crypto.hash() function in Oracle.

I connected to database server using sqlplus as "sys/passwd as sysdba", then I installed dbms_crypto package:

@/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;

Everything looks good, so I tested hash() function:

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

I disconnected and connected to that database as regular user, but then I got error:

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

Why I cannot use this function as regular user? How to allow other users to use it?

I work with:

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

回答1:


Problem solved. I created package as wrong user. Proper way:

  1. connect using:

    sqlplus / as sysdba
    
  2. Install packages:

    @/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
    
  3. Connect as regular user and use functions from dbms_crypto package.



来源:https://stackoverflow.com/questions/13473087/how-to-run-dbms-crypto-functions-in-oracle-as-regular-user

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!