Oracle查看表空間的使用情況或表空間的大小,應該如何實現呢?下面就為您介紹實現Oracle查看表空間方面的語句,如果您感興趣的話,不妨一看。
Oracle查看表空間的使用情況
select sum(bytes)/(1024*1024) as free_space,tablespace_name
from dba_free_space
group by tablespace_name;
SELECT A.TABLESPACE_NAME,A.BYTES TOTAL,B.BYTES USED, C.BYTES FREE,
(B.BYTES*100)/A.BYTES "% USED",(C.BYTES*100)/A.BYTES "% FREE"
FROM SYS.SM$TS_AVAIL A,SYS.SM$TS_USED B,SYS.SM$TS_FREE C
WHERE A.TABLESPACE_NAME=B.TABLESPACE_NAME AND A.TABLESPACE_NAME=C.TABLESPACE_NAME;
查看數據庫庫對象
select owner, object_type, status, count(*) count# from all_objects group by owner, object_type, status;
查看數據庫的版本
Select version FROM Product_component_version
Where SUBSTR(PRODUCT,1,6)='Oracle';
查看數據庫的創建日期和歸檔方式
Select Created, Log_Mode, Log_Mode From V$Database;
查詢數據庫中索引占用表空間的大小
select a.segment_name,a.tablespace_name,b.table_name,a.bytes/1024/1024 mbytes,a.blocks
from user_segments a, user_indexes b
where a.segment_name = b.index_name
and a.segment_type = 'INDEX' --索引
and a.tablespace_name='APPINDEX' --表空間
and b.table_name like '%PREP%' --索引所在表
order by table_name,a.bytes/1024/1024 desc