Monday, December 18, 2006

How to Recover a Database Having Added a Datafile Since Last Backup(10g)

最后一次备份数据库之后,又添加了数据文件,崩溃以后如果恢复


1.最新的控制文件
(1)rman
restore database
recover database
(2)sqlplus
create the datafile(alter database create datafile XXXX)
recover database
2.备份的旧的控制文件
(1)rman
restore controlfile from autobackup;
restore database
recover database
(2)sqlplus
restore from backup set(including the old controlfile)
recover database
create the datafile when error prompts you
-------------------------------------------------------------------------
ORA-00283: Recovery session canceled due to errors
ORA-01244: unnamed datafile(s) added to controlfile by media recovery
ORA-01110: data file 5: '/u01/app//oracle/oradata/testtbs.dbf'

Recreate the missing datafile. To do this, select the relevant filename
from v$datafile:

SQL> select name from v$datafile where file#=5;
NAME
-------------------------------------------------------
UNNAMED0005

Now recreate the file:

SVRMGR> alter database create datafile
2> 'UNNAMED0005'
3> as
4> '/u01/app//oracle/oradata/testtbs.dbf';
-------------------------------------------------------------------------

restart the recovery of database

No comments: