ORACLE用户表空间使用情况查询


1.查询用户使用的表空间:

1 select username,default_tablespace,temporary_tablespace
2 from dba_users
3 where username = '用户名称';

2.查询表空间使用情况:

 1 SELECT a.tablespace_name TABLESPACE_NAME,
 2        total / 1048576 TOTAL_M,
 3        free / 1048576 FREE_M,
 4        (total - free) / 1048576 USED_M,
 5        ROUND((total - free) / total, 4) * 100 "USED%",
 6        autoextensible autoextem
 7   FROM (SELECT tablespace_name, SUM(bytes) free
 8           FROM DBA_FREE_SPACE
 9          GROUP BY tablespace_name) a,
10        (SELECT tablespace_name,
11                SUM(bytes) total,
12                max(autoextensible) autoextensible
13           FROM DBA_DATA_FILES
14          GROUP BY tablespace_name) b
15  WHERE a.tablespace_name = b.tablespace_name
16  order by 6, 5 desc

3.查看表空间对应的数据文件

1 select tablespace_name, file_id, file_name,
2 round(bytes/(1024*1024),0) total_space
3 from dba_data_files
4 order by tablespace_name;

 

2018-08-1613:25:52




免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM