温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

使用spool输出csv格式查看系统表空间使用情况

发布时间:2020-07-22 21:14:21 来源:网络 阅读:278 作者:你瞅啥Zz 栏目:数据库

SET SPOOL ON pre off entmap off

SET ECHO OFF

SET TRIMOUT OFF

set feedback off

set heading on

set colsep ,

set trimspool on

set headsep off

set numw 10

set linesize 200

set pagesize 10000

col tablespace_name format a15

col total_space format a10

col free_space format a10

col used_space format a10

col used_rate format 99.99

spool /home/oracle/test.csv

select a.tablespace_name,a.total_space_Mb||'m' total_space,b.free_space_Mb||'m'

free_space,a.total_space_Mb-b.free_space_Mb||'m' used_space,

(1-(b.free_space_Mb/a.total_space_Mb))*100 used_rate,a.total_blocks,b.free_blocks from

(select tablespace_name,sum(bytes)/1024/1024 total_space_Mb,sum(blocks) total_blocks from dba_data_files

group by tablespace_name) a,

(select tablespace_name, sum((bytes)/1024/1024) free_space_Mb,sum(blocks) free_blocks from dba_free_space

group by tablespace_name) b

where a.tablespace_name=b.tablespace_name order by used_rate desc;

spool off


注(SET ECHO OFF不显示终端输入的start、@、@@等执行脚本命令、SET TERMOUT OFF在spool的时候结果不在终端显示、SET TRIMOUT OFF删除尾部空格)


结果如下:

 使用spool输出csv格式查看系统表空间使用情况



更多Oracle精彩内容 请关注我:

 使用spool输出csv格式查看系统表空间使用情况 


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI