如果你将创建表和索引创建在USERS表空间下了,(注:在USERS表空间中是合理的),那么在以后的维护中将会出现很多麻烦。
如果是oltp系统无法删除重建,所以必须考虑在不影响使用的情况下做该项工作。
◆1、知道命令:
alter table table_name move tablespace tablespace_name;
所以考虑这个方向:
select ''alter table '' || table_name || '' move tablespace tablespace_name;'' from user_tables where tablespace_name = ''USERS'' |
得到该连接用户下所有创建在USERS表空间下的表名。
◆2、执行所得到的语句,至此将表转移到新表空间中。
◆3、重建索引
得到重建索引语句
SELECT ''alter index ''||index_name||'' rebuild tablespace tablespace_name storage(¡¡);'' FROM USER_INDEXES T where t.table_owner=''USER_NAME'' and t.tablespace_name=''USERS'' |
◆4、执行得到的语句,将索引转移到新表空间。
注释:在此过程中全文索引的转移会出错,大家可以忽略不计。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/14465197/viewspace-429500/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/14465197/viewspace-429500/