Home > Database > Mysql Tutorial > body text

Oracle的临时表空间和UNDO表空间对应的文件丢失后的处理

WBOY
Release: 2016-06-07 17:09:56
Original
1046 people have browsed it

数据库的临时文件和undo文件不需要做备份,丢失后可以恢复,数据不会有丢失.一,临时表空间的文件丢失后,在数据库启动后自动创建,不

数据库的临时文件和undo文件不需要做备份,丢失后可以恢复,数据不会有丢失.

一,临时表空间的文件丢失后,在数据库启动后自动创建,不需要做干预.

模拟:在数据库shutdown后将临时文件删除,启动的时候发现自动创建.

二,undo表空间对应的文件丢失.

模拟:在数据库shutdown后将undo文件删除,启动的时候出错:


ORA-01157: cannot identify/lock data file 2 - see DBWR trace file
ORA-01110: data file 2: 'D:\Oracle\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF'

恢复步骤:因为undo文件不保存数据,可以直接drop 后重建.

1,drop undo文件.


SQL> alter database datafile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF' offline drop;
Database altered.


2,将undo管理改为manual

SQL> alter system set undo_management='MANUAL' scope=spfile;

System altered.

3,重新启动数据库


SQL> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.


SQL> startup
ORACLE instance started.
Total System Global Area  612368384 bytes
Fixed Size                  1250428 bytes
Variable Size             264244100 bytes
Database Buffers          339738624 bytes
Redo Buffers                7135232 bytes
Database mounted.
Database opened.
4,将丢失文件的undo表空间drop后重建

SQL> drop tablespace undotbs1;
Tablespace dropped.

SQL> create undo tablespace UNDOTBS1 datafile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF' size 20M;
Tablespace created.
5,查看目前的数据库undo设置,需要将undo_management 改为auto.
SQL> show parameter undo
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
undo_management                      string      MANUAL
undo_retention                       integer     900
undo_tablespace                      string      UNDOTBS1
SQL> alter system set undo_management='AUTO' scope=spfile;


SQL> alter system set undo_management='AUTO' scope=spfile;
System altered.
6,重新启动,数据库恢复成undo自动管理.

SQL> shutdown immediate;
SQL> startup

linux

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template