Oracle DBMS_LOB

Today’s adventures in Oracle land:

The following must be performed on the server to get the dbms_lob to read/write files:

  • CREATE OR REPLACE DIRECTORY DIRNAME_IN_ORACLE AS ‘/path’
  • This creates a handle DIRNAME_IN_ORACLE for Oracle to use for a file system location. Existing DIRECTORY names can be found in the DBA_DIRECTORIES view. The user executing this must have the CREATE ANY DIRECTORY privilege.

  • GRANT READ, WRITE ON DIRECTORY DIRNAME_IN_ORACLE TO USERNAME
  • This grants the appropriate permissions to USERNAME to work with the directory handle.

    Caveats:

    When referring to DIRNAME_IN_ORACLE in the dbms_lob package, DIRNAME_IN_ORACLE must be all-capped, e.g., DIRNAME_IN_ORACLE is tmp, then use TMP.

    On windows systems, /path is, of course, not case-sensitive. However, mapped network shares don’t appear to work, and error out with an ORA-22288.

    Comments are closed.