磁碟損壞導致資料檔案丟失的恢復

jane_pop發表於2014-08-22
如果磁碟損壞了,那麼我們怎麼將備份的資料檔案恢復到新的位置呢?下面我們做個試驗:
報錯資訊:
SQL> shutdown immediate;
ORA-01116: error in opening database file 6
ORA-01110: data file 6: '/u01/app/oracle/oradata/orcl/test01.dbf'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3

使用rman進行恢復:
[oracle@localhost ~]$ rman target / nocatalog

Recovery Manager: Release 11.2.0.1.0 - Production on Thu Aug 21 23:06:30 2014

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL (DBID=1383986269)
using target database control file instead of recovery catalog

RMAN> report schema;

Report of database schema for database with db_unique_name ORCL

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    680      SYSTEM               ***     /u01/app/oracle/oradata/orcl/system01.dbf
2    490      SYSAUX               ***     /u01/app/oracle/oradata/orcl/sysaux01.dbf
3    60       UNDOTBS1             ***     /u01/app/oracle/oradata/orcl/undotbs01.dbf
4    5        USERS                ***     /u01/app/oracle/oradata/orcl/users01.dbf
5    100      EXAMPLE              ***     /u01/app/oracle/oradata/orcl/example01.dbf
6    0        TEST                 ***     /u01/app/oracle/oradata/orcl/test01.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    20       TEMP                 32767       /u01/app/oracle/oradata/orcl/temp01.dbf


RMAN> run{
2> set newname for datafile 6 to '/u01/app/datafile/test01.dbf';
3> restore datafile 6;
4> switch datafile all;
5> recover datafile 6;
6> }

executing command: SET NEWNAME

Starting restore at 21-AUG-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=18 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00006 to /u01/app/datafile/test01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/backup/indb1_0bpghe88_1_1
channel ORA_DISK_1: piece handle=/u01/app/backup/indb1_0bpghe88_1_1 tag=INDB1
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
Finished restore at 21-AUG-14

datafile 6 switched to datafile copy
input datafile copy RECID=3 STAMP=856220997 file name=/u01/app/datafile/test01.dbf

Starting recover at 21-AUG-14
using channel ORA_DISK_1

starting media recovery
media recovery complete, elapsed time: 00:00:00

Finished recover at 21-AUG-14





來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29800581/viewspace-1255960/,如需轉載,請註明出處,否則將追究法律責任。

相關文章