The size of the Oracle query table, the usage of the table space, the default table space

Source: Internet
Author: User

the size of the Oracle query table, the usage of the table space, the default table space

The size of the Oracle query table, the usage of the table space, the default table space

--View a table takes up disk space (table name capitalization)
Select segment_name,sum (bytes)/1024/1024 from User_extents Group by segment_name have segment_name= ' table name ';
View user default table null is that
Select Username,default_tablespace from dba_users where username= ' SCOTT ';
--Table Space Idle
Select Tablespace_name, sum (bytes)/(1024*1024) as Free_space
From Dba_free_space
Group BY Tablespace_name;

--View the usage of the database table space

Select B.file_name Physical file name,
B.tablespace_name table Space,
b.bytes/1024/1024 size M,
(B.bytes-sum (NVL (a.bytes, 0))/1024/1024 used M,
SUBSTR ((B.bytes-sum (NVL (a.bytes, 0))/(b.bytes) * 100, 1, 5) utilization
From Dba_free_space A, dba_data_files b
where a.file_id = b.file_id
Group by B.tablespace_name, B.file_name, b.bytes
ORDER BY B.tablespace_name


--Edit the table space to enlarge the table space to 2M

ALTER DATABASE datafile '/ORADATA/RSZPDB/TEST1.DBF ' resize 2m;

If you do not know the address of '/oradata/rszpdb/test1.dbf ',

You can use the statement query:

Select B.file_name physical file name from Dba_free_space A, dba_data_files b

where a.file_id = b.file_id and b.tablespace_name = ' Table space name '

Group by B.tablespace_name, B.file_name, b.bytes



--Expand the tablespace by enlarging the data file to enlarge the table space by 1G (rcmt_test)

Alter tablespace rcmt_test add datafile '/oradata/rszpdb/rcmt_test2.dbf ' size 1G;

/ORADATA/RSZPDB/RCMT_TEST2.DBF: cannot be the same as the original data file name (original:/ORADATA/RSZPDB/RCMT_TEST1.DBF)

Rcmt_test: Table Space

1 g: Enlarge 1G

After the original data file rcmt_test1.dbf has been used, the space of RCMT_TEST2.DBF is automatically used.

The size of the Oracle query table, the usage of the table space, the default table space

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.