这篇文章会慢慢的积累

1.查看数据库用户占表空间的大小

select owner,tablespace_name ,sum(bytes)/1024/1024 from dba_segments group by owner,tablespace_name;

Select Owner,Tablespace_name,Segment_Name,Segment_Type,Sum(bytes)/1024/1024 sums From Dba_Extents     Group By Owner,Tablespace_name,Segment_Name,Segment_Type

2.查看表空间文件

select * from dba_data_files

3.查看用户在那些表空间

select * from dba_users

4.监控表空间大小的语句

 

SELECT UPPER(F.TABLESPACE_NAME) "表空间名",

D.TOT_GROOTTE_MB "表空间大小(M)",

D.TOT_GROOTTE_MB - F.TOTAL_BYTES "已使用空间(M)",

TO_CHAR(ROUND((D.TOT_GROOTTE_MB - F.TOTAL_BYTES) / D.TOT_GROOTTE_MB * 100,

2),

'990.99') "使用比",

F.TOTAL_BYTES "空闲空间(M)",

F.MAX_BYTES "最大块(M)"

FROM (SELECT TABLESPACE_NAME,

ROUND(SUM(BYTES) / (1024 * 1024), 2) TOTAL_BYTES,

ROUND(MAX(BYTES) / (1024 * 1024), 2) MAX_BYTES

FROM SYS.DBA_FREE_SPACE

GROUP BY TABLESPACE_NAME) F,

(SELECT DD.TABLESPACE_NAME,

ROUND(SUM(DD.BYTES) / (1024 * 1024), 2) TOT_GROOTTE_MB

FROM SYS.DBA_DATA_FILES DD

GROUP BY DD.TABLESPACE_NAME) D

WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME

ORDER BY 4 DES

5.查看视图创建语句的sql

set long 20000
select text from dba_views where view_name = 'xxx '


 

posted on 2012-02-08 15:36  无尽的缥缈  阅读(266)  评论(0编辑  收藏  举报