用rman恢复数据文件

 [root@orahost ~]# su - oracle
[oracle@orahost ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Mon May 5 01:19:46 2008

Copyright (c) 1982, 2005, Oracle.  All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> 
SQL> 
SQL> 
SQL> 
SQL> desc dba_data_files
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 FILE_NAME                                          VARCHAR2(513)
 FILE_ID                                            NUMBER
 TABLESPACE_NAME                                    VARCHAR2(30)
 BYTES                                              NUMBER
 BLOCKS                                             NUMBER
 STATUS                                             VARCHAR2(9)
 RELATIVE_FNO                                       NUMBER
 AUTOEXTENSIBLE                                     VARCHAR2(3)
 MAXBYTES                                           NUMBER
 MAXBLOCKS                                          NUMBER
 INCREMENT_BY                                       NUMBER
 USER_BYTES                                         NUMBER
 USER_BLOCKS                                        NUMBER
 ONLINE_STATUS                                      VARCHAR2(7)

SQL> select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------
/oracle/oradata/orcl/testbak.dbf
/oracle/oradata/orcl/users01.dbf
/oracle/oradata/orcl/undotbs01.dbf
/oracle/oradata/orcl/sysaux01.dbf
/oracle/oradata/orcl/system01.dbf

SQL> !
[oracle@orahost ~]$ cd /oracle/oradata/orcl/
[oracle@orahost orcl]$ ls
control01.ct1.bak  control01.ct3.bak  control02.ctl  redo01.log  redo03.log    system01.dbf  test1.dbf    undotbs01.dbf
control01.ct2.bak  control01.ctl      control03.ctl  redo02.log  sysaux01.dbf  temp01.dbf    testbak.dbf  users01.dbf
[oracle@orahost orcl]$ mv test
test1.dbf    testbak.dbf  
[oracle@orahost orcl]$ mv testbak.dbf test111
[oracle@orahost orcl]$ exit
exit

SQL> l 
  1* select file_name from dba_data_files
SQL> r
  1* select file_name from dba_data_files

FILE_NAME
--------------------------------------------------------------------------------
/oracle/oradata/orcl/testbak.dbf
/oracle/oradata/orcl/users01.dbf
/oracle/oradata/orcl/undotbs01.dbf
/oracle/oradata/orcl/sysaux01.dbf
/oracle/oradata/orcl/system01.dbf

SQL> shutdown abort
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size                  1218968 bytes
Variable Size              71304808 bytes
Database Buffers          205520896 bytes
Redo Buffers                7168000 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 5 - see DBWR trace file
ORA-01110: data file 5: '/oracle/oradata/orcl/testbak.dbf'


SQL> recover datafile 5;
ORA-00279: change 785213 generated at 02/18/2014 04:27:53 needed for thread 1
ORA-00289: suggestion :
/oracle/flash_recovery_area/ORCL/archivelog/2008_05_05/o1_mf_1_3_%u_.arc
ORA-00280: change 785213 for thread 1 is in sequence #3


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/oracle/oradata/orcl/redo01.log
ORA-00310: archived log contains sequence 5; sequence 3 required
ORA-00334: archived log: '/oracle/oradata/orcl/redo01.log'


SQL> select status from v$instance;

STATUS
------------
MOUNTED



[oracle@orahost ~]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Mon May 5 01:32:20 2008

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: ORCL (DBID=1327540369, not open)

RMAN> recover datafile 5;

Starting recover at 05-MAY-08
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=232 devtype=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 05/05/2008 01:32:36
RMAN-06094: datafile 5 must be restored

RMAN> restore datafile 5;

Starting restore at 05-MAY-08
using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00005 to /oracle/oradata/orcl/testbak.dbf
channel ORA_DISK_1: reading from backup piece /oracle_backup/db_2014-02-18/ORCL_1327540369_8_1_20140218.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/oracle_backup/db_2014-02-18/ORCL_1327540369_8_1_20140218.bkp tag=TAG20140218T042753
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
Finished restore at 05-MAY-08

RMAN> recover datafile 5;

Starting recover at 05-MAY-08
using channel ORA_DISK_1

starting media recovery

archive log thread 1 sequence 5 is already on disk as file /oracle/flash_recovery_area/ORCL/archivelog/2014_02_19/o1_mf_1_5_9j756d24_.arc
channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=3
channel ORA_DISK_1: reading from backup piece /oracle_backup/db_2014-02-18/archivelog_ORCL_1327540369_13_1_20140218.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/oracle_backup/db_2014-02-18/archivelog_ORCL_1327540369_13_1_20140218.bkp tag=TAG20140218T042852
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
archive log filename=/oracle/flash_recovery_area/ORCL/archivelog/2008_05_05/o1_mf_1_3_41vx4wtf_.arc thread=1 sequence=3
channel default: deleting archive log(s)
archive log filename=/oracle/flash_recovery_area/ORCL/archivelog/2008_05_05/o1_mf_1_3_41vx4wtf_.arc recid=6 stamp=653881116
media recovery complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=4
channel ORA_DISK_1: reading from backup piece /oracle_backup/db_2014-02-18/archivelog_ORCL_1327540369_14_1_20140218.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/oracle_backup/db_2014-02-18/archivelog_ORCL_1327540369_14_1_20140218.bkp tag=TAG20140218T042852
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
channel default: deleting archive log(s)
archive log filename=/oracle/flash_recovery_area/ORCL/archivelog/2008_05_05/o1_mf_1_4_41vx50lj_.arc recid=7 stamp=653881120
Finished recover at 05-MAY-08



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值