Oracle 11g RAC ASM磁盘全部丢失后的恢复(二)

4.2 修改CRS注册表中相关配置信息

(1) 挂载新的ASM磁盘组

 
  1. [grid@rac1 ~]$ sqlplus / as sysasm
  2. SQL*Plus: Release 11.2.0.3.0 Production on Sat Jul 6 00:16:05 2013
  3. Copyright (c) 1982, 2011, Oracle. All rights reserved.
  4. Connected to:
  5. Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
  6. With the Real Application Clusters and Automatic Storage Management options
  7. SQL>
  8. SQL> selectname,state from v$asm_diskgroup;
  9. NAME STATE
  10. ------------------------------ -----------
  11. SYSTEMDG MOUNTED
  12. ARCLOGDG DISMOUNTED
  13. DATADG DISMOUNTED
  14. SQL> alter diskgroup ARCLOGDG,DATADG mount;
  15. Diskgroup altered.


(2) 更改CRS配置文件中数据库的磁盘组为DATADG和ARCLOGDG

 
  1. [root@rac1 ~]# srvctl modifydatabase -d csdb -a "DATADG,ARCLOGDG"


(3) 禁用并删除原来的磁盘组DATA

 
  1. [root@rac1 ~]# srvctl disable diskgroup -g DATA
  2. [root@rac1 ~]# srvctl remove diskgroup -g DATA
  3. [root@rac1 rac-cluster]# crs_stat -t -v
  4. Name Type R/RA F/FT Target State Host
  5. ----------------------------------------------------------------------
  6. ora....OGDG.dg ora....up.type 0/5 0/ ONLINE ONLINE rac1
  7. ora.DATADG.dg ora....up.type 0/5 0/ ONLINE ONLINE rac1
  8. ora....ER.lsnr ora....er.type 0/5 0/ ONLINE ONLINE rac1
  9. ora....N1.lsnr ora....er.type 0/5 0/0 ONLINE ONLINE rac1
  10. ora.asm ora.asm.type 0/5 0/ ONLINE ONLINE rac1
  11. ora.csdb.db ora....se.type 0/2 0/1 ONLINE OFFLINE
  12. ora.cvu ora.cvu.type 0/5 0/0 ONLINE ONLINE rac1
  13. ora.gsd ora.gsd.type 0/5 0/ OFFLINE OFFLINE
  14. ora....network ora....rk.type 0/5 0/ ONLINE ONLINE rac1
  15. ora.oc4j ora.oc4j.type 0/1 0/2 ONLINE ONLINE rac1
  16. ora.ons ora.ons.type 0/3 0/ ONLINE ONLINE rac1
  17. ora....SM1.asm application 0/5 0/0 ONLINE ONLINE rac1
  18. ora....C1.lsnr application 0/5 0/0 ONLINE ONLINE rac1
  19. ora.rac1.gsd application 0/5 0/0 OFFLINE OFFLINE
  20. ora.rac1.ons application 0/3 0/0 ONLINE ONLINE rac1
  21. ora.rac1.vip ora....t1.type 0/0 0/0 ONLINE ONLINE rac1
  22. ora.rac2.vip ora....t1.type 0/0 0/0 ONLINE ONLINE rac1
  23. ora.scan1.vip ora....ip.type 0/0 0/0 ONLINE ONLINE rac1


(4) 在OCR注册表中修改Oracle数据库参数文件的位置

 
  1. [root@rac1 ~]# srvctl modifydatabase -d csdb -p +DATADG/csdb/spfilecsdb.ora


4.3 恢复数据库


(1) 查看备份文件路径和名称

 
  1. [root@rac1 ~]# su - oracle
  2. [oracle@rac1 ~]$
  3. [oracle@rac1 ~]$ cd /u01/app/oracle/backup
  4. [oracle@rac1 backup]$ ll
  5. total 221796
  6. -rw-r----- 1 oracle asmadmin 5357568 Jul 5 15:19 arc_819991156_9.bk
  7. -rw-r----- 1 oracle asmadmin 2560 Jul 5 15:19 arc_819991158_11.bk
  8. -rw-r----- 1 oracle asmadmin 203104256 Jul 5 15:18 CSDB_819991120_5.bk
  9. -rw-r----- 1 oracle asmadmin 18546688 Jul 5 15:19 ctl_file_0coe04jq_1_1_20130705.ctl
  10. -rw-r----- 1 oracle asmadmin 98304 Jul 5 15:19 spfile_0doe04js_1_1_20130705
  11. [oracle@rac1 backup]$


