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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13473087/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 08:47:20  来源:igfitidea点击:

How to run dbms_crypto functions in Oracle as regular user?

oraclecryptographydatabase

提问by Micha? Niklas

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

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

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

我使用 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;

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

一切看起来都不错,所以我测试了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

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

回答by Micha? Niklas

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_cryptopackage.

  1. 连接使用:

    sqlplus / as sysdba
    
  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
    
  3. 以普通用户身份连接并使用dbms_crypto包中的功能。