探索ORACLE之RMAN_07 system表空间丢失恢复

时间:2023-02-14 12:57:59

探索ORACLERMAN_07 system表空间丢失恢复

作者:吴伟龙   NameProdence Woo

QQ286507175  msn:hapy-wuweilong@hotmail.com

 

 

1、     SYSTEM表空间数据文件丢失恢复

注意:以下的所有实验,都是基于上面的全库备份来做的恢复。

3.1 删除system表空间的所有数据文件。

[oracle@wwldb WWL]$ rm -rf syste*

[oracle@wwldb WWL]$ exit

 

3.2 再次启动数据库报错。

SQL> startup force

ORACLE instance started.

 

Total System GlobalArea  285212672 bytes

Fixed Size                  1218968 bytes

Variable Size             104859240 bytes

Database Buffers          171966464 bytes

Redo Buffers                7168000 bytes

Database mounted.

ORA-01157: cannotidentify/lock data file 1 - see DBWR trace file

ORA-01110: data file 1:'/DBData/WWL/system01.dbf'

 

3.3 检查跟踪文件,分析错误。

Errors in file /DBSoft/admin/WWL/bdump/wwl_dbw0_4600.trc:

ORA-01157: Message 1157 not found; No message file for product=RDBMS,facility=ORA; arguments: [1]

ORA-01110: Message 1110 not found; No message file for product=RDBMS,facility=ORA; arguments: [1] [/DBData/WWL/system01.dbf]

ORA-27037: Message 27037 not found; No message file for product=RDBMS,facility=ORA

Linux Error: 2: No such file or directory

Additional information: 3

ORA-1157 signalled during: ALTER DATABASE OPEN...

 

由如上日志文件我们得出是由于/DBData/WWL/system01.dbf文件丢失,而且这个文件同时又是system表空间的的数据文件,因为system表空间存放了数据字典信息,所以该数据文件是不可以采用脱机的方式实现在线的的恢复。

 

3.4恢复system表空间数据文件

开始执行恢复分为五个步骤

1、强制启动数据库到mount状态

SQL> startup force mount;

ORACLE instance started.

 

Total System Global Area  285212672 bytes

Fixed Size                  1218968 bytes

Variable Size             104859240 bytes

Database Buffers          171966464 bytes

Redo Buffers                7168000 bytes

Database mounted.

SQL>

 

2、Restore出来system表空间的数据文件

RMAN> restore datafile 1;

 

Starting restore at 22-JUN-12

using target database control file instead of recoverycatalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=156 devtype=DISK

 

channel ORA_DISK_1: starting datafile backupsetrestore

channel ORA_DISK_1: specifying datafile(s) to restorefrom backup set

restoring datafile 00001 to /DBData/WWL/system01.dbf

channel ORA_DISK_1: reading from backup piece/DBBak/bak_WWL_06_22_0vne4ph6_1_1

channel ORA_DISK_1: restored backup piece 1

piece handle=/DBBak/bak_WWL_06_22_0vne4ph6_1_1tag=TAG20120622T010021

channel ORA_DISK_1: restore complete, elapsed time:00:01:06

Finished restore at 22-JUN-12

 

3、执行system表空间数据恢复。

RMAN> recover datafile 1;

Starting recover at 22-JUN-12

using channel ORA_DISK_1

starting media recovery

archive log thread 1 sequence 20 is already on diskas file/DBData/flash_recovery_area/WWL/archivelog/2012_06_22/o1_mf_1_20_7y804kwr_.arc

archive log thread 1 sequence 21 is already on diskas file/DBData/flash_recovery_area/WWL/archivelog/2012_06_22/o1_mf_1_21_7y80zjqx_.arc

archive log thread 1 sequence 22 is already on diskas file /DBData/flash_recovery_area/WWL/archivelog/2012_06_22/o1_mf_1_22_7y8y7l70_.arc

archive log thread 1 sequence 23 is already on diskas file/DBData/flash_recovery_area/WWL/archivelog/2012_06_22/o1_mf_1_23_7y903v17_.arc

archive logfilename=/DBData/flash_recovery_area/WWL/archivelog/2012_06_22/o1_mf_1_20_7y804kwr_.arcthread=1 sequence=20

archive logfilename=/DBData/flash_recovery_area/WWL/archivelog/2012_06_22/o1_mf_1_21_7y80zjqx_.arcthread=1 sequence=21

media recovery complete, elapsed time: 00:00:02

Finished recover at 22-JUN-12

 

4、Open数据库

SQL> alter database open;

Database altered.

 

SQL> select instance_name,status from v$instance;

INSTANCE_NAME   STATUS

---------------- ------------

WWL             OPEN

 

SQL>