Oracle Tablespace迁移

1、查找数据库文件对应的File_ID:select * from dba_data_files


2、查询当前表空间中的所有表:select distinct segment_name  from dba_extents where segment_type='TABLE' and file_id='82'


3、查询当前表空间中的所有索引:select distinct segment_name  from dba_extents wheresegment_type='INDEX' and file_id='82'

 

4、如果有分区表,则查询当前表空间中的所有的分区表:  

 select distinct segment_name from dba_extents where segment_type='TABLE PARTITION' and file_id=14 

5、查询当前表空间中的所有分区表的索引:  

select distinct segment_name from dba_extents where segment_type='INDEX PARTITION' and file_id=14;   

6、移动表到指定表空间(需要注意的是:Move命令不支持Long型字段 )  

   alter table Tbl_Name move tablespace New_TableSpaceName;   

 

7、重建表的索引   

   alter index Index_Name rebuild tablespace New_TableSpaceName;   

 

8、移动BLOB、CLOB的字段到指定表空间   

    alter table Tbl_Name move lob(BLOB1,BLOB2,BLOB3,......) store as (tablespace  New_TableSpaceName);   

 

9、移动BLOB、CLOB的字段语法   

   alter table table_name move [tablespace tbs_name] lob(lob_field1,lob_field2) store as (tablespace new_tbs_name);   

 

10、如果LOB字段在分区表中,则增加partition关键字,如   

 alter table table_name move [partition partname] [tablespace tbs_name] lob(field) store as (tablespace new_tbs_name); 

 

注:上面案例主要是开发人员在创建表的时候,表空间误选系统表空间:USRES

可用select * from all_tables去查看


你可能感兴趣的:(Oracle管理)