oracle 将表从一个表空间移动到另一个表空间
来源:互联网 发布:tensorflow 推荐系统 编辑:程序博客网 时间:2024/06/06 05:57
1,使用下面的命令移动:
alter table table_name move tablespace tablespace_name;
2,如果有索引的话必须重建索引:
alter index index_name rebuild tablespace tablespace_name;
然,可以使用spool来帮助实现多个表的操作.
set header off;
spool /export/home/oracle/alter_tables.sql;
select 'alter table ' || object_name || ' move tablespace users'
from dba_object
where owner = 'XXX' and object_type = 'TABLE';
spool off;
之后执行此sql脚本即可.
同样对于index也做同样的操作.
查看system表空间下每个对象的大小:
select * from (
select bytes/1024/1024 M,segment_name,segment_type,owner from dba_segments
where tablespace_name = 'SYSTEM'
order by bytes desc
) where rownum < 10
SQL> select OWNER,INDEX_NAME,INDEX_TYPE, TABLE_OWNER, TABLE_TYPE, TABLESPACE_NAME from dba_indexes where TABLE_NAME='T_TROUBLEINFO_TMP' ;
OWNER INDEX_NAME INDEX_TYPE TABLE_OWNER TABLE_TYPE TABLESPACE_NAME
---------- -------------------- ---------- ------------ ----------- ------------------------------
TELECOM PK_TEMP_KEYID NORMAL TELECOM TABLE USERS
TELECOM T_TROUBLEINFO_TMP_IN NORMAL TELECOM TABLE USERS
SQL> set pagesize 49999
SQL> select 'alter table '||segment_name||' move tablespace users;' from dba_segments where owner='TELECOM' and TABLESPACE_NAME='SYSTEM' and segment_type='TABLE';
'ALTERTABLE'||SEGMENT_NAME||'MOVETABLESPACEUSERS;'
--------------------------------------------------------------------------------
alter table T_FIX_TERMINALTYPE move tablespace users;
alter table T_FIX_COI_LOG move tablespace users;
alter table T_FIX_BUSIUSER move tablespace users;
alter table T_FIX_BUSITYPE move tablespace users;
alter table T_FIX_TABLE3 move tablespace users;
alter table T_FIX_TABLE1 move tablespace users;
alter table T_FIX_TABLE2 move tablespace users;
alter table T_CIRUIT_DELIVERY move tablespace users;
alter table IP_MASK_IPNUM move tablespace users;
alter table IP_RESOURCE move tablespace users;
alter table IP_BLOCK move tablespace users;
alter table T_OPERATION_INFO_TMP move tablespace users;
alter table T_OPERATION_INFO move tablespace users;
alter table T_STAT_JOBLIST move tablespace users;
alter table T_STAT_JOBQUERY move tablespace users;
alter table T_TROUBLE_ID_TMP move tablespace users;
alter table T_QUERY_TYPE move tablespace users;
alter table T_QUERY_DICT move tablespace users;
alter table T_QUERY_FIELD move tablespace users;
alter table T_QUERY_INFO move tablespace users;
alter table T_QUERY_MODULE move tablespace users;
alter table T_QUERY_SQES move tablespace users;
alter table T_TROUBLE_WEEK_DIFF move tablespace users;
alter table T_FIX_MEETINGPHONE move tablespace users;
alter table T_HURRY move tablespace users;
alter table T_LINK_LOG move tablespace users;
26 rows selected.
SQL> select 'alter index '||segment_name||' rebuild tablespace users;' from dba_segments where owner='TELECOM' and TABLESPACE_NAME='SYSTEM' and segment_type='INDEX';
'ALTERINDEX'||SEGMENT_NAME||'REBUILDTABLESPACEUSERS;'
--------------------------------------------------------------------------------
alter index PK_GT_W_OPERATION_INFO_WSID rebuild tablespace users;
alter index PK_GT_OPERATION_INFO_GTID rebuild tablespace users;
alter index BAT_IN rebuild tablespace users;
alter index IDX_IP rebuild tablespace users;
alter index IDX_COMMUN_PHONENUMBER rebuild tablespace users;
alter index IDX_COMMUN_PORTNUMBER rebuild tablespace users;
alter index PK_T_OPERATION_INFO rebuild tablespace users;
alter index PK_T_OPERATION_INFO_NEW_TTID rebuild tablespace users;
alter index PK_T_QUERY_TYPE rebuild tablespace users;
alter index PK_T_QUERY_DICT rebuild tablespace users;
alter index PK_T_QUERY_FIELD rebuild tablespace users;
alter index PK_T_QUERY_MODULE rebuild tablespace users;
alter index IDX_SECT_BATCHID rebuild tablespace users;
13 rows selected.
- oracle中如何将一个表从一个表空间中移动到另一个表空间
- oracle中如何将一个表从一个表空间中移动到另一个表空间
- oracle 将表从一个表空间移动到另一个表空间
- 数据表从一个表空间中移动到另一个表空间中
- oracle 用户 从一个表空间 另一个表空间
- oracle如何将数据导入到另一个表空间
- oracle如何将数据导入到另一个表空间
- 将索引移动到别的表空间
- 将索引移动到别的表空间
- How to import an oracle dump in an different tablespace ( 如何将一个包含表空间信息的dmp文件导入到另一个表空间)
- oracle移动表空间
- Oracle表空间-移动
- oracle imp导入数据到另一个表空间
- Oracle imp 导入数据到另一个表空间
- 将当前表空间下的用户的表和索引迁移到另一个表空间
- oracle 表空间迁移,移动表空间
- 将Oracle数据库审计相关的表移动到其他表空间
- Oracle移动表空间命令
- 汇编学习笔记(2)
- PHP之 mb_strimwidth字符串截取函数使用 & UTF8编码认识
- 灵活运用 SQL SERVER FOR XML PATH和SQL Stuff用法
- imagePickerController 拍照内存不足问题。
- android 中发生noclassdefFounderror原因
- oracle 将表从一个表空间移动到另一个表空间
- 升级Flash Builder 4.6中的Flash Player和AIR版本
- redis 资料收集
- 环境变量的配置
- 同事的Excel中做的数据图突然不能选择
- OpenRisc-30-SD card controller模块分析与验证
- oracle 相关
- 跟踪状态(TASK_TRACED)
- springmvc