單例項恢復RAC資料庫步驟(三)

yangtingkun發表於2011-02-28

簡單描述在測試伺服器的單機環境恢復RAC產品資料庫的步驟。

這一篇介紹資料庫恢復過程。

單例項恢復RAC資料庫步驟(一):http://yangtingkun.itpub.net/post/468/514155

單例項恢復RAC資料庫步驟(二):http://yangtingkun.itpub.net/post/468/514246

 

 

首先恢復歸檔檔案:

rman target /

Recovery Manager: Release 10.2.0.5.0 - Production on Mon Jan 17 16:15:23 2011

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

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

RMAN> restore archivelog sequence between 13941 and 13942 thread 2;

Starting restore at 17-JAN-11
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=1638 devtype=DISK

channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=2 sequence=13941
channel ORA_DISK_1: reading from backup piece /rman/backup/orcl/5tm2af71_1_1
channel ORA_DISK_1: restored backup piece 1
failover to piece handle=/data/backup/orcl/5tm2af71_1_1 tag=TAG20110117T044518
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=2 sequence=13942
channel ORA_DISK_1: reading from backup piece /rman/backup/orcl/60m2an40_1_1
channel ORA_DISK_1: restored backup piece 1
failover to piece handle=/data/backup/orcl/60m2an40_1_1 tag=TAG20110117T070016
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
Finished restore at 17-JAN-11

RMAN> restore archivelog sequence between 868 and 869 thread 1;

Starting restore at 17-JAN-11
using channel ORA_DISK_1

channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=868
channel ORA_DISK_1: reading from backup piece /rman/backup/orcl/5um2af72_1_1
channel ORA_DISK_1: restored backup piece 1
failover to piece handle=/data/backup/orcl/5um2af72_1_1 tag=TAG20110117T044518
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=869
channel ORA_DISK_1: reading from backup piece /rman/backup/orcl/61m2an40_1_1
channel ORA_DISK_1: restored backup piece 1
failover to piece handle=/data/backup/orcl/61m2an40_1_1 tag=TAG20110117T070016
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 17-JAN-11

RMAN> exit


Recovery Manager complete.

利用sqlplus執行日誌檔案重新命名和恢復工作:

$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.5.0 - Production on Mon Jan 17 16:06:42 2011

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Data Mining and Real Application Testing options

SQL> ALTER DATABASE RENAME FILE '+DATADG/orcl/onlinelog/group_7.266.740450465' TO '/data/oradata/orcl/redo_7_1_1.log';

Database altered.

SQL> ALTER DATABASE RENAME FILE '+FRADG/orcl/onlinelog/group_7.304.740450465' TO '/data/oradata/orcl/redo_7_1_2.log';

Database altered.

SQL> ALTER DATABASE RENAME FILE '+DATADG/orcl/onlinelog/group_8.302.740450465' TO '/data/oradata/orcl/redo_8_1_1.log';

Database altered.

SQL> ALTER DATABASE RENAME FILE '+FRADG/orcl/onlinelog/group_8.287.740450465' TO '/data/oradata/orcl/redo_8_1_2.log';

Database altered.

SQL> ALTER DATABASE RENAME FILE '+DATADG/orcl/onlinelog/group_9.300.740450467' TO '/data/oradata/orcl/redo_9_1_1.log';

Database altered.

SQL> ALTER DATABASE RENAME FILE '+FRADG/orcl/onlinelog/group_9.275.740450467' TO '/data/oradata/orcl/redo_9_1_2.log';

Database altered.

SQL> ALTER DATABASE RENAME FILE '+DATADG/orcl/onlinelog/group_10.303.740450467' TO '/data/oradata/orcl/redo_10_2_1.log';

Database altered.

SQL> ALTER DATABASE RENAME FILE '+FRADG/orcl/onlinelog/group_10.303.740450469' TO '/data/oradata/orcl/redo_10_2_2.log';

Database altered.

SQL> ALTER DATABASE RENAME FILE '+DATADG/orcl/onlinelog/group_11.301.740450469' TO '/data/oradata/orcl/redo_11_2_1.log';

Database altered.

SQL> ALTER DATABASE RENAME FILE '+FRADG/orcl/onlinelog/group_11.268.740450469' TO '/data/oradata/orcl/redo_11_2_2.log';

Database altered.

SQL> ALTER DATABASE RENAME FILE '+DATADG/orcl/onlinelog/group_12.258.740450471' TO '/data/oradata/orcl/redo_12_2_1.log';

Database altered.

SQL> ALTER DATABASE RENAME FILE '+FRADG/orcl/onlinelog/group_12.310.740450471' TO '/data/oradata/orcl/redo_12_2_2.log';

Database altered.

SQL> RECOVER DATABASE UNTIL CANCEL USING BACKUP CONTROLFILE
ORA-00279: change 913655386 generated at 01/17/2011 04:40:28 needed for thread 2
ORA-00289: suggestion : /data/oradata/orcl/archivelog/2_13941_738351476.dbf
ORA-00280: change 913655386 for thread 2 is in sequence #13941


Specify log: {=suggested | filename | AUTO | CANCEL}

