Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Use spool output csv format to view system tablespace usage

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

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.tablespaceName name. Totalroomspaceworthy 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 plus 1024 total_space_Mb,sum (blocks) total_blocks from dba_data_files

Group by tablespace_name) a

(select tablespace_name, sum ((bytes) / 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

Note (SET ECHO OFF does not display start, @, @ @ and other execution script commands entered by the terminal, the result is not displayed in the terminal when SET TERMOUT OFF is in spool, and SET TRIMOUT OFF deletes trailing spaces)

The results are as follows:

For more Oracle highlights, please follow me:

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report