Current location - Health Preservation Learning Network - Healthy weight loss - How does oracle free up disk space when deleting tables, tablespaces and users?
How does oracle free up disk space when deleting tables, tablespaces and users?
Oracle deletes tables to release tablespaces, which need to be released through truncate table xx and then drop table xxx, or directly through drop tablexxx purge;

Examples are as follows:

1, create a test table,

Create table test_space(id number, name varchar2 (20));

2. Insert sample data,

Insert test space

Select level,' test _ space _' | | level.

From double

Connect by level & lt 100000

3. Look at the table for storage, occupying 3 145728B.

Select * from user_segments t, where segment _ name = upper ('test _ space');

4.truncate clear table data, truncate table? Test_space, and then query the table store again. The storage becomes 65536B, which has been released;

Truncated table test _ space

select * from user_segments t?

Where segment _ name = upper ('test _ space');

5. After deleting the table again, the storage has been released;

Delete table test _ space

Select bytes from user_segments t?

Where segment _ name = upper ('test _ space');