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