oracle修改表空间

1、其中表中查找该表空间不正确

select * from dba_tables where tablespace_name='TDB';

2、将表空间在 TDB 中的移到表空间 TDB2009 中

语法是:alter table table_name move tablespace tablespace_name;

alter table tdb2009.ASSOC_INFO move tablespace TDB2009;
alter table tdb2009.BGUSERPOPD move tablespace TDB2009;

3、将索引换到还有一个表空间

alter index PK_WS_ACCESS_LOG_DETAIL rebuild online nologging tablespace rpt03;

将把一个表空间的全部索引换到还有一个表空间呢

select 'alter index ' || index_name || ' move tablespace TDB2009;' from user_indexes

select 'alter index TDB2009.'||index_name||' rebuild online nologging tablespace TDB2009;' from user_indexes

4、将lob字段的表空间移新表空间

语法是:ALTER TABLE 表名 MOVE LOB(lob字段名) STORE AS (TABLESPACE 新表空间名);

ALTER TABLE ws_access_log MOVE LOB(req_content) STORE AS (TABLESPACE rpt03);
ALTER TABLE ws_access_log MOVE LOB(resp_content) STORE AS (TABLESPACE rpt03);

备注:查询

select * from dba_data_files;
select * from dba_lobs where tablespace_name='USERS';
select * from dba_segments where segment_name in('SYS_LOB0000335629C00004$$','SYS_LOB0000335629C00014$$','SYS_LOB0000335635C00006$$','SYS_LOB0000335635C00008$$');
select dbms_metadata.get_ddl('TABLE','WS_ACCESS_LOG','USMM') from dual;



版权声明:本文博主原创文章,博客,未经同意不得转载。

原文地址:https://www.cnblogs.com/mengfanrong/p/4913080.html