您好,登錄后才能下訂單哦!
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刪除尾部空格)
結果如下:
更多Oracle精彩內容 請關注我:
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。