Database Maintenance and programming are often difficult to understand in actual applications. After DML operations on large data volumes, we are extending the Oracle undo tablespace to a dozen or dozens of GB, but the physical space occupied by these tablespaces in the disk will not be released by Oracle, if you are using a PC, you may encounter insufficient disk space.
After completing the following operations, you can reconstruct the Oracle undo tablespace. Similarly, the temp tablespace may be infinitely expanded when you query big data or create an index, resulting in insufficient disk space, you can solve this problem as follows:
View table space names
- select name from v$tablespace
View information about a tablespace
- select file_name,bytes/1024/1024 from
dba_data_files where tablespace_name like 'undoTBS1';
Check the usage of the rollback segment, which user is using the resources of the rollback segment, and if there is a user, it is best to change the time, especially in the production environment ).
- select s.username, u.name from v$transaction t,
v$rollstat r, v$rollname u,v$session s
- where s.taddr=t.addr and t.xidusn=r.
usn and r.usn=u.usn order by s.username;
Check the undo Segment status
- select usn,xacts,rssize/1024/1024/1024,hwmsize
/1024/1024/1024,shrinks from v$rollstat order by rssize;
Create a new undo tablespace and set automatic expansion parameters;
- create undo tablespace undotbs2 datafile 'D:\Oracle
\PRODUCT\10.1.0\ORADATA\ORCL\undoTBS02.DBF' size 10m
reuse autoextend on next 100m maxsize unlimited;
Dynamically change the spfile configuration file;
- alter system set undo _tablespace=undotbs2 scope=both;
Wait for all Oracle undo segment offline for the original UNDO tablespace;
- select usn,xacts,status,rssize/1024/1024/1024,
hwmsize/1024/1024/1024,shrinks from v$rollstat
order by rssize;
Run the following command to check whether all UNDO segments in the UNDO tablespace are ONLINE;
- select usn,xacts,status,rssize/1024/1024/1024,
hwmsize/1024/1024/1024,shrinks from v$rollstat
order by rssize;
Delete the original UNDO tablespace;
- drop tablespace undotbs1 including contents;
Check whether the deletion is successful;
- select name from v$tablespace;
Finally, you need to manually delete the data file in the path where the data file is stored after restarting the database or the computer: the above steps only delete the logical relationship of the Oracle undo tablespace in Oracle, that is, the association between data files in the data dictionary is deleted, and the associated data files are not automatically deleted ).