Oracle DBMS_LOBUTIL
Version 26ai

General Information
Library Note Morgan's Library Page Header
The best Oracle News for FY2026

Oracle Database 26ai is now availble. If you haven't you downloaded already: Why?
Purpose A container for diagnostic and utility functions and procedures specific to LOBs. Since diagnostic operations are not part of the standard programmatic APIs in DBMS_LOB, they are provided in a separate namespace to avoid clutter. The diagnostic API is also not quite as critical to document for end-users; its main use is for internal developer, QA, and DDR use (especially since it peeks into the internal structure of LOB inodes and lobmaps).
AUTHID DEFINER
Data Types -- dbms_lobutil_inode_t: inode information
CREATE OR REPLACE TYPE dbms_lobutil_inode_t AS OBJECT (
lobid   RAW(10), -- lobid
flags   NUMBER,  -- inode flags
length  NUMBER,  -- lob length
version NUMBER,  -- lob version
extents NUMBER,  -- #extents in inode
lhb     NUMBER   -- lhb dba);
/

-- dbms_lobutil_lobmap_t: lobmap information
CREATE OR REPLACE TYPE dbms_lobutil_lobmap_t AS OBJECT (
lobid  RAW(10), -- lobid
eflag  NUMBER,  -- extent flags
rdba   NUMBER,  -- extent header rdba
nblks  NUMBER,  -- #blocks in extent
offset NUMBER,  -- offset of extent header
length NUMBER   -- logical length of extent);

-- dbms_lobutil_lobextent_t: extent information
CREATE OR REPLACE TYPE dbms_lobutil_lobextent_t AS OBJECT (
rid     VARCHAR(32), -- rowid proxy
row#    NUMBER,      -- rownum proxy
lobid   RAW(10),     -- lobid
extent# NUMBER,      -- extent# [0 .. ] for a lobmap
hole    VARCHAR(1),  -- is the extent a hole? (y/n)
cont    VARCHAR(1),  -- is the extent a superchunk continuation (y/n)
over    VARCHAR(1),  -- is the chunk an overallocation? (y/n)
rdba    NUMBER,      -- rdba of extent start
nblks   NUMBER,      -- #blocks in extent
offset  NUMBER,      -- logical offset of extent start
length  NUMBER       -- logical length of extent);
/

-- dbms_lobutil_lobextents_t: expanded extent map information
CREATE OR REPLACE TYPE dbms_lobutil_lobextents_t AS
TABLE OF dbms_lobutil_lobextent_t;
/
Dependencies
ANYDATA DBMS_LOBUTIL_INODE_T DBMS_LOBUTIL_LOBEXTENT_T
DBMS_LOBUTIL_DEDUPSET_T DBMS_LOBUTIL_LOBEXTENTS_T DBMS_LOBUTIL_LOBMAP_T
Documented No
Exceptions
Error Code Reason
ORA-22275 invalid LOB locator specified
First Available 11.1
Security Model Owned by SYS with EXECUTE granted to PUBLIC
Source {ORACLE_HOME}/rdbms/admin/dbmslobu.sql
Subprograms
 
COPY_PRIMARY_DEDUP
Copy the primary LOB of a dedup set

Overload 1
dbms_lobutil.copy_primary_dedup(
lob_loc IN OUT NOCOPY BLOB,
phash   IN            RAW,
fhash   IN            RAW,
scn     IN            NUMBER DEFAULT 0,
par     IN            NUMBER);
TBD
Overload 2 dbms_lobutil.copy_primary_dedup(
lob_loc IN OUT NOCOPY CLOB CHARACTER SET ANY_CS,
phash   IN            RAW, fhash IN RAW,
scn     IN            NUMBER DEFAULT 0,
par     IN            NUMBER);
TBD
 
