search
HomeDatabaseMysql TutorialRAC下丢失undo表空间的恢复

测试环境:系统:LINUX-64数据库:10.2.0.1二节点RAC:RACDB1,RACDB2 存储使用的ASM

测试环境:
系统:LINUX-64
数据库:10.2.0.1
二节点RAC:RACDB1,RACDB2  存储使用的ASM
 
(1)插入数据,不提交
RACDB1>insert into xuhm.test3 values (4,'aa');
 
有一个活动的事务。
RACDB1>select usn,xacts from v$rollstat;
 
      USN    XACTS
---------- ----------
        0        0
        1        0
        2        0
        3        0
        4        1
        5        0
        6        0
        7        0
        8        0
        9        0
      10        0
 
(2)关闭数据库,,删除RACDB1的UNDO表空间
RACDB1>shutdown abort;
RACDB2>shutdown abort;
 
ASMCMD> rm UNDOTBS1.260.794232647
 
(3)开启数据库
RACDB1>startup
Oracle instance started.
 
Total System Global Area 184549376 bytes
Fixed Size                2019448 bytes
Variable Size            121638792 bytes
Database Buffers          58720256 bytes
Redo Buffers              2170880 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 2 - see DBWR trace file
ORA-01110: data file 2: '+RAC_DISK/racdb/datafile/undotbs1.260.794232647'
 
RACDB2>startup
ORACLE instance started.
 
Total System Global Area 184549376 bytes
Fixed Size                2019448 bytes
Variable Size            155193224 bytes
Database Buffers          25165824 bytes
Redo Buffers              2170880 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 2 - see DBWR trace file
ORA-01110: data file 2: '+RAC_DISK/racdb/datafile/undotbs1.260.794232647'
 
RACDB2>shutdown immediate
 
(4)因为这个文件丢失,所以只好把这个文件offline处理
RACDB1>alter database datafile '+RAC_DISK/racdb/datafile/undotbs1.260.794232647' offline drop;
 
 
(5)打开数据库
RACDB1>alter database open;
无法打开数据库,查看alert日志报错如下
ORA-00604: error occurred at recursive SQL level 1
ORA-00376: file 2 cannot be read at this time
ORA-01110: data file 2: '+RAC_DISK/racdb/datafile/undotbs1.260.794232647'
Error 604 happened during db open, shutting down database
USER: terminating instance due to error 604
Fri Sep 28 20:32:29 2012
Errors in file /u01/app/oracle/admin/RACDB/bdump/racdb1_lms0_9732.trc:
ORA-00604: error occurred at recursive SQL level
Fri Sep 28 20:32:29 2012
Errors in file /u01/app/oracle/admin/RACDB/bdump/racdb1_lmon_9728.trc:
 
需要修改如下参数:注意,这里一定要使用_corrupted_rollback_segments,不能使用_offline_rollback_segments,要不然还是无法打开数据库。
修改在pfile文件中。
RACDB1.undo_management='MANUAL'
RACDB1.undo_tablespace='UNDO2'
RACDB1._corrupted_rollback_segments=('_SYSSMU1$','_SYSSMU2$','_SYSSMU3$','_SYSSMU4$','_SYSSMU5$','_SYSSMU6$','_SYSSMU7$','_SYSSMU8$','_SYSSMU9$','_SYSSMU10$')
 
RACDB1>startup pfile='/u01/pfile';
ORACLE instance started.
 
Total System Global Area 184549376 bytes
Fixed Size                2019448 bytes
Variable Size            121638792 bytes
Database Buffers          58720256 bytes
Redo Buffers              2170880 bytes
Database mounted.
Database opened.
 
(6)删除回滚段
RACDB1>SELECT segment_name,status FROM DBA_ROLLBACK_SEGS WHERE STATUS'OFFLINE';
 
SEGMENT_NAME                  STATUS
------------------------------ ----------------
SYSTEM                        ONLINE
_SYSSMU1$                    NEEDS RECOVERY
_SYSSMU2$                    NEEDS RECOVERY
_SYSSMU3$                    NEEDS RECOVERY
_SYSSMU4$                    NEEDS RECOVERY
_SYSSMU5$                    NEEDS RECOVERY
_SYSSMU6$                    NEEDS RECOVERY
_SYSSMU7$                    NEEDS RECOVERY
_SYSSMU8$                    NEEDS RECOVERY
_SYSSMU9$                    NEEDS RECOVERY
_SYSSMU10$                    NEEDS RECOVERY
 
11 rows selected.
 
RACDB1>drop rollback segment "_SYSSMU1$";
 
Rollback segment dropped.
 
RACDB1>drop rollback segment "_SYSSMU2$";
 
Rollback segment dropped.
 
RACDB1>drop rollback segment "_SYSSMU3$";
 
Rollback segment dropped.
 
RACDB1>drop rollback segment "_SYSSMU4$";
 
Rollback segment dropped.
 
RACDB1>drop rollback segment "_SYSSMU5$";
 
Rollback segment dropped.
 
RACDB1>drop rollback segment "_SYSSMU6$";
 
Rollback segment dropped.
 
RACDB1>drop rollback segment "_SYSSMU7$";
 
Rollback segment dropped.
 
RACDB1>drop rollback segment "_SYSSMU8$";
 
Rollback segment dropped.
 
RACDB1>drop rollback segment "_SYSSMU9$";
 
Rollback segment dropped.
 
RACDB1>drop rollback segment "_SYSSMU10$";
 
Rollback segment dropped.
 
(7)删除旧的undo表空间,创建新undo表空间
RACDB1>drop tablespace undotbs1 including contents and datafiles;
 
Tablespace dropped.
 
RACDB1>create undo tablespace undo2 ;
 
Tablespace created.
 
(8)修改spfile参数
RACDB1>shutdown immediate
RACDB1>startup mount;
RACDB1>alter system set undo_management=auto scope=spfile sid='RACDB1';
RACDB1>alter system set undo_tablespace=UNDO2 scope=spfile sid='RACDB1';
RACDB1>shutdown immediate
RACDB1>startup
RACDB1>show parameter undo
 
NAME                                TYPE      VALUE
------------------------------------ ----------- ------------------------------
undo_management                    string    AUTO
undo_retention                      integer    900
undo_tablespace                    string    UNDO2
 
 
(9)查看最后恢复的结果
RACDB1>select * from xuhm.test3;
 
      ID NA
---------- --
        4 aa
        2 xu
        3 li
--4,aa未提交的书屋被当做提交处理了。

linux

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
How do you alter a table in MySQL using the ALTER TABLE statement?How do you alter a table in MySQL using the ALTER TABLE statement?Mar 19, 2025 pm 03:51 PM

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

How do I configure SSL/TLS encryption for MySQL connections?How do I configure SSL/TLS encryption for MySQL connections?Mar 18, 2025 pm 12:01 PM

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

How do you handle large datasets in MySQL?How do you handle large datasets in MySQL?Mar 21, 2025 pm 12:15 PM

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?Mar 21, 2025 pm 06:28 PM

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

How do you drop a table in MySQL using the DROP TABLE statement?How do you drop a table in MySQL using the DROP TABLE statement?Mar 19, 2025 pm 03:52 PM

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

How do you represent relationships using foreign keys?How do you represent relationships using foreign keys?Mar 19, 2025 pm 03:48 PM

Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

How do you create indexes on JSON columns?How do you create indexes on JSON columns?Mar 21, 2025 pm 12:13 PM

The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)?How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)?Mar 18, 2025 pm 12:00 PM

Article discusses securing MySQL against SQL injection and brute-force attacks using prepared statements, input validation, and strong password policies.(159 characters)

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment