title: Oracle validate XML through XSD: ORA-04030: out of process memory when trying to allocate 1032 bytes
body: <p>I am trying to validate an XML through XSD using Oracle PL/SQL. It works on smaller files, but not with bigger ones. I get the following error:</p>
  
  <p><a href="http://i.stack.imgur.com/rVu7m.png" rel="nofollow">1</a>: ORA-04030: out of process memory when trying to allocate 1032 bytes (qmxlu subheap,qmemNextBuf:alloc)</p>
  
  <p>I search and it is supposed to be because of the parameter PGA_AGGREGATE_TARGET, which according to our DBAs it is: </p>
  
  <pre><code>pga_aggregate_target                 integer  0
  </code></pre>
  
  <p>As can be seen it is unlimited and the xml file I am trying to validate is 500 MB.</p>
  
  <p>What is causing this error? How can I fix it? </p>
  
  <p>Here is my code, my expected output is "valid":</p>
  
  <pre><code>DECLARE
     v_schema_url   VARCHAR2 (200) := 'Test.xsd';
     v_blob         BLOB;
     v_clob         CLOB;
     v_xml          XMLTYPE;
     xml_file BFILE;
     xmlClob CLOB;
  
     src_offset number := 1 ;
     dest_offset number := 1 ;
     lang_ctx number := DBMS_LOB.DEFAULT_LANG_CTX;
     warning integer;
     res integer;
  BEGIN
     dbms_xmlschema.deleteschema(v_schema_url); 
     DBMS_XMLSCHEMA.registerschema (schemaurl   =&gt; v_schema_url,
                                    schemadoc   =&gt; bfilename ('DIR_XSD','Test.xsd'),
                                    local       =&gt; TRUE);
     xml_file := BFILENAME('DIR_XSD', 'test.xml');
     DBMS_LOB.CREATETEMPORARY(xmlClob, true);
     DBMS_LOB.FILEOPEN(xml_file, DBMS_LOB.FILE_READONLY);
     DBMS_LOB.LOADCLOBFROMFILE(xmlClob, xml_file, DBMS_LOB.LOBMAXSIZE, src_offset,
                               dest_offset, DBMS_LOB.DEFAULT_CSID, lang_ctx, warning);
  
     v_xml := XMLType.createXML(xmldata=&gt;xmlClob,schema=&gt;v_schema_url);
  
     DBMS_LOB.FILECLOSEALL();
     DBMS_LOB.FREETEMPORARY(xmlClob);
  
     v_xml.schemaValidate(); --it fails here
  
     IF v_xml.isschemavalid (v_schema_url) = 1 THEN
        DBMS_OUTPUT.put_line ('valid');
     ELSE
        DBMS_OUTPUT.put_line ('not valid');
     END IF;
  END;
  </code></pre>