今天在做xtts迁移的时候碰到了个数据库报错,现将信息整理如下:
检查表空间的自包含情况:
execute sys.dbms_tts.transport_set_check('XXX,XXX,XXX', true);
检查是否有报错信息:
select * from sys.transport_set_violations;
发现大量如下报错:
ORA-39943: Global index XXX in tablespace XXX has orphaned entries.
发现索引里面有孤儿数据,大致有下面几个方法:
1 能确定索引没什么用,删了了事。
2 对索引进行清理:
alter index coalesce cleanup parallel 5;
并行度根据实际情况设置
3 重建索引:
alter index rebuild online parallel 4;
下面是参考的mos文档信息:
Transportable Tablespaces (TTS) Export Failed WITH ORA-39943: Global index XXX in tablespace YYY has orphaned entries. (Doc ID 3005636.1)
文档内容如下:
APPLIES TO:
Oracle Database - Enterprise Edition - Version 19.19.0.0.0 and later
Information in this document applies to any platform.
SYMPTOMS
Errors during TTS export:
ORA-39123: Data Pump transportable job aborted
ORA-39187: The transportable set is not self-contained, violation list is:
ORA-39943: Global index in tablespace has orphaned entries.
job "SYS"."SYS_EXPORT_TRANSPORTABLE_01" stopped due to fatal error.
CHANGES
N/A
CAUSE
Tablespace has orphaned entries.
SOLUTION
alter index coalesce cleanup parallel 5;
exec dbms_part.cleanup_gidx('');
ERROR as line 1:
ORA-20000: No global index segments were cleaned
ORA-06512: at "SYS.DBMS_PART", line 225
ORA-06512: at "SYS.DBMS_PART", line 290
ORA-06512: at line 1
Testing internally demonstrated that the aforementioned solution is effective, but it did not prove successful for one customer.
If the above does not work, then use the solution below.
alter index rebuild online parallel 4;
After rebuilding the index, sys.dbms_tts.transport_set_check returned no errors.
SQL> EXEC sys.dbms_tts.transport_set_check('TBS1,TBS2',TRUE); >>>>>>>>>>>>replace with your tablespace names.
SQL> select * from sys.transport_set_violations;