GETDEDUPSET
Undocumented deduplication set query
Overload 1
dbms_lobutil.getdedupset(lob_loc IN BLOB) RETURN dbms_lobutil_dedupset_t DETERMINISTIC;
TBD
Overload 2 dbms_lobutil.getdedupset(lob_loc IN CLOB CHARACTER SET ANY_CS)
RETURN dbms_lobutil_dedupset_t DETERMINISTIC;
TBD
 
GETEXTENTS
Undocumented extent expansion dbms_lobutil.getextents(crs IN sys_refcursor)
RETURN dbms_lobutil_lobextents_t DETERMINISTIC PIPELINED;
TBD
 
GETINODE
Undocumented inode query

Overload 1
dbms_lobutil.getinode(lob_loc IN BLOB) RETURN dbms_lobutil_inode_t DETERMINISTIC;
TBD
Overload 2 dbms_lobutil.getinode(lob_loc IN CLOB CHARACTER SET ANY_CS)
RETURN dbms_lobutil_inode_t DETERMINISTIC;
TBD
 
GETLOBMAP
Undocumented LOB map query. Works only with securefiles.

Overload 1

This demo is built to run on the tables created in the SECUREFILES demo
dbms_lobutil.getlobmap(
lob_loc IN BLOB,
n       IN NUMBER)
RETURN dbms_lobutil_lobmap_t DETERMINISTIC;
set serveroutput on

DECLARE
 bvar BLOB;
 x    dbms_lobutil_lobmap_t;
BEGIN
  SELECT bcol
  INTO bvar
  FROM reg_tab
  WHERE rownum = 1;

  x := dbms_lobutil.getlobmap(bvar, 0);
END;
/

DECLARE
 bvar BLOB;
 luty dbms_lobutil_lobmap_t;
BEGIN
  SELECT bcol
  INTO bvar
  FROM sec_tab
  WHERE rownum = 1;

  luty := dbms_lobutil.getlobmap(bvar, 0);

  dbms_output.put_line('LOBID: ' || luty.lobid);
  dbms_output.put_line('Extent Flag: ' || luty.eflag);
  dbms_output.put_line('Extent Hdr: ' || luty.rdba);
  dbms_output.put_line('blocks: ' || luty.nblks);
  dbms_output.put_line('offset: ' || luty.offset);
  dbms_output.put_line('length: ' || luty.length);
END;
/
Overload 2 dbms_lobutil.getlobmap(
lob_loc IN CLOB CHARACTER SET ANY_CS,
n       IN NUMBER)
RETURN dbms_lobutil_lobmap_t DETERMINISTIC;
TBD
 
GETPHYSICALLENGTH (new 23ai)
Returns the LOB length in either bytes or characters (see below);

Overload 1
dbms_lobutil.getPhysicalLength(lob_loc IN BLOB) RETURN INTEGER DETERMINISTIC;
TBD
Overload 2

We suspect length is measured in bytes, rather than characters, but we are unable to prove it as demonstrated
dbms_lobutil.getPhysicalLength(lob_loc IN CLOB) RETURN INTEGER DETERMINISTIC;
SELECT dump(TO_MULTI_BYTE('A'));

DUMP(TO_MULTI_BYTE('A'))
------------------------
Typ=1 Len=3: 239,188,161



DECLARE
 c CLOB := TO_MULTI_BYTE('A');
BEGIN
  dbms_output.put_line(dbms_lobutil.getPhysicalLength(c));
END;
/
*
ORA-22275: invalid LOB locator specified
Overload 3 dbms_lobutil.getPhysicalLength(lob_loc IN JSON) RETURN INTEGER DETERMINISTIC;
TBD

Related Topics
Built-in Functions
Built-in Packages
DBMS_LOB
LOBs
SECUREFILES
What's New In 21c
What's New In 26ai

Morgan's Library Page Footer
This site is maintained by Daniel Morgan. Last Updated: This site is protected by copyright and trademark laws under U.S. and International law. © 1998-2026 Daniel A. Morgan All Rights Reserved