Oracle 11g 修改表的所属表空间
应领导要求,需要将部分表的所属表空间进行更改,目的为了整理用户。
- 查询owner下 对于表级别的表空间分类
select tablespace_name,count(*) from dba_tables where owner = 'XXX' group by tablespace_name order by 2;
- 核对上面的数量情况
select * from dba_tables where owner = 'XXX' and tablespace_name = 'USERS';
- 查看每张表的基本信息
select table_name,num_rows from dba_tables where owner = 'XXX' and tablespace_name = 'USERS' order by 2 desc;
- 查询需要move表的详细信息
select t.table_name as "表名",
t.num_rows as "表行数",
nvl(s.partition_name, 0) as "分区名",
s.segment_type "段类型",
s.bytes / 1024 / 1024 as "段大小(MB)"
FROM dba_tables t, dba_segments s
where t.table_name = s.segment_name(+)
and t.owner =