ORA-04030 Building an XMLIndex After Moving to Oracle 26ai: 333 MB on 19c, Out of Memory at 32 GB on 26ai

ORA-04030 building an XMLIndex after moving from Oracle 19c to 26ai: 333 MB vs 31.9 GB

During a trial migration from Oracle Database 19c to Oracle AI Database 26ai, one step that had always worked suddenly failed: building an XMLIndex on a large table of XMLType records. The server had well over 100 GB of RAM and generous PGA settings, yet the build ended with ORA-04030: out of process memory.

This post walks through how I traced it: ruling out the usual suspects, finding the one memory heap that grew, and reproducing it with synthetic data only, so you can run the same test yourself. Then it covers the workaround that let the migration continue.

TL;DR
  • Same data, same index, two versions: on 19c (19.27) the build over 1.2 million rows used 333 MB of PGA and finished in 5 min 46 s. On 26ai (23.26.1) it grew to 32,651 MB and failed with ORA-04030 after 7 minutes.
  • It grows with every row: about 33.5 KB of PGA per row, held until the build ends. 25,000 rows needed 839 MB, 100,000 rows 3,278 MB. On my server the process gave up at about 32 GB, which means roughly a million rows.
  • It is not a configuration problem: the 26ai server had more RAM and 2.7 times the PGA target and limit of the 19c one. 99% of the memory sat in a single XML DB heap (qmixm).
  • PARALLEL does not help: with PARALLEL 4 or 8 Oracle starts the parallel servers, but the XML work and its 3.3 GB stay in the coordinator session, and the build is no faster.
  • Workaround: create the XMLIndex on the empty table, then load the rows. The index is maintained row by row and the load used only 8–9 MB of PGA on both versions.
  • Scope: unstructured XMLIndex (PATHS (INCLUDE ...)) on CLOB-stored XMLType, tested on the base 23.26.1 release. A later Release Update may behave differently.

The symptom

The application stores each record as an XMLType column with CLOB storage, and has an unstructured XMLIndex on one path inside the document. After moving the data to 26ai, creating that index failed:

CREATE INDEX app.records_c1 ON app.records (xmlrecord)
  INDEXTYPE IS XDB.XMLINDEX PARAMETERS ('PATHS (INCLUDE (/row/c1))');

ORA-29958: ODCI_FATAL returned by the implementation of the ODCIINDEXCREATE routine
ORA-29400: data cartridge error
ORA-04030: out of process memory

On 19c the same statement, on the same data, had always completed in a few minutes.

Step 1: ruling out the usual suspects

ORA-04030 means one server process could not get more memory. Usually the cause is outside Oracle, so I checked the operating system and the instance first:

CheckResultVerdict
Free memory on the server146 GB RAM, about 60 GB freeNot short of RAM
vm.overcommit_memory0 (default heuristic mode)Kernel not refusing allocations
Process limits (/proc/<pmon pid>/limits, ulimit -a)Data size and address space unlimitedNot an OS limit
Memory managementASMM (sga_target), no memory_targetNot an AMM ceiling
pga_aggregate_limit80 GB; the process failed at about 32 GBNot the limit (that would raise ORA-04036)
vm.max_map_countRaised to 1,048,576, retriedNo change

Step 2: where did the memory go?

In 23ai and 26ai, the ORA-04030 line in the alert log no longer names the heap. The detail is in the incident trace, in its TOP 10 MEMORY USES section:

