Oracle 12.2 - 尝试使用 XMLTYPE 列对表进行分区时出现 ORA-14427

问题描述 投票:0回答:2

我目前正在对数据库上的现有表进行分区。其中一些具有 XMLType 列,并且 ALTER TABLE .. MODIFY PARTITION BY RANGE ... ONLINE 似乎不适用于这些表。

我已经测试了以下场景:使用 XMLType 列创建表,尝试对其进行分区(失败),删除 XMLTYpe 列,然后可以对表进行分区:

create table t_tab (t_id number (38) generated always as identity primary key,
t_content xmltype,
t_date date);
--Table T_TAB created.

insert into t_tab (t_content, t_date)
values ('<xml>
<item>
    <A>'||'A'||'</A>
    <B>'||'B'||'</B>
</item></xml>', 
sysdate);
insert into t_tab (t_content, t_date)
values ('<xml>
<item>
    <C>'||'C'||'</C>
    <D>'||'D'||'</D>

</item></xml>', 
sysdate-77);
insert
into t_tab (t_content, t_date)
values ('<xml>
<item>
    <E>'||'E'||'</E>
    <F>'||'F'||'</F>

</item></xml>', 
sysdate-40);
commit;
--1 row inserted.
--1 row inserted.
--1 row inserted.
--Commit complete.


ALTER TABLE t_tab MODIFY
     PARTITION BY RANGE (
          t_date
     ) INTERVAL ( numtoyminterval(1,'MONTH') ) ( PARTITION PRT_START
          VALUES LESS THAN ( TO_DATE('2007-10-01 00:00:00','YYYY-MM-DD HH24:MI:SS'
          ) )
     )
ONLINE;
--ORA-14427: table does not support modification to a partitioned state DDL.

alter table t_tab drop column t_content;
--Table T_TAB altered.

ALTER TABLE t_tab MODIFY
     PARTITION BY RANGE (
          t_date
     ) INTERVAL ( numtoyminterval(1,'MONTH') ) ( PARTITION PRT_START
          VALUES LESS THAN ( TO_DATE('2007-10-01 00:00:00','YYYY-MM-DD HH24:MI:SS'
          ) )
     )
ONLINE;
--Table T_TAB altered.

select table_name, partitioned from dba_tables where table_name='T_TAB';
T_NAME   IS_PRT
-------- ---
T_TAB    YES

我希望对这些表进行分区,但 XMLType 似乎阻止了它。这里有人有同样经历吗

xml oracle partitioning xmltype
2个回答
0
投票

ORA-14427
错误意味着该表已经分区。您可能希望使用不同的表名称再次调用每个命令。当我在 DB Fiddle 中运行你的语句时,我得到一个
ORA-00922
(缺少或无效选项)。检查你的语法。


-1
投票

我也有同样的问题。你能解决这个问题还是我必须将列类型更改为 CLOB?

© www.soinside.com 2019 - 2024. All rights reserved.