oracle ORA-22288: 文件或 LOB 操作 FILEOPEN 失败。文件名、目录名不正确
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35482890/
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
ORA-22288: file or LOB operation FILEOPEN failed. Filename, directory name is incorrect
提问by David Faizulaev
I'm trying to load a LOB file to a table and ORA-22288.
I fail on DBMS_LOB.FILEOPEN(src_clob);
我正在尝试将 LOB 文件加载到表和 ORA-22288。我失败了DBMS_LOB.FILEOPEN(src_clob);
What can be the cause? The directory exists and file is located in the directory.
可能是什么原因?该目录存在并且文件位于该目录中。
I do the following:
我执行以下操作:
- Connect as SYSTEM
Execute the following commands:
SQL>create or replace directory MY_DIR as 'C:\oracle\admin\MYDB\create\lob';
SQL>Grant all on directory MY_DIR to MYDBUSER;
Connect as MYDBUSER and call a procedure
SQL>LOAD_LOB_FROM_FILE(10,'insert_details_view.xsl','XMLXSL_DATA_T','FILE_ID','LOB_FILE');
- 以系统身份连接
执行以下命令:
SQL>create or replace directory MY_DIR as 'C:\oracle\admin\MYDB\create\lob';
SQL>Grant all on directory MY_DIR to MYDBUSER;
以 MYDBUSER 身份连接并调用过程
SQL>LOAD_LOB_FROM_FILE(10,'insert_details_view.xsl','XMLXSL_DATA_T','FILE_ID','LOB_FILE');
The procedure is:
程序是:
CREATE OR REPLACE PROCEDURE LOAD_LOB_FROM_FILE(p_FileId NUMBER, p_FileName
VARCHAR2,p_TableName VARCHAR2, p_IDColumnName VARCHAR2, p_FileColoumnName VARCHAR2)
IS
dest_clob CLOB;
src_clob BFILE := BFILENAME('MY_DIR', p_FileName);
dest_length number;
str_query CLOB;
BEGIN
-- This procedure handles updates of all files in the databse - LOB, Json and XSL.
-- The procedure recieves dynamic parameters in order to work for all contexts and file types
str_query := 'SELECT ' || p_FileColoumnName || ' FROM ' || p_TableName || ' WHERE ' || p_IDColumnName || ' = ' || p_FileId || ' FOR UPDATE ';
EXECUTE IMMEDIATE str_query INTO dest_clob;
DBMS_LOB.FILEOPEN(src_clob);
-- It is necessary to clear the old clob before updating with the new one to prevent the file destruction.
dest_length := DBMS_LOB.GETLENGTH(dest_clob);
IF dest_length <> 0 THEN
DBMS_LOB.ERASE(dest_clob,dest_length,1);
END IF;
DBMS_LOB.LOADFROMFILE(dest_clob,src_clob,DBMS_LOB.GETLENGTH(src_clob));
str_query := 'UPDATE ' || p_TableName || ' SET ' || p_FileColoumnName || ' = ''' || dest_clob ||''' WHERE ' || p_IDColumnName || ' = ' || p_FileId;
EXECUTE IMMEDIATE str_query;
DBMS_LOB.FILECLOSE(src_clob);
COMMIT;
END;
/
Full error stack:
完整的错误堆栈:
ERROR at line 1: ORA-22288: file or LOB operation FILEOPEN failed The filename, directory name, or volume label syntax is incorrect.
第 1 行错误:ORA-22288:文件或 LOB 操作 FILEOPEN 失败 文件名、目录名或卷标语法不正确。
ORA-06512: at "SYS.DBMS_LOB", line 805
ORA-06512:在“SYS.DBMS_LOB”,第 805 行
ORA-06512: at "VSU22.LOAD_LOB_FROM_FILE", line 16
ORA-06512:在“VSU22.LOAD_LOB_FROM_FILE”,第 16 行
ORA-06512: at line 3
ORA-06512:在第 3 行
采纳答案by David Faizulaev
The parameter passed to the installer used was incorrect (lack of attention).
传递给使用的安装程序的参数不正确(缺乏注意)。