F=$(ls -t $ORACLE_BASE/diag/rdbms/*/*/incident/*/*.trc | head -1)
grep -n -A15 "TOP 10 MEMORY USES" $F

TOP 10 MEMORY USES FOR THIS PROCESS
---------------------------------------
99%   31 GB, 8085302 chunks: "qmixm.c:1116:qmem         "
         qmixmATF:xdk
 1%  394 MB, 33061 chunks: "free memory               "
         qmixmATF:xdk
 0%   32 MB,  28 chunks: "free memory               "
         top uga heap

That settles where the memory went: 99% of the process, 31 GB in about 8 million small chunks, was in one XML DB / XDK heap (qmixm), and none of it had been freed. It was not a sort or a hash join, so Oracle's normal PGA controls (global memory bound was 1 GB, over allocation count stayed 0) never applied to it.

XMLIndex bulk build filling the XML heap until ORA-04030, vs index-first load at 9 MB

The animation shows the two ways to get the same index. In a bulk build, every row leaves about 33.5 KB behind in the heap until the very end, so a big enough table always runs out of memory. Create the index on an empty table and load afterwards, and each insert only does its own row's work; the measured peak stays at 8–9 MB. Both are covered in detail below.

Step 3: a testing trap (CTAS changes the XML storage)

My first comparison used CREATE TABLE ... AS SELECT to copy part of the table, and it looked fine on both versions. It was not a fair test: CTAS creates new XMLType columns with binary XML storage by default, not CLOB. On 26ai, the PATHS (INCLUDE ...) option is even rejected on that storage (ORA-30956). To compare like for like, the test table must say STORE AS CLOB explicitly, and you should check it:

SELECT table_name, storage_type FROM dba_xml_tab_cols WHERE owner = 'XMLREPRO';

Step 4: reproducing it with synthetic data

To prove the problem without any application data, I wrote a self-contained script (full script at the end). It creates a schema with no password (NO AUTHENTICATION), a CLOB XMLType table, and loads synthetic records of 60 elements each (about 3 KB). DBMS_RANDOM.SEED(42) makes the data identical on every version. Then it builds the same XMLIndex in a fresh session and reads the session's peak PGA:

SELECT n.name, ROUND(m.value / 1048576) AS mb
  FROM v$mystat m JOIN v$statname n ON n.statistic# = m.statistic#
 WHERE n.name IN ('session pga memory', 'session pga memory max');

I ran it on two servers with the same OS and CPU count, at different row counts:

RowsXML size19c (19.27)26ai (23.26.1)
25,00070 MBnot run839 MB, created in 7.8 s
50,000140 MBnot run1,673 MB, created in 17.8 s
100,000280 MB35 MB, created in 29.3 s3,278 MB, created in 31.7 s
1,200,0003.4 GB333 MB, created in 5 min 46 s32,651 MB, ORA-04030 after 7 min 4 s

Peak PGA of the XMLIndex build by row count, Oracle 19c vs 26ai

Two things stand out. First, on 26ai the memory grows in exact proportion to the rows: 839 / 25,000, 1,673 / 50,000 and 3,278 / 100,000 all come to about 33.5 KB per row. The same 3,278 MB appeared with the real application data too, so it depends on the number of rows, not on what is inside the XML. Second, the synthetic 1.2 million row run failed with exactly the same error stack as the real migration.

Watching it happen

During the 1.2 million row builds I sampled the largest process in V$PROCESS every 10 seconds on both servers. On 26ai the build process climbed by about 1 GB every 10 seconds until it hit about 32 GB and failed. On 19c it never went above a few hundred MB:

PGA of the XMLIndex build on 19c (333 MB) vs 26ai (fails at 31.9 GB)

The monitoring loop I used (click to expand)
while true; do
  sqlplus -s / as sysdba <<'EOF'
set pagesize 0 feedback off heading off
select to_char(sysdate,'HH24:MI:SS') || '   ' ||
       lpad(round(pga_alloc_mem/1048576),8) || ' MB allocated   ' ||
       lpad(round(pga_max_mem/1048576),8)   || ' MB max   ' ||
       nvl(regexp_substr(program, '\(.*\)'), 'server process')
  from (select * from v$process order by pga_alloc_mem desc)
 where rownum = 1;
EOF
  sleep 10
done

It is not the configuration

The obvious objection is “maybe 26ai just had less memory”. It had more:

19c server26ai server
OS / vCPUsRHEL 9.8 / 16RHEL 9.8 / 16
RAM107 GB146 GB
Database19.27 (April 2025 RU), non-CDB23.26.1 (base Gold Image), CDB with one PDB
XDB component19.27, VALID23.26.1, VALID
sga_target53 GB70 GB
pga_aggregate_target / limit15 GB / 30 GB40 GB / 80 GB (same in CDB root and PDB)
global memory bound1,024 MB1,024 MB
Maximum PGA allocated (V$PGASTAT)4,290 MB for the whole instance since startup32,892 MB in the PDB, from this one test

So 26ai had 2.7 times the PGA target and limit, more RAM, and a valid XML DB, and still could not build an index that 19c builds in 333 MB.

Does a parallel build help? No

The first idea most DBAs would try is to spread the build across parallel servers, so that no single process holds all the memory. I tested it with the same 100,000 synthetic rows on 26ai, building the index serially, then with PARALLEL 4 and PARALLEL 8, and sampling every parallel server's PGA:

PARALLEL 4 and 8 do not reduce the XMLIndex build memory on Oracle 26ai

100,000 rows on 26aiSerialPARALLEL 4PARALLEL 8
Build time32.8 s31.6 s31.5 s
DDL Parallelized (V$PQ_SESSTAT)01 (4 servers)1 (8 servers)
Coordinator session, peak PGA3,310 MB3,267 MB3,267 MB
Largest parallel server, peak PGAn/a9 MB12 MB

Oracle accepts the clause and does start the parallel servers, but the XML processing, and all of its memory, stays in the coordinator session. The build is not even faster. So for a large table, PARALLEL would still put the whole ~33.5 KB per row into one process and fail the same way.

The workaround: create the index first, then load

The memory is consumed by the bulk build of the index. So the script's Part B tries the other order: create the XMLIndex on the empty table, then load the rows (committing every 10,000). Each insert then maintains the index for its own row only:

Workaround runPeak PGA of the load sessionLoad time
19c, 100,000 rows8 MB4 min 9 s (2 min 56 s without the index)
26ai, 25,000 rows9 MB59 s (42 s without the index)
26ai, 50,000 rows9 MB2 min 0 s (1 min 23 s without the index)

The memory problem disappears; the price is a load that is roughly 40% slower, because every row also updates the index. For a Data Pump migration the same idea means importing the metadata first, so the index exists on the empty table, and then importing the data separately (in my trial, in batches). Test the timing with your own volumes before relying on it.

The long-term direction. Oracle's 26ai documentation states that unstructured XML indexes are deprecated and superseded by XML search indexes, and recommends recreating them as XML search indexes used together with Transportable Binary XML storage. The workaround gets a migration through; for the longer term, plan to test that alternative for indexes like this one.

If you hit this

  1. Check the incident trace for the TOP 10 MEMORY USES section. If one qmixm XML heap holds nearly all the memory, it is very likely the same problem.
  2. Run the reproduction script below on a test database with a small row count, on your current release.
  3. Open an SR with Oracle Support and attach the script and its output: it reproduces with generated data, so Support can run it themselves. Also ask whether a later 23.26 Release Update contains a fix; my test used the base 23.26.1 release.
  4. Meanwhile, use the index-first workaround for migrations and rebuilds. Do not rely on PARALLEL: it does not reduce the memory of the build.

The scripts

All scripts are read-only for your existing data. The reproduction creates its own schema (no password) in the tablespace you choose, and drops it at the end. On 26ai, set CONT to your PDB name and TBS to a tablespace with about 1.5 GB free (8 GB for 1.2 million rows).

xmlindex_repro.sql: synthetic reproduction, Part A (index build) and Part B (workaround)
-- =====================================================================
-- xmlindex_repro.sql
-- Synthetic reproduction: unstructured XMLIndex on CLOB XMLType,
-- Oracle 19c vs Oracle AI Database 26ai (23.26).
-- Uses only generated data - no application or customer data.
-- No password anywhere: the test schema uses NO AUTHENTICATION.
--
-- Part A: build the index on a loaded table   (the step that failed)
-- Part B: create the index on the EMPTY table, then load in batches
--         (the workaround)
--
-- Run:  sqlplus /nolog @xmlindex_repro.sql | tee xmlindex_repro_<version>.log
-- PDB:  REQUIRED on 23ai/26ai: set CONT below to your PDB name (e.g. define CONT = MYPDB).
--       For a 19c non-CDB, leave CONT = NONCDB. For a 19c CDB, set your PDB name.
--       (The script writes a one-line helper file xmlrepro_switch.sql in the current directory.)
-- Rows: change ROWS below (100000 rows is about 300 MB of XML).
-- TBS:  an existing non-SYSTEM tablespace with about 1.5 GB free (test data goes there).
-- =====================================================================

define ROWS = 100000
define TBS  = USERS
define CONT = MYPDB

set serveroutput on linesize 200 pagesize 100 feedback on verify off
whenever sqlerror continue

-- ---------------------------------------------------------------------
-- helper: switch to the PDB unless CONT = NONCDB
-- ---------------------------------------------------------------------
connect / as sysdba
set termout off heading off feedback off pagesize 0 trimspool on
spool xmlrepro_switch.sql
select case when '&CONT' = 'NONCDB' then 'prompt (non-CDB: no container switch)'
            else 'alter session set container = &CONT;' end from dual;
spool off
set termout on heading on feedback on pagesize 100
@xmlrepro_switch.sql
show con_name

prompt === Environment ===
select banner_full from v$version;
column name format a24
column value format a20
select name, display_value as value from v$parameter
 where name in ('pga_aggregate_target', 'pga_aggregate_limit', 'sga_target', 'compatible')
 order by name;

-- ---------------------------------------------------------------------
-- schema without a password (18c and later)
-- ---------------------------------------------------------------------
drop user xmlrepro cascade;
create user xmlrepro no authentication default tablespace &TBS quota unlimited on &TBS;
-- the XMLIndex build creates its own path table and objects in the index owner schema
grant resource, create view to xmlrepro;
select username, default_tablespace from dba_users where username = 'XMLREPRO';

-- CLOB storage stated explicitly: new tables otherwise default to binary XML,
-- which does not reproduce the issue (and on 23ai rejects PATHS (INCLUDE ...)
-- with ORA-30956).
create table xmlrepro.xml_records_a (
  recid     varchar2(30) not null primary key,
  xmlrecord xmltype)
  xmltype column xmlrecord store as clob;

create table xmlrepro.xml_records_b (
  recid     varchar2(30) not null primary key,
  xmlrecord xmltype)
  xmltype column xmlrecord store as clob;

column table_name format a15
column storage_type format a22
select table_name, storage_type from dba_xml_tab_cols where owner = 'XMLREPRO' order by 1;

-- =====================================================================
-- PART A: load the table, then build the index (the failing case)
-- =====================================================================
prompt === Part A: loading &ROWS synthetic XML records (60 fields each, about 3 KB) ===
set timing on
declare
  v varchar2(32767);
begin
  dbms_random.seed(42);              -- identical data on every version
  for i in 1 .. &ROWS loop
    v := '<row id="' || i || '">';
    for c in 1 .. 60 loop
      v := v || '<c' || c || '>' || dbms_random.string('X', 20 + mod(i * c, 40)) || '</c' || c || '>';
    end loop;
    v := v || '</row>';
    insert into xmlrepro.xml_records_a values ('REC' || lpad(i, 9, '0'), xmltype(v));
    if mod(i, 10000) = 0 then commit; end if;
  end loop;
  commit;
end;
/
set timing off

select count(*) as row_count,
       round(sum(dbms_lob.getlength(x.xmlrecord.getclobval())) / 1048576) as xml_mb
  from xmlrepro.xml_records_a x;

prompt === Part A: building the XMLIndex in a fresh session ===
connect / as sysdba
@xmlrepro_switch.sql
set timing on
create index xmlrepro.xml_records_a_c1 on xmlrepro.xml_records_a (xmlrecord)
  indextype is xdb.xmlindex parameters ('PATHS (INCLUDE (/row/c1))');
set timing off

prompt === Part A result: PGA used by the index build session ===
column stat format a26
select n.name as stat, round(m.value / 1048576) as mb
  from v$mystat m join v$statname n on n.statistic# = m.statistic#
 where n.name in ('session pga memory', 'session pga memory max');

-- =====================================================================
-- PART B (workaround): index on the EMPTY table, then load in batches
-- =====================================================================
prompt === Part B: creating the XMLIndex on the empty table, then loading (fresh session) ===
connect / as sysdba
@xmlrepro_switch.sql
set timing on
create index xmlrepro.xml_records_b_c1 on xmlrepro.xml_records_b (xmlrecord)
  indextype is xdb.xmlindex parameters ('PATHS (INCLUDE (/row/c1))');

declare
  v varchar2(32767);
begin
  dbms_random.seed(42);              -- same data as Part A
  for i in 1 .. &ROWS loop
    v := '<row id="' || i || '">';
    for c in 1 .. 60 loop
      v := v || '<c' || c || '>' || dbms_random.string('X', 20 + mod(i * c, 40)) || '</c' || c || '>';
    end loop;
    v := v || '</row>';
    insert into xmlrepro.xml_records_b values ('REC' || lpad(i, 9, '0'), xmltype(v));
    if mod(i, 10000) = 0 then commit; end if;   -- batches of 10,000 rows
  end loop;
  commit;
end;
/
set timing off

prompt === Part B result: PGA used by the load session (index maintained during load) ===
select n.name as stat, round(m.value / 1048576) as mb
  from v$mystat m join v$statname n on n.statistic# = m.statistic#
 where n.name in ('session pga memory', 'session pga memory max');

prompt === Part B check: rows loaded and both indexes valid ===
select count(*) as rows_in_b from xmlrepro.xml_records_b;
column index_name format a20
select index_name, table_name, status, domidx_status, domidx_opstatus
  from dba_indexes where owner = 'XMLREPRO' and index_type = 'DOMAIN' order by 1;

-- =====================================================================
prompt === Cleanup ===
drop user xmlrepro cascade;
host rm -f xmlrepro_switch.sql
exit
pga_compare.sql: PGA settings and statistics
-- pga_compare.sql : PGA settings and statistics (read-only)
set linesize 200 pagesize 100 feedback off verify off
column con       format a10
column name      format a32
column value     format a20
column ismod     format a10
column stat      format a40

prompt ===== Version =====
select banner_full from v$version;

prompt ===== Current container =====
show con_name

prompt ===== Memory / PGA parameters in this container =====
select sys_context('USERENV','CON_NAME') con, name, display_value value, ismodified ismod
  from v$parameter
 where name in ('pga_aggregate_target','pga_aggregate_limit','memory_target','memory_max_target',
                'sga_target','sga_max_size','workarea_size_policy','processes','compatible')
 order by name;

prompt ===== PGA statistics (V$PGASTAT) =====
select name stat,
       case when unit = 'bytes' then round(value/1048576) || ' MB' else to_char(value) end value
  from v$pgastat
 where name in ('aggregate PGA target parameter','aggregate PGA auto target','global memory bound',
                'total PGA inuse','total PGA allocated','maximum PGA allocated',
                'over allocation count','max processes count','PGA memory freed back to OS')
 order by name;
exit

For the 1.2 million row test I ran Part A only (delete the Part B section and set ROWS = 1200000), in the background with nohup sqlplus /nolog @xmlindex_oom.sql > xmlindex_oom.log 2>&1 &. The load takes about 35 minutes; watch the build with the monitoring loop above.

Summary

On Oracle AI Database 26ai 23.26.1, building an unstructured XMLIndex on CLOB-stored XMLType holds about 33.5 KB of PGA per row in one XML heap until the build ends. 19c builds the same index on the same 1.2 million rows with 333 MB; 26ai fails with ORA-04030 at about 32 GB, on a server with more memory and larger PGA settings. Creating the index before loading the data avoids the problem at the cost of a slower load. If you are planning a 19c to 26ai migration with XMLType data, test your XMLIndex builds at full size before the cutover, not after.

Tested by me on two RHEL 9.8 servers (16 vCPUs each): Oracle Database 19c 19.27 and Oracle AI Database 26ai 23.26.1. All test data is synthetic; no application or customer data is used or shown, and names are placeholders. Results apply to the versions tested; a later Release Update may behave differently. Test in a non-production database.

Tamilselvan Perumal is an Oracle ACE Associate and Senior DBA with 12+ years in banking databases, working on database performance and benchmarking. Connect on LinkedIn.