测试环境:系统: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未提交的书屋被当做提交处理了。

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

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]

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

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

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.

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

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.

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


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

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
Recommended: Win version, supports code prompts!

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
Powerful PHP integrated development environment

Zend Studio 13.0.1
Powerful PHP integrated development environment