Oracle 表移动后必须做的事
作者:应用开发 来源:IT科技 浏览: 【大中小】 发布时间:2025-11-05 13:52:39 评论数:

移动一张表实际上是表移必须一个重组过程,数据库会将原来的动后数据复制到新的地方。但是表移必须如果你发现这个表在移动后性能下降了,可能是动后你的索引没有重建。本文将指导您找到依赖索引并重建它们。免费源码下载表移必须

;
TABLESPACE_NAME------------------------------EXAMPLESQL> alter table hr.employees move tablespace users;
Table altered.
SQL> select tablespace_name from dba_tables where owner = HR and table_name = EMPLOYEES;
TABLESPACE_NAME------------------------------USERS1.2.3.4.5.6.7.8.9.10.11.12.13.14.15. 查看哪些索引取决于此表 复制SQL> column index_name format a30;
SQL> column tablespace_name format a30;
SQL> column status format a10;
SQL> select index_name, tablespace_name, status from dba_indexes where owner = HR and table_name = EMPLOYEES;
INDEX_NAME TABLESPACE_NAME STATUS------------------------------ ------------------------------ ----------EMP_JOB_IX EXAMPLE UNUSABLEEMP_DEPARTMENT_IX EXAMPLE UNUSABLEEMP_MANAGER_IX EXAMPLE UNUSABLEEMP_NAME_IX EXAMPLE UNUSABLEEMP_EMAIL_UK EXAMPLE UNUSABLEEMP_EMP_ID_PK EXAMPLE UNUSABLE6 rows selected.
1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.如您所见,所有依赖索引都是表移必须UNUSABLE。这意味着,动后数据库不会自动重建它们。表移必须你必须自己做。动后
编写所有重建语句,表移必须然后执行它们 复制SQL> select alter index || owner || . ||index_name || rebuild tablespace users; as SQL_TO_BE_EXECUTED from dba_indexes where owner = HR and 动后table_name = EMPLOYEES;
SQL_TO_BE_EXECUTED--------------------------------------------------------------------------------alter index EMP_JOB_IX rebuild tablespace users;
alter index EMP_DEPARTMENT_IX rebuild tablespace users;
alter index EMP_MANAGER_IX rebuild tablespace users;
alter index EMP_NAME_IX rebuild tablespace users;
alter index EMP_EMAIL_UK rebuild tablespace users;
alter index EMP_EMP_ID_PK rebuild tablespace users;
6 rows selected.
1.2.3.4.5.6.7.8.9.10.11.12.或者您可以重建原始表空间的索引。
复制SQL> select alter index || owner || . ||index_name || rebuild tablespace || tablespace_name || ; as SQL_TO_BE_EXECUTED from dba_indexes where owner = HR and 表移必须table_name = EMPLOYEES;
SQL_TO_BE_EXECUTED--------------------------------------------------------------------------------alter index HR.EMP_DEPARTMENT_IX rebuild tablespace EXAMPLE;
alter index HR.EMP_NAME_IX rebuild tablespace EXAMPLE;
alter index HR.EMP_MANAGER_IX rebuild tablespace EXAMPLE;
alter index HR.EMP_EMP_ID_PK rebuild tablespace EXAMPLE;
alter index HR.EMP_EMAIL_UK rebuild tablespace EXAMPLE;
alter index HR.EMP_JOB_IX rebuild tablespace EXAMPLE;
6 rows selected.
1.2.3.4.5.6.7.8.9.10.11.12.请注意,云南idc服务商我们在新表空间USERS中重建索引。动后也就是表移必须说,对于索引,REBUILD相当于表中的MOVE
重建后检查状态 复制SQL> select index_name, tablespace_name, status from dba_indexes where owner = HR and table_name = EMPLOYEES;
INDEX_NAME TABLESPACE_NAME STATUS------------------------------ ------------------------------ ----------EMP_JOB_IX USERS VALIDEMP_DEPARTMENT_IX USERS VALIDEMP_MANAGER_IX USERS VALIDEMP_NAME_IX USERS VALIDEMP_EMAIL_UK USERS VALIDEMP_EMP_ID_PK USERS VALID6 rows selected.
1.2.3.4.5.6.7.8.9.10.11.12.所有索引都变为VALID,表明所重建的索引有效。
X.Org server 1.5Ubuntu 8.10中装载了最新版本的X.Org,带来了对热插拨设备的更好支持。基本上,它能使得大多数用户不用”/etc/X11/xorg.conf”文件就能正常运行。Linux kernel 2.6.26Alpha 4包含了基于2.6.26.2的内核版本。32位下载地址:http://cdimage.ubuntu.com/releases/intrepid/alpha-4/intrepid-desktop-i386.iso64位下载地址:http://cdimage.ubuntu.com/releases/intrepid/alpha-4/intrepid-desktop-amd64.iso
南航小卫星(南航小卫星为航空业带来的创新和发展)
南航小卫星(南航小卫星为航空业带来的创新和发展)
