This is task that all Oracle DBA should know and understand. Imagine that your database will loose access to your Undo table space or you Undo data files are lost!, how can you get back on the horse? So let's see what are the steps in recovering the Undo table space.
SQL startup;
ORACLE instance started.
Total System Global Area 417546240 bytes
Fixed Size 2213936 bytes
Variable Size 331352016 bytes
Database Buffers 79691776 bytes
Redo Buffers 4288512 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 3 - see DBWR trace file
ORA-01110: data file 3: '/opt/oracle/oradata/oracle/undotbs01.dbf'
SQL startup mount;
ORACLE instance started.
Total System Global Area 417546240 bytes
Fixed Size 2213936 bytes
Variable Size 331352016 bytes
Database Buffers 79691776 bytes
Redo Buffers 4288512 bytes
Database mounted.
SQL
SQL alter system set undo_management=manual scope=spfile;
System altered.
SQL shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL startup mount;
ORACLE instance started.
Total System Global Area 417546240 bytes
Fixed Size 2213936 bytes
Variable Size 331352016 bytes
Database Buffers 79691776 bytes
Redo Buffers 4288512 bytes
Database mounted.
SQL alter database datafile '/opt/oracle/oradata/oracle/undotbs01.dbf' offline drop;
Database altered.
SQL
SQL alter database open;
Database altered.
SQL Show parameter undo_tablespace
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_tablespace string UNDOTBS1
SQL drop tablespace UNDOTBS1;
Tablespace dropped.
SQL Create UNDO tablespace UNDOTBS1 datafile '/opt/oracle/oradata/oracle/undotbs_new1.dbf' size 25M autoextend on next 1M maxsize 1024M;
Tablespace created.
SQL
SQL alter system set undo_management=auto scope=spfile;
System altered.
SQL shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL startup;
ORACLE instance started.
Total System Global Area 417546240 bytes
Fixed Size 2213936 bytes
Variable Size 331352016 bytes
Database Buffers 79691776 bytes
Redo Buffers 4288512 bytes
Database mounted.
Database opened.
SQL