Skip to Main Content
  • Questions
  • CTAS returns ORA-31011: XML parsing failed

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Razvan.

Asked: January 20, 2017 - 5:58 pm UTC

Last updated: January 25, 2017 - 1:43 am UTC

Version: 12.1.0.2

Viewed 1000+ times

You Asked

Hi Tom.

I've investigating on reasons why getting ORA-31011 when issuing CTAS from dba_hist_sqlbind.

Instruction failing:

create table sqlbind_table
tablespace TBS_NAME
as
select *
from dba_hist_sqlbind;

Raises:
ERROR at line 14:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00007: unexpected end-of-file encountered


Issue appears to come from the VALUE_ANYDATA column of ANYDATA data type as CTAS from all columns except VALUE_ANYDATA succeeds.

Behavior only comes from instance that has been upgraded from 10.2.0.5 to 12.1.0.2

I've also captured errostack for ORA-31011 but couldn't match any stack from MOS search. File is 20 MB but could extract info to upload here if needed.

Would appreciate any directions to investigate.

Best regards,
Razvan

and Connor said...

Perhaps look at doing something like this:

SQL> create table sqlbind_table
  2  as
  3  select *
  4  from dba_hist_sqlbind
  5  where 1=0;

Table created.

SQL>
SQL>
SQL> set serverout on
SQL> begin
  2  for i in ( select * from dba_hist_sqlbind )
  3  loop
  4    begin
  5      insert into sqlbind_table values i;
  6    exception
  7       when others then
  8          dbms_output.put_line('aggghhh');
  9    end;
 10  end loop;
 11  end;
 12  /

PL/SQL procedure successfully completed.



which is a 1-row-at-a-time operation so you can isolate the exact row(s) causing the error. I'm assuming its a data related problem, because as you can see from my test above, I had no problems.

One the bad data has been isolated - then comes the decision as to what to do about it. If its small volume, or obsolete, consider purging it.

Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Super workaround

Razvan Balu, January 24, 2017 - 7:44 pm UTC

Hi Connor,

Thanks for the workaround. It worked.
Funny though that resulting table got more rows than the original one, don't know why.
I was curious on why it was raising the error, but don't know if I'll find it out. :)
Connor McDonald
January 25, 2017 - 1:43 am UTC

Hmmm....so it didnt fall over on the 1-row-at-a-time version ?

That's interesting

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library