資料檔案丟失的恢復

jane_pop發表於2014-08-22
報錯資訊:
SQL> startup
ORACLE instance started.

Total System Global Area  849530880 bytes
Fixed Size                  1339824 bytes
Variable Size             511708752 bytes
Database Buffers          331350016 bytes
Redo Buffers                5132288 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 6 - see DBWR trace file
ORA-01110: data file 6: '/u01/app/oracle/oradata/orcl/test01.dbf':

確認丟失資料檔案號:
SQL> col name for a50
SQL> select file#,name from v$datafile;


      FILE# NAME
---------- --------------------------------------------------
         1 /u01/app/oracle/oradata/orcl/system01.dbf
         2 /u01/app/oracle/oradata/orcl/sysaux01.dbf
         3 /u01/app/oracle/oradata/orcl/undotbs01.dbf
         4 /u01/app/oracle/oradata/orcl/users01.dbf
         5 /u01/app/oracle/oradata/orcl/example01.dbf
         6 /u01/app/oracle/oradata/orcl/test01.dbf

6 rows selected.

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

Recovery Manager: Release 11.2.0.1.0 - Production on Thu Aug 21 20:15:20 2014

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

connected to target database: ORCL (DBID=1383986269, not open)
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    480      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> restore datafile 6;

Starting restore at 21-AUG-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=17 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/oracle/oradata/orcl/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

RMAN> recover datafile 6;

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

嘗試重新開啟資料庫:
SQL> alter database open;

Database altered.

SQL> select * from test.t1;


        ID NAME
---------- --------------------------------------------------
         1 grace
         2 joe






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

相關文章