How to drop and recreate Oracle undo tablespace and its data files

No GoodNeed ImprovementOKGoodExcellent (19 votes, average: 3.68 out of 5)
Loading ... Loading ...

If you get ORA-00600 or the following error message on your Oracle standby database:

Fri Mar 09 10:57:49 2007
Errors in file c:\oracle\admin92\crm\bdump\crmsb_mrp0_524.trc:
ORA-00600: internal error code, arguments: [3020], [356515961], [1], [4606], [2], [16], [], []
ORA-10567: Redo is inconsistent with data block (file# 85, block# 121)
ORA-10564: tablespace UNDOTBS2
ORA-01110: data file 85: ‘K:\ORADATA\CRM\UNDOTBS02_1.DBF’
ORA-10560: block type ‘KTU SMU HEADER BLOCK’

Or your undo tablespace has grown to unmanageable size (~ 35 Gbytes), you may want to recreate unto tablespace. Here is how:

1, Make sure the database was last cleanly shut down.

sqlplus /nolog
SQL>connect sys/change@crm as sysdba
SQL> shutdown immediate

2, mount database in RESTRICT mode, using pfile.

SQL> STARTUP RESTRICT MOUNT pfile=C:\Oracle\job\crmstandby\initCRM_18.ora
ORACLE instance started. Total System Global Area 1620126452 bytes
Fixed Size 457460 bytes
Variable Size 545259520 bytes
Database Buffers 1073741824 bytes
Redo Buffers 667648 bytes
Database mounted.

3, Try to offline drop the bad datafile.

SQL> ALTER DATABASE DATAFILE 'K:\ORADATA\CRM\UNDOTBS2_02.DBF' OFFLINE DROP;

*
ERROR at line 1:
ORA-01548: active rollback segment ‘_SYSSMU11$’ found, terminate dropping
tablespace

or this SQL:

DROP TABLESPACE undotbs2 INCLUDING CONTENTS AND DATAFILES ;
*
ERROR at line 1:
ORA-01548: active rollback segment ‘_SYSSMU11$’ found, terminate dropping
tablespace

4, Use this query to see how many rollback segments were corrupted:

SQL>select segment_name,status,tablespace_name from dba_rollback_segs where status='NEEDS RECOVERY';
SEGMENT_NAME STATUS TABLESPACE_NAME
—————————— —————- —————–
_SYSSMU11$ NEEDS RECOVERY UNDOTBS2
_SYSSMU12$ NEEDS RECOVERY UNDOTBS2
_SYSSMU13$ NEEDS RECOVERY UNDOTBS2
_SYSSMU14$ NEEDS RECOVERY UNDOTBS2
_SYSSMU15$ NEEDS RECOVERY UNDOTBS2
_SYSSMU16$ NEEDS RECOVERY UNDOTBS2
_SYSSMU17$ NEEDS RECOVERY UNDOTBS2
_SYSSMU18$ NEEDS RECOVERY UNDOTBS2
_SYSSMU19$ NEEDS RECOVERY UNDOTBS2
_SYSSMU20$ NEEDS RECOVERY UNDOTBS2

5, Add the following line to pfile:

_corrupted_rollback_segments =('_SYSSMU11$','_SYSSMU12$','_SYSSMU13$','_SYSSMU14$','_SYSSMU15$','_SYSSMU16$','_SYSSMU17$','_SYSSMU18$','_SYSSMU19$','_SYSSMU20$')

Make sure you uncomment “undo_management=AUTO”, and specify you want to use UNDOTBS1 as undo tablespace.

#undo_management=AUTO
undo_tablespace=UNDOTBS1

6, Start the database again:

SQL> STARTUP RESTRICT MOUNT pfile=C:\Oracle\job\crmstandby\initcrm_18.ora

7. Drop bad rollback segments

SQL> drop rollback segment "_SYSSMU11$";
Rollback segment dropped.

SQL> drop rollback segment "_SYSSMU20$";
Rollback segment dropped.

8, Check again

SQL> select segment_name,status,tablespace_name from dba_rollback_segs;

SEGMENT_NAME STATUS TABLESPACE_NAME
—————————— —————- —————
SYSTEM ONLINE SYSTEM
_SYSSMU2$ ONLINE UNDOTBS1
_SYSSMU3$ ONLINE UNDOTBS1
_SYSSMU4$ ONLINE UNDOTBS1
_SYSSMU5$ ONLINE UNDOTBS1
_SYSSMU6$ ONLINE UNDOTBS1
_SYSSMU7$ ONLINE UNDOTBS1
_SYSSMU8$ ONLINE UNDOTBS1
_SYSSMU9$ ONLINE UNDOTBS1
_SYSSMU10$ ONLINE UNDOTBS1
_SYSSMU21$ ONLINE UNDOTBS1

9. Now drop bad undo TABLESPACE UNDOTBS2;

SQL> drop TABLESPACE UNDOTBS2;

10, Recreate the undo rollback tablespace with all its rollback segments

SQL>CREATE UNDO TABLESPACE UNDOTBS1 DATAFILE 'K:\oradata\CRM\UNDOTBS01.DBF' SIZE 2000M reuse AUTOEXTEND ON ;

11, Change undo tablespace

ALTER SYSTEM SET undo_tablespace = UNDOTBS1 ;

12. Remove the following line from pfile

_corrupted_rollback_segments =('_SYSSMU11$','_SYSSMU12$','_SYSSMU13$','_SYSSMU14$','_SYSSMU15$','_SYSSMU16 $','_SYSSMU17$','_SYSSMU18$','_SYSSMU19$','_SYSSMU20$')

and uncomment “undo_management=AUTO”

undo_management=AUTO
undo_retention=10800
undo_tablespace=UNDOTBS1

13, Shutdown database

SQL>shutdown immediate;

14, Edit initCRM_18.ora, make sure you change ‘undo_tablespace=UNDOTBS2″ to “undo_tablespace=UNDOTBS1″, then start oracle database:

sqlplus /nolog
SQL>connect sys/change@crm as sysdba
SQL> STARTUP RESTRICT MOUNT pfile=C:\Oracle\job\crmstandby\initcrm_18.ora
ORACLE instance started.
Total System Global Area 1620126452 bytes
Fixed Size 457460 bytes
Variable Size 545259520 bytes
Database Buffers 1073741824 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.

15, Create Undo tablespace:

SQL>CREATE UNDO TABLESPACE UNDOTBS2 DATAFILE 'K:\oradata\CRM\UNDOTBS02.DBF' SIZE 2000M reuse AUTOEXTEND ON ;
SQL>DROP TABLESPACE undotbs1 INCLUDING CONTENTS AND DATAFILES ;

16, Startup database with spfile

SQL> startup;
ORACLE instance started.
Total System Global Area 1620126452 bytes
Fixed Size 457460 bytes
Variable Size 545259520 bytes
Database Buffers 1073741824 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.

Popularity: 29%

14 Comments »

  1. Prakash Karmakar said,

    April 11, 2007 @ 1:00 am

    Thanks for information.

    in this documentation, I learnt how to manage undo tablespace and their relevent data file.

    Comment No. 1 :
    now at that time i want to know how to delete data from undo tablespace without drop undo tablespace.

    Comment No. 2 :
    if i uncomment undo_management=AUTO parameter in init.ora file, the data for undo tablespace are not longer available through Flashback query ?

    overall i need some solution for old data (modified, deleted), which is not realated to our job, are unnecessary hold in data base space. so that the system will be runing smoothly.

  2. Roger Solares said,

    April 24, 2007 @ 1:30 pm

    It’s a good solution, I had a corrupted undo table space, with your solution I could drop and create a new.
    Thanx
    From Guadalajara, Mexico
    The land of tequila

  3. rommi said,

    May 6, 2007 @ 7:25 pm

    is it the same solution if I’m using oracle 8.1.7, cause there aren’t auto_management & undo_tablespaces in the pfile.

    thanks

  4. advaldo said,

    May 29, 2007 @ 10:14 am

    Recuperação de database com undo corrompido

  5. Brian Murray said,

    June 6, 2007 @ 2:21 pm

    Pure genius! I had a rollback segment that was trying to rollback an old tx and I could not get rid it it… it was constantly being locked by SMON. Several hours of surfing later I stumbled upon this www and hey presto.

    Thank You!

  6. fpeter76 said,

    August 23, 2007 @ 7:00 am

    I can’t run any select or drop tablespace. The message is the database is not open.

    How can I fix it?

  7. Leo said,

    August 28, 2007 @ 8:17 am

    It’s a great solution and it has worked fine.
    I had a corrupted undotbs file and I was able to recreate one and bring the database back online.
    Again thank you.

  8. avg said,

    October 25, 2007 @ 7:20 am

    Super!!!

    Great solution!
    You save my life :-)
    Greetings from Ukraine.

  9. Partha said,

    November 17, 2007 @ 3:42 am

    Hi Friends, This is outstanding helpline for DBAs I must say - so do help us and prefer to be member of your website …. kindly let me know how should I become a valid member of your site and continue to learn more. Thanks once again and best wishes.

    Regards, Partha

  10. Hemant K Chitale said,

    January 8, 2008 @ 3:29 am

    I strongly suggest that you do not advise DBAs to use such methods.
    Advise them to read the standard Oracle Docs and contact Oracle Support .
    “_corrupted_rollback_segments” is a NO NO !
    Hemant K Chitale

  11. Oracle said,

    April 28, 2008 @ 12:57 pm

    Hemant K Chitale,

    This article is wonderful. I support this doc.

    http://www.praetoriate.com/t_grid_rac_undoc_init_procedures.htm
    _CORRUPTED_ROLLBACK_SEGMENTS. Only way to start up with corrupted public rollback segments. Can be used without fear of desupport.

  12. Djuro said,

    May 7, 2008 @ 9:57 am

    Very, very good procedure .. thanks

  13. How to drop and recreate oracle undo tablespace and its datafile: said,

    May 19, 2008 @ 1:48 pm

    [...] From my-whiteboard.com [...]

  14. Chandan said,

    May 28, 2008 @ 5:58 pm

    This article really helped me to come out of an UNDO related problem. The process is nice. Thanks.

RSS feed for comments on this post · TrackBack URI

Leave a Comment

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word