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去查看


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值