Calculation of Oracle Table space capacity

Source: Internet
Author: User

--Data table space capacity usage

SELECT a.tablespace_name as "table space name",

To_char (b.total/1024/1024,999999.99) | | M ' as ' total capacity ',

To_char ((b.total-a.free)/1024/1024, ' 9999990d99 ') | | M ' as ' used capacity ',

To_char (a.free/1024/1024, ' 9999990d99 ') | | M ' as ' remaining capacity ',

To_char (Round (total-free)/total,4) *100, ' 9999990d99 ') | | % ' as '% used '

From (SELECT tablespace_name, sum (bytes) free from Dba_free_space GROUP by Tablespace_name) A,

(SELECT tablespace_name, sum (bytes) Total from Dba_data_files GROUP by Tablespace_name) b

WHERE A.tablespace_name=b.tablespace_name

Order by Round ((total-free)/total,4) DESC;

--View temporary table space capacity usage

Select D.tablespace_name "tablespace name", Space "total Capacity (M)",

Used_space "used Capacity (M)", Round (NVL (used_space,0)/space*100,2) "percent used (%)",

NVL (free_space,0) "Remaining Capacity (M)"

From

(Select Tablespace_name,round sum (bytes)/(1024*1024), 2) space,sum (blocks) blocks

From Dba_temp_files

Group by Tablespace_name) d,

(Select Tablespace_name,round (SUM (bytes_used)/(1024*1024), 2) Used_space,

Round (sum (bytes_free)/(1024*1024), 2) free_space

From V$temp_space_header

GROUP by Tablespace_name) F

where D.tablespace_name = F.tablespace_name (+)

--undo table Space

SELECT

Seg.tablespace_name "tablespace name",

ts.bytes/1024/1024 "TS Size (MB)",

Ue.status "UNDO status",

COUNT (*) "Used extents",

Round (sum (ue.bytes)/1024/1024, 2) "Used Size (MB)",

Round (sum (ue.bytes)/ts.bytes*100, 2) "Used Rate (%)"

From Dba_segments SEG, dba_undo_extents UE,

(SELECT tablespace_name, sum (bytes) bytes

From Dba_data_files GROUP by tablespace_name) TS

WHERE Ue.segment_name=seg.segment_name and Seg.tablespace_name=ts.tablespace_name

GROUP by Seg.tablespace_name, Ts.bytes, ue.status order by Seg.tablespace_name;

--Storage estimation of table space needs

Calculation formula: Estimate Storage total = on net user number * Average per user daily words singular * per single length (K) * Keep the number of days in the database/1024/1024/0.75

This column more highlights: http://www.bianceng.cnhttp://www.bianceng.cn/database/Oracle/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.