[Oracle] What should I do if undo is damaged without backup?

Source: Internet
Author: User

If undo damage is unfortunately encountered in Oracle running, the best way is to recover it completely. However, if there is no backup, you can use an unconventional method (using Oracle's hidden parameters ),If undo contains uncommitted transactions at this time, it will cause a little data loss (generally tolerable). If there is no uncommitted transaction, there will be no data loss.The main steps are as follows:

1. Change the undo tablespace management to manual;
2. Set the hidden parameter (_ offline_rollback_segments or _ initupted_rollback_segments) to identify the affected rollback segments, so that Oracle ignores uncommitted transactions on them;
3. manually delete the affected rollback segments and undo tablespace, and recreate the undo tablespace;
4. Restore the undo tablespace management to automatic.

The experiment is as follows:
Step 1.
If the undo data file is corrupted, the database can only be in the mount state. The following error occurs when the database is open:
ORA-01157: cannot identify/lock data file 14-see DBWR trace file
ORA-01110: data file 14: 'I: \ INTEL_DATA \ O06DMS0 \ undo1.o06dms0'
It indicates that the undo file is damaged or lost. After offline the file, you can open the database:
SQL> alter database datafile 'I: \ INTEL_DATA \ O06DMS0 \ UNDO1.O06DMS0' offline drop;
SQL> alter database open;
The purpose of opening a database is to find the affected rollback segments:
SQL> select segment_name, status from dba_rollback_segs;

SEGMENT_NAME STATUS
----------------------------------------------
SYSTEM ONLINE
_ SYSSMU10_1201331463 $ OFFLINE
_ SYSSMU9_2926456744 $ OFFLINE
_ SYSSMU8_640224757 $ OFFLINE
_ SYSSMU7_3984293596 $ OFFLINE
_ Syssmu6_000000008906 $ OFFLINE
_ SYSSMU5_3475919656 $ OFFLINE
_ SYSSMU4_168502732 $ OFFLINE
_ SYSSMU3_1987193959 $ OFFLINE
_ SYSSMU2_3908286755 $ OFFLINE
_ SYSSMU1_3281912951 $ OFFLINE

SQL> show parameter undo

NAME TYPE VALUE
------------------------------------------------------------
Undo_management string AUTO
Undo_retention integer 900
Undo_tablespace string undo1
Close the database:
SQL> shutdown immediate;

Step 2.
Create a temporary pfile:
SQL> create pfile = 'H: \ initO06DMS0. ora 'from spfile;
Modify pfile as follows:
*. Undo_management = 'manual' -- change the undo tablespace management mode to manual.
*. Undo_tablespace = 'undo2' -- specify a new undo tablespace.
*. _ Offline_rollback_segments = ('_ SYSSMU10_1201331463 $', '_ blank $', '_ syssmu6_1_1_8906 $', '_ blank $ ', '_ affected $', '_ SYSSMU3_1987193959 $', '_ SYSSMU2_3908286755 $', '_ SYSSMU1_3281912951 $') -- list all affected rollback segments here
And restart the database with the pfile:
SQL> startup pfile = 'H: \ initO06DMS0. ora'

Step 3.
Manually delete affected rollback segments:
SQL> drop rollback segment "_ SYSSMU10_1201331463 $ ";
SQL> drop rollback segment "_ SYSSMU9_2926456744 $ ";
SQL> drop rollback segment "_ SYSSMU8_640224757 $ ";
SQL> drop rollback segment "_ SYSSMU7_3984293596 $ ";
SQL> drop rollback segment "_ syssmu6_000000008906 $ ";
SQL> drop rollback segment "_ SYSSMU5_3475919656 $ ";
SQL> drop rollback segment "_ SYSSMU4_168502732 $ ";
SQL> drop rollback segment "_ SYSSMU3_1987193959 $ ";
SQL> drop rollback segment "_ SYSSMU2_3908286755 $ ";
SQL> drop rollback segment "_ SYSSMU1_3281912951 $ ";
Manually delete the old undo tablespace:
SQL> drop tablespace undo1 including contents;
Recreate the undo tablespace:
SQL> create undo tablespace undo2 datafile 'I: \ INTEL_DATA \ O06DMS0 \ UNDO2.O06DMS0' size 100 m;
Create a new spfile to overwrite the old spfile:
SQL> create spfile from pfile = 'H: \ initO06DMS0. ora ';
Close the database:
SQL> shutdown immediate;

Step 4.
Start the database with the original spfile:
SQL> startup;
Restore undo tablespace management to automatic:
SQL> alter system set undo_management = 'auto' scope = spfile;
Unhide parameter settings:
SQL> alter system reset "_ offline_rollback_segments" scope = spfile;
Restart to make it take effect:
SQL> shutdown immediate;
SQL> startup
SQL> show parameter undo

NAME TYPE VALUE
------------------------------------------------------------------
Undo_management string AUTO
Undo_retention integer 900
Undo_tablespace string undo2

Finally, check:
SQL> select segment_name, status from dba_rollback_segs;

SEGMENT_NAME STATUS
----------------------------------------------
SYSTEM ONLINE
_ SYSSMU40_1968985325 $ ONLINE
_ SYSSMU39_4040503138 $ ONLINE
_ SYSSMU38_4059847715 $ ONLINE
_ SYSSMU37_2692202156 $ ONLINE
_ Syssmu36_261720.201 $ ONLINE
_ Syssmu35_1131047719 $ ONLINE
_ Syssmu34_19169000064 $ ONLINE
_ SYSSMU33_99444166 $ ONLINE
_ SYSSMU32_162619813 $ ONLINE
_ SYSSMU31_830375278 $ ONLINE

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.