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_indexes4、將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;