修改表所在的表空间以下所示:oracle
A、单个修改:ui
alter table TABLE_NAME(表名) move tablespace TABLESPACENAME(其余表空间名) spa
B、批量修改索引
①查询当前用户下的全部表 table
select 'alter table '|| table_name ||' move tablespace tablespacename;' from user_all_tables; select
②生成脚本——执行全部查询出的语句数据类型
C、补充:语法
select 'alter table '|| table_name ||' move tablespace SMS_WORK;' from user_all_tables where tablespace_name !='SMS_WORK';数据
修改索引所在的表空间以下所示:脚本
A、oracle移动普通索引到其余表空间语法:(单个修改)
alter index 索引名 rebuild tablespace 其余表空间;
例:alter index ID rebuild tablespace GP_INDEX;
B、使用脚本执行查询的结果,这样就能够批量处理
①查询当前用户下的全部索引:
select 'alter index '|| index_name ||' rebuild tablespace GP_INDEX(索引表空间);' from user_indexes;
②生成脚本——执行全部查询出的语句
注意:
若是索引的所在列的数据类型为lob,则没法迁移索引,迁移时会报错:没法以数据类型 LOB 的表达式建立索引