My Oracle Support Banner

How to Read DBFS Contents Using PLSQL (Doc ID 1378785.1)

Last updated on MARCH 25, 2025

Applies to:

Oracle Database - Enterprise Edition - Version 11.2.0.1 and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Cloud Exadata Service - Version N/A and later
Oracle Database Cloud Schema Service - Version N/A and later
Information in this document applies to any platform.
Oracle RDBMS, Exadata that has Database Filesystem.


Symptoms

Executing a PLSQL procedure or anonymous block to read the contents of a file from a DBFS mount fails with the following error:

DECLARE
  buf raw(32767);
  props dbms_dbfs_content.properties_t;
  data blob;
  itype integer;
  len number;
  off number;
  amt number;
BEGIN
  dbms_dbfs_content.getpath(path=>'/dbfs_direct/FS1/test', properties=> props, content=>data,  
    item_type=> itype, prop_flags=>dbms_dbfs_content.prop_data);
  len := dbms_lob.getlength(data);
  dbms_output.put_line('Length: ' || len);
  off := 1;
  while off < len loop
      amt := 32767;
      dbms_lob.read(data, amt, off, buf);
      if amt > 0 then
        dbms_output.put_line(utl_raw.cast_to_varchar2(buf));
      end if;
      off := off + amt;
  end loop;
  dbms_output.put_line('');
END;
/

*
ERROR at line 1:
ORA-64002: specified path is invalid
ORA-06512: at "SYS.DBMS_DBFS_CONTENT", line 455
ORA-01403: no data found
ORA-06512: at "SYS.DBMS_DBFS_CONTENT", line 3103
ORA-06512: at "SYS.DBMS_DBFS_CONTENT", line 3162
ORA-06512: at line 10

Changes

Utilization of DBFS mounts for storing files.

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Changes
Cause
Solution


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.