ORA-00279: change 913655386 generated at 01/17/2011 04:40:33 needed for thread 1
ORA-00289: suggestion : /data/oradata/orcl/archivelog/1_868_738351476.dbf
ORA-00280: change 913655386 for thread 1 is in sequence #868


Specify log: {=suggested | filename | AUTO | CANCEL}

ORA-00279: change 913655567 generated at 01/17/2011 04:45:37 needed for thread 1
ORA-00289: suggestion : /data/oradata/orcl/archivelog/1_869_738351476.dbf
ORA-00280: change 913655567 for thread 1 is in sequence #869
ORA-00278: log file '/data/oradata/orcl/archivelog/1_868_738351476.dbf' no
longer needed for this recovery


Specify log: {=suggested | filename | AUTO | CANCEL}

ORA-00279: change 913655570 generated at 01/17/2011 04:45:12 needed for thread 2
ORA-00289: suggestion : /data/oradata/orcl/archivelog/2_13942_738351476.dbf
ORA-00280: change 913655570 for thread 2 is in sequence #13942
ORA-00278: log file '/data/oradata/orcl/archivelog/2_13941_738351476.dbf' no
longer needed for this recovery


Specify log: {=suggested | filename | AUTO | CANCEL}

ORA-00279: change 913670182 generated at 01/17/2011 07:00:05 needed for thread 2
ORA-00289: suggestion : /data/oradata/orcl/archivelog/2_13943_738351476.dbf
ORA-00280: change 913670182 for thread 2 is in sequence #13943
ORA-00278: log file '/data/oradata/orcl/archivelog/2_13942_738351476.dbf' no
longer needed for this recovery


Specify log: {=suggested | filename | AUTO | CANCEL}
/data/oradata/orcl/archivelog/archive_2_13943.log
ORA-00279: change 913670208 generated at 01/17/2011 07:00:34 needed for thread 1
ORA-00289: suggestion : /data/oradata/orcl/archivelog/1_870_738351476.dbf
ORA-00280: change 913670208 for thread 1 is in sequence #870
ORA-00278: log file '/data/oradata/orcl/archivelog/1_869_738351476.dbf' no
longer needed for this recovery


Specify log: {=suggested | filename | AUTO | CANCEL}
/data/oradata/orcl/archivelog/archive_1_870.log
ORA-00279: change 913768457 generated at 01/17/2011 08:36:12 needed for thread 2
ORA-00289: suggestion : /data/oradata/orcl/archivelog/2_13944_738351476.dbf
ORA-00280: change 913768457 for thread 2 is in sequence #13944
ORA-00278: log file '/data/oradata/orcl/archivelog/archive_2_13943.log' no
longer needed for this recovery


Specify log: {=suggested | filename | AUTO | CANCEL}
/data/oradata/orcl/archivelog/archive_2_13944.log
ORA-00279: change 913891849 generated at 01/17/2011 09:27:57 needed for thread 2
ORA-00289: suggestion : /data/oradata/orcl/archivelog/2_13945_738351476.dbf
ORA-00280: change 913891849 for thread 2 is in sequence #13945
ORA-00278: log file '/data/oradata/orcl/archivelog/archive_2_13944.log' no
longer needed for this recovery


Specify log: {=suggested | filename | AUTO | CANCEL}
/data/oradata/orcl/archivelog/archive_2_13945.log
ORA-00279: change 913979720 generated at 01/17/2011 10:06:52 needed for thread 2
ORA-00289: suggestion : /data/oradata/orcl/archivelog/2_13946_738351476.dbf
ORA-00280: change 913979720 for thread 2 is in sequence #13946
ORA-00278: log file '/data/oradata/orcl/archivelog/archive_2_13945.log' no
longer needed for this recovery


Specify log: {=suggested | filename | AUTO | CANCEL}
/data/oradata/orcl/archivelog/archive_2_13946.log
ORA-00279: change 913979790 generated at 01/17/2011 10:07:20 needed for thread 1
ORA-00289: suggestion : /data/oradata/orcl/archivelog/1_871_738351476.dbf
ORA-00280: change 913979790 for thread 1 is in sequence #871
ORA-00278: log file '/data/oradata/orcl/archivelog/archive_1_870.log' no longer
needed for this recovery


Specify log: {=suggested | filename | AUTO | CANCEL}
cancel
Media recovery cancelled.
SQL> SELECT NAME FROM V$TEMPFILE;

NAME
--------------------------------------------------------------------------------
+DATADG/orcl/tempfile/temp.263.736805823

SQL> ALTER DATABASE RENAME FILE '+DATADG/orcl/tempfile/temp.263.736805823' TO '/data/oradata/orcl/temp01.dbf';

Database altered.

SQL> ALTER DATABASE TEMPFILE '/data/oradata/orcl/temp01.dbf' DROP;     

Database altered.

SQL> ALTER DATABASE OPEN RESETLOGS;

Database altered.

SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '/data/oradata/orcl/temp01.dbf' SIZE 4G;

Tablespace altered.

重建臨時檔案,然後將資料庫開啟,至此資料庫恢復完畢。

如果資料庫打算長期適用,可以根據現有的pfile建立SPFILE,方便以後的管理操作。

 

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

相關文章