Oracle查询语句

来自Fantasy的维基百科
(版本间的差异)
跳转至: 导航, 搜索
第1行: 第1行:
  
===查看该表空间上所有对象===  
+
==查看该表空间上所有对象==
 
SELECT t.owner, t.segment_name,SUM(bytes)/1024/1024 From dba_segments t  
 
SELECT t.owner, t.segment_name,SUM(bytes)/1024/1024 From dba_segments t  
 
WHERE t.tablespace_name = 'TBS_DEFAULT'
 
WHERE t.tablespace_name = 'TBS_DEFAULT'
第6行: 第6行:
 
ORDER BY SUM(bytes) desc;
 
ORDER BY SUM(bytes) desc;
  
===查看LOB类型的段所属的表===
+
==查看LOB类型的段所属的表==
 
select table_name,column_name,segment_name,index_name from user_lobs;
 
select table_name,column_name,segment_name,index_name from user_lobs;
 +
 +
==移动表至其他表空间,并重建索引==
 +
alter table TICKETBASE move tablespace  TB_LOB;
 +
alter index SYS_C005391 rebuild online;

2014年9月28日 (日) 15:16的版本

查看该表空间上所有对象

SELECT t.owner, t.segment_name,SUM(bytes)/1024/1024 From dba_segments t WHERE t.tablespace_name = 'TBS_DEFAULT' GROUP BY t.owner,t.segment_name ORDER BY SUM(bytes) desc;

查看LOB类型的段所属的表

select table_name,column_name,segment_name,index_name from user_lobs;

移动表至其他表空间,并重建索引

alter table TICKETBASE move tablespace TB_LOB; alter index SYS_C005391 rebuild online;

个人工具
名字空间

变种
操作
导航
工具