Applies to:Oracle Server - Enterprise Edition - Version: 188.8.131.52 to 184.108.40.206
Oracle Server - Standard Edition - Version: 220.127.116.11 to 18.104.22.168
Information in this document applies to any platform.
The purging process is run only few times a year. So would not like to keep the huge undo datafile in your database throughout the year. You don't want to buy additional disks unnecessarily.
You have created an undo tablespace with datafiles as AUTOEXTEND ON MAXSIZE UNLIMITED to avoid Error: ORA 1651 : unable to extend save undo segment by
You have tried "alter database datafile .. resize" which always fails with Error: ORA 3297 : file contains
You want to shrink the datafile to utilize the disk space for other tablespaces or other purposes.
SQL> create undo tablespace UNDO_RBS1 datafile 'undorbs1.dbf' size 100m;
-- Set new tablespace as undo_tablespace
SQL> alter system set undo_tablespace=undo_rbs1;
-- Drop the old tablespace.
SQL> drop tablespace undo_rbs0 including contents.
NOTE: Dropping the old tablespace may give ORA-30013 : undo tablespace '%s' is currently in use. This error indicates you must wait for the undo tablespace to become unavailable. In other words, you must wait for existing transaction to commit or rollback.
Or Your can use "Undo Tablespace Moved To Pending Switch-Out State" to resolve this error.
Also be aware that on some platforms, disk space is not freed to the OS until the database is restarted. The disk space will remain "allocated" from the OS perspective until the database restart.
Reference Note: How to Shrink the datafile of Undo Tablespace [ID 268870.1]