我们知道在Oracle 10g R2以前的版本中,如果使用RMAN恢复数据库,临时表空间的临时文件是不会自动恢复的。
这曾经引发了一系列的麻烦,很多DBA在恢复完成之后忘记添加临时文件,经常到应用出错时才能发现。
从Oracle 10g R2开始,使用RMAN恢复数据库之后,Oracle会自动重新创建临时文件,由于临时文件是Sparse File,所以创建会非常迅速,通常你不会感觉得到。
以下是我曾经恢复的一段日志,其中记录了Oracle的恢复处理过程:
Thu Sep 14 22:52:06 2006
Successfully onlined Undo Tablespace 1.
Dictionary check beginning
Thu Sep 14 22:52:06 2006
Errors in file /opt/oracle/admin/order/bdump/order_dbw0_31025.trc:
ORA-01157: cannot identify/lock data file 201 - see DBWR trace file
ORA-01110: data file 201: '/data1/oradata/ORDER/datafile/o1_mf_temp_28spyr8h_.tmp'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
Thu Sep 14 22:52:06 2006
Errors in file /opt/oracle/admin/order/bdump/order_dbw0_31025.trc:
ORA-01186: file 201 failed verification tests
ORA-01157: cannot identify/lock data file 201 - see DBWR trace file
ORA-01110: data file 201: '/data1/oradata/ORDER/datafile/o1_mf_temp_28spyr8h_.tmp'
Thu Sep 14 22:52:06 2006
File 201 not verified due to error ORA-01157
Thu Sep 14 22:52:06 2006
Dictionary check complete
Thu Sep 14 22:52:06 2006
SMON: enabling tx recovery
Thu Sep 14 22:52:06 2006
Re-creating tempfile /data1/oradata/ORDER/datafile/o1_mf_temp_28spyr8h_.tmp as
/data1/oradata/ORDER/datafile/o1_mf_temp_2jlv4p90_.tmp
Database Characterset is ZHS16GBK
replication_dependency_tracking turned off (no async multimaster replication found)
Starting background process QMNC
QMNC started with pid=22, OS id=13671
Thu Sep 14 22:52:10 2006
LOGSTDBY: Validating controlfile with logical metadata
Thu Sep 14 22:52:10 2006
LOGSTDBY: Validation complete
Starting control autobackup
Control autobackup written to DISK device
handle '/opt/oracle/product/db10g/dbs/c-1341966532-20060914-03'
Completed: alter database open resetlogs
这也是Oracle10gR2的一个细致改进。