Oracle 11g RMAN恢復-場景3:非系統表空間資料檔案損壞,資料庫OPEN狀態,高可用

LuiseDalian發表於2014-05-06

--1. 開庫狀態檔案丟失, 查詢該表空間中的資料出錯

ys@TESTDB11>!rm /oradata/users0*.*

 

scott@TESTDB11>select * from dept;

select * from dept

              *

ERROR at line 1:

ORA-01116: error in opening database file 4

ORA-01110: data file 4: '/oradata/users01.dbf'

ORA-27041: unable to open file

Solaris-AMD64 Error: 2: No such file or directory

Additional information: 3

 

--2. 檢視所有需要恢復的檔案的資訊(應該使用sql 'select * from v$recover_file;

RMAN> report schema;

 

Report of database schema for database with db_unique_name TESTDB11

 

List of Permanent Datafiles

===========================

File Size(MB) Tablespace           RB segs Datafile Name

---- -------- -------------------- ------- ------------------------

1    750      SYSTEM               ***     /oradata/system01.dbf

2    730      SYSAUX               ***     /oradata/sysaux01.dbf

3    290      UNDOTBS1             ***     /oradata/undotbs01.dbf

4    6        USERS                ***     /oradata/users01.dbf

5    345      EXAMPLE              ***     /oradata/example01.dbf

6    20       NEWTS                ***     /oradata/newts01.dbf

7    200      FBTBS                ***     /oradata/fbtbs01.dbf

8    50       USERS                ***     /oradata/users02.dbf

 

List of Temporary Files

=======================

File Size(MB) Tablespace           Maxsize(MB) Tempfile Name

---- -------- -------------------- ----------- --------------------

1    500      TEMP                 500         /oradata/temp01.dbf

 

--3. 離線需要還原的檔案

RMAN> sql 'alter database datafile 4, 8 offline';

 

sql statement: alter database datafile 4, 8 offline

--4. 還原

RMAN> restore datafile 4, 8;

 

Starting restore at 14-AUG-13

using channel ORA_DISK_1

 

channel ORA_DISK_1: restoring datafile 00004

input datafile copy RECID=12 STAMP=823418912 file name=/pooldisk02/backup03/data_D-TESTDB11_I-2578856066_TS-USERS_FNO-4_2boh8o10

destination for restore of datafile 00004: /oradata/users01.dbf

channel ORA_DISK_1: copied datafile copy of datafile 00004

output file name=/oradata/users01.dbf RECID=0 STAMP=0

channel ORA_DISK_1: restoring datafile 00008

input datafile copy RECID=10 STAMP=823418909 file name=/pooldisk02/backup03/data_D-TESTDB11_I-2578856066_TS-USERS_FNO-8_29oh8o0r

destination for restore of datafile 00008: /oradata/users02.dbf

channel ORA_DISK_1: copied datafile copy of datafile 00008

output file name=/oradata/users02.dbf RECID=0 STAMP=0

Finished restore at 14-AUG-13

--5. 恢復

RMAN> recover datafile 4, 8;

 

Starting recover at 14-AUG-13

using channel ORA_DISK_1

 

starting media recovery

 

archived log for thread 1 with sequence 30 is already on disk as file /archive1/1_30_823328120.dbf

archived log for thread 1 with sequence 31 is already on disk as file /archive1/1_31_823328120.dbf

archived log for thread 1 with sequence 32 is already on disk as file /archive1/1_32_823328120.dbf

archived log file name=/archive1/1_30_823328120.dbf thread=1 sequence=30

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

Finished recover at 14-AUG-13

--6. 聯機

RMAN> sql 'alter database datafile 4, 8 online';

 

sql statement: alter database datafile 4, 8 online

--7. 驗證資料

scott@TESTDB11>select * from dept;

 

    DEPTNO DNAME          LOC

---------- -------------- -------------

        10 ACCOUNTING     NEW YORK

        20 RESEARCH       DALLAS

        30 SALES          CHICAGO

        40 OPERATIONS     BOSTON

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

相關文章