system表空间存放着数据字典的信息。当数据库处于开启状态,如果system表空间所对应的数据文件出现介质失败,那么当在其数据文件上执行I/O操作时,数据库会自动关闭;
当数据库处于关闭状态时,如果system表空间所对应的数据文件出现介质失败,数据库将不能打开。恢复system表空间必须在mount状态下进行。
示例一:system表空间的数据文件被误删除备份数据库。
删除system表空间对应的数据文件。启动数据库到mount状态。使用restore datafile转储数据文件,并使用recover datafile命令应用归档日志,最后使用alter database open 打开数据库。
--备份数据库(略)
--删除system表空间对应的数据文件
1.RMAN> host rm $ORACLE_BASE/product/10.
2.0/oradatabak/system01.dbf
2.RMAN> startup
3.connected to target database (not started)
4.Oracle instance started
5.database mounted
6.RMAN-00571: ===========================================================
7.RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
8.RMAN-00571: ===========================================================
9.RMAN-03002: failure of startup command at 08/22/2011 21:56:39
10.ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
11.ORA-01110: data file 1: '/oracle/10g/oracle/product/10.2.0/oradatabak/system01.dbf'
12.SQL> select file#,error from v$recover_file;
13.FILE# ERROR
14.---------- -----------------------------------------------------------------
15. 1 FILE NOT FOUND
16.SQL> select file#,name from v$datafile where file#=1;
17.FILE# NAME
18.---------- ------------------------------------------------------------------------------------------------------------------------
19. 1 /oracle/10g/oracle/product/10.2.0/oradatabak/system01.dbf
--启动数据库到mount状态并进行恢复
1.RMAN> run {
2.2> startup force mount;
3.3> restore datafile 1;
4.4> recover datafile 1;
5.5> sql 'alter database open';
6.6> }
示例二:system表空间数据文件所在磁盘出现故障
备份数据库(略)删除system表空间对应的数据文件。启动数据库到mount状态。在restore database之前,执行set newname为数据文件指定新的位置。在restore database 之后,执行switch datafile改变控制文件中数据文件位置和名称。之后通过执行recover database应用归档日志。最后执行alter database open打开数据库。