1.查看表空间使用情况:
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;
2、查看数据库库对象
select owner, object_type, status, count(*) count# from all_objects group by owner, object_type, status;
3、查看数据库的版本
Select version FROM Product_component_version Where SUBSTR(PRODUCT,1,6)='Oracle';
4、查看数据库创建日期和归档方式
Select Created, Log_Mode, Log_Mode From V$Database;
5、查询数据库中索引占用表空间的大小
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