(2) 创建一个基本的启动参数文件,以便启动数据库到nomout状态恢复spfile

 
  1. [oracle@rac1 ~]$ touch /u01/app/oracle/backup/init.ora
  2. [oracle@rac1 ~]$ vi /u01/app/oracle/backup/init.ora
  3. *.db_name='csdb'
  4. *.remote_login_passwordfile='exclusive'


(3) 使用刚创建的参数文件将数据库启动到nomount状态

 
  1. [oracle@rac1 ~]$ sqlplus / as sysdba
  2. SQL*Plus: Release 11.2.0.3.0 Production on Sat Jul 6 13:56:06 2013
  3. Copyright (c) 1982, 2011, Oracle. All rights reserved.
  4. Connected to an idle instance.
  5. SQL> startup nomount pfile='/u01/app/oracle/backup/init.ora';
  6. ORACLE instance started.
  7. Total System Global Area 238034944 bytes
  8. Fixed Size 2227136 bytes
  9. Variable Size 180356160 bytes
  10. Database Buffers 50331648 bytes
  11. Redo Buffers 5120000 bytes
  12. SQL>


(4) 使用RMAN恢复SPFILE到ASM磁盘组DATADG

 
  1. [oracle@rac1 ~]$ rman target /
  2. Recovery Manager: Release 11.2.0.3.0 - Production on Sat Jul 6 13:59:26 2013
  3. Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
  4. connected to target database: CSDB (not mounted)
  5. RMAN> restore spfile to'+DATADG/csdb/spfilecsdb.ora'from'/u01/app/oracle/backup/spfile_0doe04js_1_1_20130705';
  6. Starting restore at 06-JUL-13
  7. using channel ORA_DISK_1
  8. channel ORA_DISK_1: restoring spfile from AUTOBACKUP /u01/app/oracle/backup/spfile_0doe04js_1_1_20130705
  9. channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
  10. Finished restore at 06-JUL-13


(5) 使用恢复后spfile启动数据库,并修改control_files,db_recovery_file_dest,log_archive_dest等存在旧路径的参数值。

 
  1. [oracle@rac1 ~]$ vi $ORACLE_HOME/dbs/initcsdb1.ora
  2. SPFILE='+DATADG/csdb/spfilecsdb.ora'
  3. [oracle@rac1 ~]$ sqlplus / as sysdba
  4. SQL*Plus: Release 11.2.0.3.0 Production on Sat Jul 6 14:11:58 2013
  5. Copyright (c) 1982, 2011, Oracle. All rights reserved.
  6. Connected to:
  7. Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
  8. With the Partitioning, Real Application Clusters, OLAP, Data Mining
  9. andReal Application Testing options
  10. SQL> startup nomount force
  11. ORACLE instance started.
  12. Total System Global Area 1653518336 bytes
  13. Fixed Size 2228904 bytes
  14. Variable Size 1073745240 bytes
  15. Database Buffers 570425344 bytes
  16. Redo Buffers 7118848 bytes
  17. SQL>
  18. SQL> show parameter control_files
  19. NAME TYPE VALUE
  20. ------------------------------------ ----------- ------------------------------
  21. control_files string +DATA/csdb/control01.ctl, +DAT
  22. A/csdb/control02.ctl
  23. SQL>
  24. SQL> alter system set control_files='+DATADG/csdb/control01.ctl','+DATADG/csdb/control02.ctl' scope=spfile
  25. System altered.
  26. SQL> alter system set db_recovery_file_dest='+DATADG' scope=spfile;
  27. System altered.
  28. SQL> alter system set log_archive_dest_1='LOCATION=+ARCLOGDG' scope=spfile;
  29. System altered.
  30. SQL> startup force nomount;
  31. ORACLE instance started.
  32. Total System Global Area 1653518336 bytes
  33. Fixed Size 2228904 bytes
  34. Variable Size 1073745240 bytes
  35. Database Buffers 570425344 bytes
  36. Redo Buffers 7118848 bytes


