Oracle DBMS_LOB包打开过程失败

Oracle DBMS_LOB包打开过程失败,oracle,hash,database,Oracle,Hash,Database,我得到了下面的函数。在我的本地oracle 11gR2上运行良好。不适用于客户的11gR2。在dbms_lob.open处失败。我的问题是“为什么”。欢迎任何帮助 这是我到目前为止检查过的。 1.Oracle目录对象权限在这两个位置都相同。 2.我使用dbms_output.put_行检查是否选择了所有正确的数据。 3.客户说文件位置不是问题所在 顺便说一句,基本目的只是为一个文件计算一个简单的sha1(我知道,我知道,不是一个好的哈希算法) CREATE OR REPLACE FUNCTION

我得到了下面的函数。在我的本地oracle 11gR2上运行良好。不适用于客户的11gR2。在dbms_lob.open处失败。我的问题是“为什么”。欢迎任何帮助

这是我到目前为止检查过的。 1.Oracle目录对象权限在这两个位置都相同。 2.我使用dbms_output.put_行检查是否选择了所有正确的数据。 3.客户说文件位置不是问题所在

顺便说一句,基本目的只是为一个文件计算一个简单的sha1(我知道,我知道,不是一个好的哈希算法)

CREATE OR REPLACE FUNCTION FC_Hash_Attachment (argAttachmentRSN int) RETURN VARCHAR2 AS

v_hash RAW(2000);
b_file BFILE;
b_file_length BINARY_INTEGER;
dst_blob BLOB;
v_dosPath Attachment.dosPath%Type;
v_truncDosPath Attachment.dosPath%Type;
v_homeDir varchar2(50);
n_count int;

BEGIN
/* This function assumes the amanda_home directory object has been created.
   Further assumes the attachment is stored in the file system and not in the blob. */

/* Find the home directory so it can be stripped off the front of the dos path */
SELECT directory_path 
INTO v_homeDir
FROM all_directories 
WHERE UPPER(directory_name) = 'AMANDA_HOME';
DBMS_OUTPUT.PUT_LINE('v_homeDir:' || v_homeDir);

/* get the dos path of the identified attachment */
SELECT dosPath
INTO v_dosPath 
FROM Attachment 
WHERE attachmentRSN = argAttachmentRSN;
DBMS_OUTPUT.PUT_LINE('v_dosPath:' || v_dosPath);

/* Strip the home directory from the attachment save path */
v_truncDosPath := REPLACE(v_dosPath, v_homeDir);
DBMS_OUTPUT.PUT_LINE('v_truncDosPath:' || v_truncDosPath);

/* create a temporary blob to store the attachment in */
DBMS_LOB.CREATETEMPORARY(lob_loc => dst_blob, cache => true);



/* get the file into a bfile object */
b_file := BFILENAME('AMANDA_HOME', v_truncDosPath);


/* open the blob object as a read only */
DBMS_LOB.OPEN(b_file, DBMS_LOB.LOB_READONLY);


/* get the length of the blob object */
b_file_length := DBMS_LOB.GETLENGTH(file_loc => b_file);


/* load the file */
DBMS_LOB.LOADFROMFILE(dst_blob, b_file, b_file_length);


/* hash the file using sha1 */
v_hash := DBMS_CRYPTO.HASH(src => dst_blob, typ => DBMS_CRYPTO.HASH_SH1);


/* close the file */
DBMS_LOB.FILECLOSE(file_loc => b_file);


RETURN RAWTOHEX(v_hash);    

EXCEPTION 
WHEN DBMS_LOB.INVALID_ARGVAL THEN DBMS_OUTPUT.PUT_LINE ('The argument is expecting a nonNULL, valid value but the argument value passed in is NULL, invalid, or out of range.');
WHEN DBMS_LOB.ACCESS_ERROR THEN DBMS_OUTPUT.PUT_LINE('You are trying to write too much data to the LOB: LOB size is limited to 4 gigabytes.');
WHEN DBMS_LOB.NOEXIST_DIRECTORY THEN DBMS_OUTPUT.PUT_LINE('The directory leading to the file does not exist.');
WHEN DBMS_LOB.NOPRIV_DIRECTORY THEN DBMS_OUTPUT.PUT_LINE('The user does not have the necessary access privileges on the directory or the file for the operation.');
WHEN DBMS_LOB.INVALID_DIRECTORY THEN DBMS_OUTPUT.PUT_LINE('The directory used for the current operation is not valid if being accessed for the first time, or if it has been modified by the DBA since the last access.');
WHEN DBMS_LOB.OPERATION_FAILED THEN DBMS_OUTPUT.PUT_LINE('The operation attempted on the file failed.');
WHEN DBMS_LOB.UNOPENED_FILE THEN DBMS_OUTPUT.PUT_LINE('The file is not open for the required operation to be performed.');
WHEN DBMS_LOB.OPEN_TOOMANY THEN DBMS_OUTPUT.PUT_LINE('The number of open files has reached the maximum limit.');
--WHEN DBMS_LOB.NO_DATA_FOUND THEN DBMS_OUTPUT.PUT_LINE('EndofLob indicator for looping read operations. This is not a hard error.');
--WHEN DBMS_LOB.VALUE_ERROR THEN DBMS_OUTPUT.PUT_LINE('PL/SQL error for invalid values to subprograms parameters.');


END;
他们得到的错误是-

ORA-22288: file or LOB operation string failed string
The system could not find the specified path.

你不认为告诉我们错误是什么会有帮助吗?除了发布错误外,“客户说文件位置不是问题”的确切含义是什么。您是说客户端已验证运行Oracle数据库的操作系统用户在基础操作系统目录上具有适当的权限吗?您的客户端使用的是什么操作系统?文件打开异常几乎总是由于(1)路径/文件名不正确,或(2)目录上的操作系统权限。OldProgrammer-是的,错误可能会有所帮助。它是ORA-22288。Justin Cave-OS是Windows Server 2008。我相信客户端已经确认运行DB的用户具有文件系统权限。