如何重建RAC的控制文件(3)

SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '+DATA/racdb/tempfile/temp.263.783272821'
  2      SIZE 39845888  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M; 《==别忘了添加原来的临时文件到临时表空间中

Tablespace altered.

6.将cluster_database设为true :
 SQL> alter system set cluster_database=true scope=spfile;

System altered.

SQL> shutdown immediate;
 Database closed.
 Database dismounted.
 ORACLE instance shut down.
 SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
 With the Partitioning, Real Application Clusters, OLAP, Data Mining
 and Real Application Testing options

7. 启动所有实例:
[oracle@rac1 trace]$ srvctl start database -d RACDB
 [oracle@rac1 trace]$ srvctl status database -d RACDB
 Instance RACDB1 is running on node rac1
 Instance RACDB2 is running on node rac2

TESTCASE2
 ---------------------------
用resetlogs模式重建控制文件

Test Process:

1.首先生成重建控制文件的脚本:
SQL> alter database backup controlfile to trace;

Database altered.

2. 数据库的Alert log中也会详细输出这个文件的路径和名字:
alter database backup controlfile to trace
 Backup controlfile written to trace file /u01/app/oracle/diag/rdbms/racdb/RACDB1/trace/RACDB1_ora_5649.trc

3. 设置cluster_database=false:
SQL> alter system set cluster_database=false scope=spfile;
 System altered.

否则,在重建控制文件的时候会报下面的错误:

CREATE CONTROLFILE REUSE DATABASE "RACDB" RESETLOGS  ARCHIVELOG
 *
 ERROR at line 1:
 ORA-01503: CREATE CONTROLFILE failed
 ORA-12720: operation requires database is in EXCLUSIVE mode

4. 停止所有数据库实例:
[oracle@rac1 trace]$ srvctl stop database -d RACDB
 [oracle@rac1 trace]$ srvctl status database -d RACDB
 Instance RACDB1 is not running on node rac1
 Instance RACDB2 is not running on node rac2

5. 用resetlogs模式重建控制文件:

[oracle@rac1 trace]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Tue Jan 8 12:45:25 2013

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

Connected to an idle instance.

SQL> startup nomount;
 ORACLE instance started.

Total System Global Area  739065856 bytes
 Fixed Size                  2232032 bytes
 Variable Size            549454112 bytes
 Database Buffers          184549376 bytes
 Redo Buffers                2830336 bytes

SQL> CREATE CONTROLFILE REUSE DATABASE "RACDB" RESETLOGS  ARCHIVELOG
  2      MAXLOGFILES 192
  3      MAXLOGMEMBERS 3
  4      MAXDATAFILES 1024
  5      MAXINSTANCES 32
  6      MAXLOGHISTORY 292
  7  LOGFILE
  8    GROUP 1 (
  9      '+DATA/racdb/onlinelog/group_1.261.783272805',
 10      '+RECO/racdb/onlinelog/group_1.257.783272807'
 11    ) SIZE 50M BLOCKSIZE 512,
 12    GROUP 2 (
 13      '+DATA/racdb/onlinelog/group_2.262.783272807',
 14      '+RECO/racdb/onlinelog/group_2.258.783272809'
 15    ) SIZE 50M BLOCKSIZE 512
 16  -- STANDBY LOGFILE
 17  DATAFILE
 18    '+DATA/racdb/datafile/system.256.783272707',
 19    '+DATA/racdb/datafile/sysaux.257.783272707',
 20    '+DATA/racdb/datafile/undotbs1.258.783272707',
 21    '+DATA/racdb/datafile/users.259.783272707',
 22    '+DATA/racdb/datafile/example.264.783272831',
 23    '+DATA/racdb/datafile/undotbs2.265.783273081'
 24  CHARACTER SET AL32UTF8
 25  ;

Control file created.

SQL> RECOVER DATABASE USING BACKUP CONTROLFILE UNTIL CANCEL;  <=========必须使用UNTIL CANCEL,否则数据库无法open
 ORA-00279: change 6976933 generated at 01/08/2013 12:45:12 needed for thread 1
 ORA-00289: suggestion : +RECO
 ORA-00280: change 6976933 for thread 1 is in sequence #2


 Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
CANCEL 
 Media recovery cancelled.
 


接下来需要??加其他thread,因为用resetlogs重建controlfile只是增加了thread为1的redo log:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/73473e79156da93c1c289f759f237ee3.html