我目前正在对数据库上的现有表进行分区。其中一些具有 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 似乎阻止了它。这里有人有同样经历吗
我也有同样的问题。你能解决这个问题还是我必须将列类型更改为 CLOB?