将索引移动到别的表空间

最开始以为index也可以使用move命令来移动表空间,结果想法错了

alter index index_name rebuild tablespace tablespace_name online nologging parallel;

SQL> select segment_name,segment_type,tablespace_name from user_segments where segment_name='EMP_DEPTNO';

SEGMENT_NAME                                                                      SEGMENT_TYPE       TABLESPACE_NAME
--------------------------------------------------------------------------------- ------------------ ----------------------------
EMP_DEPTNO                                                                        INDEX              MY_INDEX

SQL> alter index emp_deptno rebuild online tablespace users nologging parallel ;

索引已更改。

SQL> select segment_name,segment_type,tablespace_name from user_segments where segment_name='EMP_DEPTNO';

SEGMENT_NAME                                                                      SEGMENT_TYPE       TABLESPACE_NAME
--------------------------------------------------------------------------------- ------------------ -------------------
EMP_DEPTNO                                                                        INDEX              USERS

online ,nologigng ,parallel 可以省略 online表示重建索引时不对原表的dml操作产生影响,nologging只是为了加速索引的创建速度,

parallel也是为了加快索引创建速度,不过使用parallel时要小心,不能在资源不足的情况下使用,否者产生direct path read /write等待事件。

原文地址:https://www.cnblogs.com/hehe520/p/6330658.html