View the table space usage in the Oracle database

Source: Internet
Author: User
You should check the status of Oracle tablespace frequently. When the idle ratio is too low, you should consider increasing the table's viewing space. Check the following SQL statement: Method 1: selectdbf. tab

You should check the status of Oracle tablespace frequently. When the idle ratio is too low, you should consider increasing the table's viewing space. Check the following SQL statement: Method 1: select dbf. tab

You should check the status of the Oracle tablespace frequently. When the idle ratio is too low, you should consider increasing the table's viewing space. The method is as follows:

Method 1:

Select dbf. tablespace_name,
Dbf. totalspace "Total (M )",
Dbf. Total number of totalblocks as blocks,
Dfs. freespace "total remaining amount (M )",
Dfs. freeblocks "remaining blocks ",
(Dfs. freespace/dbf. totalspace) * 100 "idle percentage"
From (select t. tablespace_name,
Sum (t. bytes)/1024/1024 totalspace,
Sum (t. blocks) totalblocks
From dba_data_files t
Group by t. tablespace_name) dbf,
(Select tt. tablespace_name,
Sum (tt. bytes)/1024/1024 freespace,
Sum (tt. blocks) freeblocks
From dba_free_space tt
Group by tt. tablespace_name) dfs
Where trim (dbf. tablespace_name) = trim (dfs. tablespace_name)

Method 2:

SELECT Total. name "Tablespace Name ",
Free_space, (total_space-Free_space) Used_space, total_space
FROM
(Select tablespace_name, sum (bytes/1024/1024) Free_Space
From sys. dba_free_space
Group by tablespace_name
) Free,
(Select B. name, sum (bytes/1024/1024) TOTAL_SPACE
From sys. v _ $ datafile a, sys. v _ $ tablespace B
Where a. ts # = B. ts #
Group by B. name
) Total
WHERE Free. Tablespace_name = Total. name

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.