数据文件的损坏恢复过程

create tablespace pengpeng2
datafile '/oracle/oradata/mis/pengpeng02.dbf' size 10m;

create table test_3(peng int)
tablespace pengpeng2;

insert into test_3 values(1);
insert into test_3 values(2);
insert into test_3 values(3);
commit;
alter system switch logfile;
alter system checkpoint;
select file#, name from v$datafile;

rman>connect target /
rman>backup datafile 30

RMAN> backup datafile 30;

Starting backup at 25-MAR-11
using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=19 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00030 name=/oracle/oradata/mis/pengpeng02.dbf
channel ORA_DISK_1: starting piece 1 at 25-MAR-11
channel ORA_DISK_1: finished piece 1 at 25-MAR-11
piece handle=/oracle/product/database/dbs/02m84l6j_1_1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 25-MAR-11


关闭数据库,删除数据文件
$rm /oracle/oradata/mis/pengpeng02.dbf

装载数据库,会看到报错
SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup mount;
ORACLE instance started.

Total System Global Area 537990604 bytes
Fixed Size 452044 bytes
Variable Size 268435456 bytes
Database Buffers 268435456 bytes
Redo Buffers 667648 bytes
Database mounted.
SQL> startup
ORA-01081: cannot start already-running ORACLE - shut it down first
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01157: cannot identify/lock data file 30 - see DBWR trace file
ORA-01110: data file 30: '/oracle/oradata/mis/pengpeng02.dbf'

rman restore and recover 数据文件

RMAN> restore datafile 30;

Starting restore at 25-MAR-11

using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=14 devtype=DISK
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00030 to /oracle/oradata/mis/pengpeng02.dbf
channel ORA_DISK_1: restored backup piece 1
piece handle=/oracle/product/database/dbs/02m84l6j_1_1 tag=TAG20110325T192818

params=NULL
channel ORA_DISK_1: restore complete
Finished restore at 25-MAR-11

RMAN> recover datafile 30;

Starting recover at 25-MAR-11
using channel ORA_DISK_1

starting media recovery
media recovery complete

Finished recover at 25-MAR-11


验证:
先装载数据库
SQL> alter database open;

Database altered.

查找表数据,验证是否完全恢复
SQL> conn peng/peng2010@mistest;
Connected.
SQL> select * from test-3
2 ;
3
SQL> select * from test_3;

PENG
----------
1
2
3

[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22934571/viewspace-1047746/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/22934571/viewspace-1047746/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值