oracle下实现恢复一个丢失的数据文件的代码
前端之家收集整理的这篇文章主要介绍了
oracle下实现恢复一个丢失的数据文件的代码,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如果您目前拥有一个冷备份,但是缺少了其中的一个数据文件,但你目前存在所有的归档,如果您要恢复数据文件,可以参考以下的示例:
<div class="codetitle"><a style="CURSOR: pointer" data="64629" class="copybut" id="copybut64629" onclick="doCopy('code64629')"> 代码如下:
<div class="codebody" id="code64629">
[oracle@jumpereygle]$
sqlplus"/assysdba"
sqlPlus:Release9.2.0.4.0-ProductiononSunAug2001:22:502006 Copyright(c)1982,2002,OracleCorporation.Allrightsreserved. Connectedtoanidleinstance. sql>startupmount
ORACLEinstancestarted. TotalSystemGlobalArea252777592bytes
FixedSize451704bytes
VariableSize134217728bytes
DatabaseBuffers117440512bytes
RedoBuffers667648bytes
Databasemounted.
sql>alterdatabaSEOpen;
alterdatabaSEOpen
ERRORatline1:
ORA-01157:cannotidentify/lockdatafile3-seeDBWRtracefile
ORA-01110:datafile3:'/opt/oracle/oradata/eygle/eygle02.dbf'
sql>alterdatabasecreatedatafile3as'/opt/oracle/oradata/eygle/eygle02.dbf'; Databasealtered.
sql>selectnamefromv$datafile; NAME
-------------------------------------------------------
/opt/oracle/oradata/eygle/system01.dbf
/opt/oracle/oradata/eygle/undotbs01.dbf
/opt/oracle/oradata/eygle/eygle02.dbf
/opt/oracle/oradata/eygle/eygle01.dbf
sql>alterdataba
SEOpen;
alterdataba
SEOpen
*
ERRORatline1:
ORA-01113:file3needsmediarecovery
ORA-01110:datafile3:'/opt/oracle/oradata/eygle/eygle02.dbf'
sql>recoverdatafile3;
Mediarecoverycomplete.
sql>alterdataba
SEOpen; Databasealtered.
sql>