2012-11-20 23 views
5

我在Oracle中使用dbms_crypto.hash()函數時遇到問題。如何以普通用戶身份在Oracle中運行dbms_crypto函數?

我用sqlplus爲連接到數據庫服務器 「SYS/passwd作爲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; 

一切看起來都很好,所以我測試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 

我斷開連接並以普通用戶的身份連接到該數據庫,但隨後出現錯誤:

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 

爲什麼我不能使用這個功能作爲普通用戶?如何讓其他用戶使用它?

我的工作有:

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

回答

8

問題解決了。我將包創建爲錯誤的用戶。正確的方法:

@/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 
  • 連接爲普通用戶和使用功能,從dbms_crypto包:

    1. 連接使用:

      sqlplus/as sysdba 
      
    2. 安裝軟件包。

  • +0

    感謝您報告返回Michal。你能否指出其他人是否可以得到幫助?否則,您可能想要關閉該問題。 –

    +1

    我認爲其他人可以得到幫助。 –

    相關問題