次の動作を引き起こす可能性のあるもの:
データベース11gR2
declare
l_amt number := dbms_lob.lobmaxsize;
l_dst_loc clob;
l_dst_offset number := 1;
l_lang_ctx number := dbms_lob.default_lang_ctx;
l_src_loc bfile;
l_src_offset number := 1;
l_warning number;
begin
l_src_loc := bfilename('ODS_SERVER_DIRECTORY', '_CIVKD_ASU.CSV');
dbms_lob.createtemporary(l_dst_loc, true);
dbms_lob.fileopen(l_src_loc, dbms_lob.file_readonly);
dbms_lob.loadclobfromfile(l_dst_loc
,l_src_loc
,l_amt
,l_dst_offset
,l_src_offset
,dbms_lob.default_csid
,l_lang_ctx
,l_warning);
commit;
dbms_lob.fileclose(l_src_loc);
dbms_output.put_line(substr(l_dst_loc, 1, 200));
end;
/
ORA-22288: file or LOB operation FILEOPEN failed
.
ORA-06512: in "SYS.DBMS_LOB", line 805
ORA-06512: in line 31
22288. 00000 - "file or LOB operation %s failed\n%s"
*Cause: The operation attempted on the file or LOB failed.
*Action: See the next error message in the error stack for more detailed
information. Also, verify that the file or LOB exists and that
the necessary privileges are set for the specified operation. If
the error still persists, report the error to the DBA.
ただし、utl_fileを使用すると、まったく同じファイルを開いて読み取ることができます。
declare
l_file utl_file.file_type;
l_regel varchar2(4000);
begin
l_file := utl_file.fopen('ODS_SERVER_DIRECTORY', '_CIVKD_ASU.CSV', 'R');
-- Haal de volgende regel op
utl_file.get_line(l_file, l_regel);
dbms_output.put_line(l_regel);
utl_file.fclose_all;
end;
したがって、ファイルはデータベースから利用可能でアクセス可能であるようです。
この特定のエラーが発生するのはこれが初めてであり、最初の11gR2インスタンスの1つであるため、11g固有の何かがわからないのではないでしょうか。
===更新8-6-2012===ある程度の進歩がありました。ディレクトリオブジェクトが共有ドライブを指していることがわかります。これはWindowsサーバーであり、Oracleはローカルシステムとして実行されます。この状況では、共有ドライブから何かを読み取ることは不可能だといつも思っていました。どうやらいくつかの状況では、utl_fileを使用できますが、dbms_lobを使用することはできません。