(6) 查看数据库的DBID

 
  1. [oracle@rac1 ~]$ strings /u01/app/oracle/backup/CSDB_819991120_5.bk | grep MAXVALUE,
  2. 返回的值类似下面的例子,其中那一窜数字即为DBID。
  3. ...
  4. MAXVALUE, MAXVALUE!
  5. 3042905279, MAXVALUE,
  6. 3042905279, MAXVALUE,
  7. ...


(7) 恢复控制文件到新的ASM磁盘组DATADG

 
  1. [oracle@rac1 ~]$ rman target /
  2. Recovery Manager: Release 11.2.0.3.0 - Production on Sat Jul 6 14:28:28 2013
  3. Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
  4. connected to target database: CSDB (not mounted)
  5. RMAN> set dbid=3042905279
  6. executing command: SET DBID
  7. RMAN> restore controlfile from'/u01/app/oracle/backup/ctl_file_0coe04jq_1_1_20130705.ctl';
  8. Starting restore at 06-JUL-13
  9. using target database control file insteadof recovery catalog
  10. allocated channel: ORA_DISK_1
  11. channel ORA_DISK_1: SID=18 instance=csdb1 device type=DISK
  12. channel ORA_DISK_1: restoring control file
  13. channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
  14. output file name=+DATADG/csdb/control01.ctl
  15. output file name=+DATADG/csdb/control02.ctl
  16. Finished restore at 06-JUL-13


(8) 进入SQLPLUS,查看旧数据文件信息

 
  1. [oracle@rac1 ~]$ sqlplus / as sysdba
  2. SQL*Plus: Release 11.2.0.3.0 Production on Sat Jul 6 14:41:12 2013
  3. Copyright (c) 1982, 2011, Oracle. All rights reserved.
  4. Connected to:
  5. Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
  6. With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
  7. Data Mining andReal Application Testing options
  8. SQL> alterdatabase mount;
  9. Database altered.
  10. SQL> col name format a50
  11. SQL> select file#,namefrom v$datafile;
  12. FILE# NAME
  13. ---------- --------------------------------------------------
  14. 1 +DATA/csdb/datafile/system.260.819979847
  15. 2 +DATA/csdb/datafile/sysaux.261.819979871
  16. 3 +DATA/csdb/datafile/undotbs1.262.819979889
  17. 4 +DATA/csdb/datafile/undotbs2.264.819979905
  18. 5 +DATA/csdb/datafile/users.265.819979913


