資料檔案丟失的恢復(改變目錄)

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

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

檢視警報日誌檔案:
ALTER DATABASE OPEN
Errors in file /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_dbw0_28618.trc:
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '/u01/app/oracle/oradata/orcl/system01.dbf'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_dbw0_28618.trc:
ORA-01157: cannot identify/lock data file 2 - see DBWR trace file
ORA-01110: data file 2: '/u01/app/oracle/oradata/orcl/sysaux01.dbf'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_dbw0_28618.trc:
ORA-01157: cannot identify/lock data file 3 - see DBWR trace file
ORA-01110: data file 3: '/u01/app/oracle/oradata/orcl/undotbs01.dbf'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_dbw0_28618.trc:
ORA-01157: cannot identify/lock data file 4 - see DBWR trace file
ORA-01110: data file 4: '/u01/app/oracle/oradata/orcl/users01.dbf'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_dbw0_28618.trc:
ORA-01157: cannot identify/lock data file 5 - see DBWR trace file
ORA-01110: data file 5: '/u01/app/oracle/oradata/orcl/example01.dbf'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_dbw0_28618.trc:
ORA-01157: cannot identify/lock data file 7 - see DBWR trace file
ORA-01110: data file 7: '/u01/app/oracle/oradata/orcl/hh01.dbf'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_28707.trc:
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '/u01/app/oracle/oradata/orcl/system01.dbf'
ORA-1157 signalled during: ALTER DATABASE OPEN...
Tue Aug 26 00:20:44 2014
Checker run found 6 new persistent data failures

資料檔案全部丟失,下面使用rman進行恢復,並且恢復到其他目錄:
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    0        SYSTEM               ***     /u01/app/oracle/oradata/orcl/system01.dbf
2    0        SYSAUX               ***     /u01/app/oracle/oradata/orcl/sysaux01.dbf
3    0        UNDOTBS1             ***     /u01/app/oracle/oradata/orcl/undotbs01.dbf
4    0        USERS                ***     /u01/app/oracle/oradata/orcl/users01.dbf
5    0        EXAMPLE              ***     /u01/app/oracle/oradata/orcl/example01.dbf
6    100      TEST                 ***     /u01/app/datafile/test01.dbf
7    0        HH                   ***     /u01/app/oracle/oradata/orcl/hh01.dbf

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

RMAN> run{
2> set newname for datafile 1 to '/datafile/system01.dbf';
3> set newname for datafile 2 to '/datafile/sysaux01.dbf';
4> set newname for datafile 3 to '/datafile/undotbs01.dbf';
5> set newname for datafile 4 to '/datafile/users01.dbf';
6> set newname for datafile 5 to '/datafile/example01.dbf';
7> set newname for datafile 7 to '/datafile/hh01.dbf';
8> restore database;
9> switch datafile all;
10> recover database;
11> }

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 26-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 00003 to /datafile/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /datafile/example01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /u01/app/datafile/test01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/backup/indb0_1epgsem7_1_1
channel ORA_DISK_1: piece handle=/u01/app/backup/indb0_1epgsem7_1_1 tag=INDB0
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
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 00001 to /datafile/system01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/backup/indb0_1cpgsem7_1_1
channel ORA_DISK_1: piece handle=/u01/app/backup/indb0_1cpgsem7_1_1 tag=INDB0
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
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 00002 to /datafile/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /datafile/users01.dbf
channel ORA_DISK_1: restoring datafile 00007 to /datafile/hh01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/backup/indb0_1dpgsem7_1_1
channel ORA_DISK_1: piece handle=/u01/app/backup/indb0_1dpgsem7_1_1 tag=INDB0
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:26
Finished restore at 26-AUG-14

datafile 1 switched to datafile copy
input datafile copy RECID=22 STAMP=856571612 file name=/datafile/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=23 STAMP=856571612 file name=/datafile/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=24 STAMP=856571612 file name=/datafile/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=25 STAMP=856571612 file name=/datafile/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=26 STAMP=856571612 file name=/datafile/example01.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=27 STAMP=856571612 file name=/datafile/hh01.dbf

Starting recover at 26-AUG-14
using channel ORA_DISK_1

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

Finished recover at 26-AUG-14

開啟資料庫:
SQL> alter database open;

Database altered.



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

相關文章