Skip to Main Content
  • Questions
  • Anyway to Access Data in a Table That Has Been Made Invalid By Dropping an XMLSchema

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, David.

Asked: July 07, 2016 - 8:16 pm UTC

Last updated: July 08, 2016 - 7:46 am UTC

Version: 11G

Viewed 1000+ times

You Asked

Is here anyway to make a table valid again if it has an XMLType column with an XMLSchema associated it which has been deleted via dbms_xmlschema.deleteSchema with a DELETE_INVALIDATE parameter? I cannot even successfully drop the XMLType column from the table afterwards to get at the other column data.

Here's a simple example to get a table in the invalid state.


declare
doc varchar2(3000) := '
<xs:schema xmlns:xs=" http://www.w3.org/2001/XMLSchema"
xmlns:xdb=" http://xmlns.oracle.com/xdb"
version="1.0" xdb:storeVarrayAsTable="true">
<xs:element name="field">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="value" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>';
begin
dbms_xmlschema.registerSchema(
' http://www.something.com/XMLSCHEMA/mvf_string_temp.xsd', doc, FALSE);
end;
/


create table fdd.schematest (
idx_id integer not null,
mvf_string XMLType

)
xmltype column mvf_string
XMLSCHEMA " http://www.something.com/XMLSCHEMA/mvf_string_temp.xsd"
element "field"
tablespace fcb
storage
(
initial 10k
next 10k
)
;
/
begin
dbms_xmlschema.deleteSchema(
' http://www.something.com/XMLSCHEMA/mvf_string_temp.xsd', dbms_xmlschema.DELETE_INVALIDATE);
end;
/
select idx_id from fdd.schematest;
/

and Chris said...

Sorry, I don't think there's a way to access the table again :(

If you need the data from other columns you're going to have to go to a backup. Or you could try talking to support to see if there's anything they could do to help.

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

More to Explore

Analytics

Analytic SQL got you confused? Check out Connor McDonald's complete video course.