(9) 使用RMAN恢复数据库

 
  1. RMAN> run{
  2. 2> set newname for datafile 1 to'+DATADG/csdb/datafile/system.260.819979847';
  3. 3> set newname for datafile 2 to'+DATADG/csdb/datafile/sysaux.261.819979871';
  4. 4> set newname for datafile 3 to'+DATADG/csdb/datafile/undotbs1.262.819979889';
  5. 5> set newname for datafile 4 to'+DATADG/csdb/datafile/undotbs2.264.819979905';
  6. 6> set newname for datafile 5 to'+DATADG/csdb/datafile/users.265.819979913';
  7. 7> restore database;
  8. 8> switch datafile all;
  9. 9> recover database;
  10. 10> }
  11. executing command: SET NEWNAME
  12. released channel: ORA_DISK_1
  13. executing command: SET NEWNAME
  14. executing command: SET NEWNAME
  15. executing command: SET NEWNAME
  16. executing command: SET NEWNAME
  17. Starting restore at 07-JUL-13
  18. Starting implicit crosscheck backup at 07-JUL-13
  19. allocated channel: ORA_DISK_1
  20. Crosschecked 10 objects
  21. Finished implicit crosscheck backup at 07-JUL-13
  22. Starting implicit crosscheck copy at 07-JUL-13
  23. using channel ORA_DISK_1
  24. Finished implicit crosscheck copy at 07-JUL-13
  25. searching forall files in the recovery area
  26. cataloging files...
  27. no files cataloged
  28. using channel ORA_DISK_1
  29. channel ORA_DISK_1: starting datafile backup set restore
  30. channel ORA_DISK_1: specifying datafile(s) to restore from backup set
  31. channel ORA_DISK_1: restoring datafile 00002 to +DATADG/csdb/datafile/sysaux.261.819979871
  32. channel ORA_DISK_1: restoring datafile 00003 to +DATADG/csdb/datafile/undotbs1.262.819979889
  33. channel ORA_DISK_1: reading from backup piece /u01/app/oracle/backup/CSDB_819991120_6.bk
  34. channel ORA_DISK_1: piece handle=/u01/app/oracle/backup/CSDB_819991120_6.bk tag=ORCL_HOT_DB_BK
  35. channel ORA_DISK_1: restored backup piece 1
  36. channel ORA_DISK_1: restore complete, elapsed time: 00:00:46
  37. channel ORA_DISK_1: starting datafile backup set restore
  38. channel ORA_DISK_1: specifying datafile(s) to restore from backup set
  39. channel ORA_DISK_1: restoring datafile 00001 to +DATADG/csdb/datafile/system.260.819979847
  40. channel ORA_DISK_1: restoring datafile 00004 to +DATADG/csdb/datafile/undotbs2.264.819979905
  41. channel ORA_DISK_1: restoring datafile 00005 to +DATADG/csdb/datafile/users.265.819979913
  42. channel ORA_DISK_1: reading from backup piece /u01/app/oracle/backup/CSDB_819991120_5.bk
  43. channel ORA_DISK_1: piece handle=/u01/app/oracle/backup/CSDB_819991120_5.bk tag=ORCL_HOT_DB_BK
  44. channel ORA_DISK_1: restored backup piece 1
  45. channel ORA_DISK_1: restore complete, elapsed time: 00:00:35
  46. Finished restore at 07-JUL-13
  47. datafile 1 switched to datafile copy
  48. input datafile copy RECID=6 STAMP=820112831 file name=+DATADG/csdb/datafile/system.284.820112797
  49. datafile 2 switched to datafile copy
  50. input datafile copy RECID=7 STAMP=820112831 file name=+DATADG/csdb/datafile/sysaux.282.820112751
  51. datafile 3 switched to datafile copy
  52. input datafile copy RECID=8 STAMP=820112831 file name=+DATADG/csdb/datafile/undotbs1.283.820112751
  53. datafile 4 switched to datafile copy
  54. input datafile copy RECID=9 STAMP=820112831 file name=+DATADG/csdb/datafile/undotbs2.285.820112797
  55. datafile 5 switched to datafile copy
  56. input datafile copy RECID=10 STAMP=820112831 file name=+DATADG/csdb/datafile/users.286.820112797
  57. Starting recover at 07-JUL-13
  58. using channel ORA_DISK_1
  59. starting media recovery
  60. channel ORA_DISK_1: starting archived log restore todefault destination
  61. channel ORA_DISK_1: restoring archived log
  62. archived log thread=1 sequence=15
  63. channel ORA_DISK_1: reading from backup piece /u01/app/oracle/backup/arc_819991156_9.bk
  64. channel ORA_DISK_1: piece handle=/u01/app/oracle/backup/arc_819991156_9.bk tag=TAG20130705T151916
  65. channel ORA_DISK_1: restored backup piece 1
  66. channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
  67. archived log file name=+ARCLOGDG/csdb/archivelog/2013_07_07/thread_1_seq_15.256.820112833 thread=1 sequence=15
  68. channel ORA_DISK_1: starting archived log restore todefault destination
  69. channel ORA_DISK_1: restoring archived log
  70. archived log thread=2 sequence=2
  71. channel ORA_DISK_1: restoring archived log
  72. archived log thread=1 sequence=16
  73. channel ORA_DISK_1: reading from backup piece /u01/app/oracle/backup/arc_819991156_10.bk
  74. channel ORA_DISK_1: piece handle=/u01/app/oracle/backup/arc_819991156_10.bk tag=TAG20130705T151916
  75. channel ORA_DISK_1: restored backup piece 1
  76. channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
  77. archived log file name=+ARCLOGDG/csdb/archivelog/2013_07_07/thread_2_seq_2.257.820112835 thread=2 sequence=2
  78. channel default: deleting archived log(s)
  79. archived log file name=+ARCLOGDG/csdb/archivelog/2013_07_07/thread_1_seq_15.256.820112833 RECID=5 STAMP=820112832
  80. archived log file name=+ARCLOGDG/csdb/archivelog/2013_07_07/thread_1_seq_16.258.820112835 thread=1 sequence=16
  81. channel default: deleting archived log(s)
  82. archived log file name=+ARCLOGDG/csdb/archivelog/2013_07_07/thread_2_seq_2.257.820112835 RECID=7 STAMP=820112834
  83. channel ORA_DISK_1: starting archived log restore todefault destination
  84. channel ORA_DISK_1: restoring archived log
  85. archived log thread=2 sequence=3
  86. channel ORA_DISK_1: reading from backup piece /u01/app/oracle/backup/arc_819991158_11.bk
  87. channel ORA_DISK_1: piece handle=/u01/app/oracle/backup/arc_819991158_11.bk tag=TAG20130705T151916
  88. channel ORA_DISK_1: restored backup piece 1
  89. channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
  90. archived log file name=+ARCLOGDG/csdb/archivelog/2013_07_07/thread_2_seq_3.257.820112837 thread=2 sequence=3
  91. channel default: deleting archived log(s)
  92. archived log file name=+ARCLOGDG/csdb/archivelog/2013_07_07/thread_2_seq_3.257.820112837 RECID=8 STAMP=820112835
  93. unable to find archived log
  94. archived log thread=2 sequence=4
  95. RMAN-00571: ===========================================================
  96. RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
  97. RMAN-00571: ===========================================================
  98. RMAN-03002: failure of recover command at 07/07/2013 01:07:16
  99. RMAN-06054: media recovery requesting unknown archived log for thread 2 withsequence 4 and starting SCN of 323980


(10) 更改REDO LOG位置信息

 
  1. SQL> select member from v$logfile;
  2. MEMBER
  3. --------------------------------------------------------------------------------
  4. +DATA/csdb/redo01.log
  5. +DATA/csdb/redo02.log
  6. +DATA/csdb/redo03.log
  7. +DATA/csdb/redo04.log
  8. SQL> alterdatabase rename file '+DATA/csdb/redo01.log'to'+DATADG/csdb/redo01.log';
  9. Database altered.
  10. SQL> alterdatabase rename file '+DATA/csdb/redo02.log'to'+DATADG/csdb/redo02.log';
  11. Database altered.
  12. SQL> alterdatabase rename file '+DATA/csdb/redo03.log'to'+DATADG/csdb/redo03.log';
  13. Database altered.
  14. SQL> alterdatabase rename file '+DATA/csdb/redo04.log'to'+DATADG/csdb/redo04.log';
  15. Database altered.


(11) 打开数据库

 
  1. SQL> alterdatabaseopen resetlogs;
  2. Database altered.


(12) 更改TEMP表空间文件位置

 
  1. SQL> selectnamefrom v$tempfile;
  2. NAME
  3. --------------------------------------------------------------------------------
  4. +DATA/csdb/tempfile/temp.263.819979895
  5. SQL> alter tablespace tempadd tempfile '+DATADG';
  6. Tablespace altered.
  7. SQL> alter tablespace tempdrop tempfile '+DATA/csdb/tempfile/temp.263.819979895';
  8. Tablespace altered


4.4 完成恢复操作

(1) 在其他RAC节点上更改OCR路径

 
  1. [root@rac2 ~]# vi /etc/oracle/ocr.loc
  2. ocrconfig_loc=+SYSTEMDG
  3. local_only=FALSE


(2) 在恢复节点上重启CRS

 
  1. [root@rac1 ~]# crsctl stop crs
  2. [root@rac1 ~]# crsctl start has


(3) 在其他节点上启动CRS

 
    1. [root@rac2 ~]# crsctl start crs

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25542870/viewspace-2144777/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/25542870/viewspace-2144777/

你可能感兴趣的:(Oracle 11g RAC ASM磁盘全部丢失后的恢复(二))