【ORACLE】重写控制文件

[oracle@rac01 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Mar 15 23:45:02 2018
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area  784998400 bytes
Fixed Size                    2257352 bytes
Variable Size                  541068856 bytes
Database Buffers          239075328 bytes
Redo Buffers                    2596864 bytes
ORA-00205: error in identifying control file, check alert log for more info
CREATE CONTROLFILE REUSE DATABASE "proc" NORESETLOGS  NOARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 '+DATA/proc/onlinelog/group_1.257.965585459'  SIZE 50M BLOCKSIZE 512,
  GROUP 2 '+DATA/proc/onlinelog/group_2.258.965585467' SIZE 50M BLOCKSIZE 512,
  GROUP 3 '+DATA/proc/onlinelog/group_3.265.965591745' SIZE 50M BLOCKSIZE 512,
  GROUP 4 '+DATA/proc/onlinelog/group_4.266.965591749' SIZE 50M BLOCKSIZE 512,
  GROUP 5 '+DATA/proc/onlinelog/group_5.268.966135797' SIZE 50M BLOCKSIZE 512,
  GROUP 6 '+DATA/proc/onlinelog/group_6.269.966135801' SIZE 50M BLOCKSIZE 512,
  GROUP 7 '+DATA/proc/onlinelog/group_7.270.966135807' SIZE 50M BLOCKSIZE 512,
  GROUP 8 '+DATA/proc/onlinelog/group_8.271.966135869' SIZE 50M BLOCKSIZE 512,
  GROUP 9 '+DATA/proc/onlinelog/group_9.272.966135875' SIZE 50M BLOCKSIZE 512,
  GROUP 10 '+DATA/proc/onlinelog/group_10.273.966135881'  SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
  '+DATA/proc/datafile/SYSAUX.260.965585511',
  '+DATA/proc/datafile/SYSTEM.259.965585479',
   '+DATA/proc/datafile/UNDOTBS1.261.965585527',
  '+DATA/proc/datafile/UNDOTBS2.263.965585563',
   '+DATA/proc/datafile/USERS.264.965585575'
CHARACTER SET AL32UTF8
-- 在节点1的 nomount状态下执行报错
ORA-01503: CREATE CONTROLFILE failed
ORA-12720: operation requires database is in EXCLUSIVE mode
-- 解决方案
关闭其他节点,保留节点1,并修改节点1的参数文件
SQL> alter system set cluster_database=FALSE scope=spfile sid='*';
System altered.
SQL> shutdown immediate
-- 再次启动数据库到nomount状态,再重建控制文件就可以了
--启动数据库到open状态
SQL> alter database open;
Database altered.
-- 发现asm磁盘组中的控制文件自己生成了
ASMCMD> ls
Current.256.970878297
control02.ctl
-- 启动节点2,说是不能在独占模式下启动数据库
SQL> startup
ORA-01102: cannot mount database in EXCLUSIVE mode
-- 因为控制文件重建了,所以要将参数cluster_database改为true,并从spfile生成pifle,并重启
SQL> alter system set cluster_database=true scope=spfile sid='*';
SQL> create pfile from spfile='注意路径';
SQL> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup
ORACLE instance started.
Total System Global Area  784998400 bytes
Fixed Size                    2257352 bytes
Variable Size                  541068856 bytes
Database Buffers          239075328 bytes
Redo Buffers                    2596864 bytes
Database mounted.
Database opened.
SQL>  show parameter cluster_database;
NAME                                     TYPE         VALUE
------------------------------------ ----------- ------------------------------
cluster_database                     boolean         TRUE
cluster_database_instances             integer         2
File created.
-- 发现节点可以启动到nomount状态了,可是在mount状态依然报错
SQL> startup nomount;
ORACLE instance started.
Total System Global Area  784998400 bytes
Fixed Size                    2257352 bytes
Variable Size                  620760632 bytes
Database Buffers          159383552 bytes
Redo Buffers                    2596864 bytes
SQL>
SQL> alter database mount;
alter database mount
*
ERROR at line 1:
ORA-00205: error in identifying control file, check alert log for more info
-- 查看一下告警日志,可以看到它还在找原来的控制文件,说明spfile没有写入pfile
ORA-00210: cannot open the specified control file
ORA-00202: control file: '+FRA/proc/controlfile/current.256.965585457'
ORA-17503: ksfdopn:2 Failed to open file +FRA/proc/controlfile/current.256.965585457
ORA-15012: ASM file '+FRA/proc/controlfile/current.256.965585457' does not exist
-- 查看spfile发现没有路径
SQL> show parameter spfile
NAME                                     TYPE         VALUE
------------------------------------ ----------- ------------------------------
spfile                                     string
-- 重新设置spfile路径
SQL> alter system set spfile ='+data/proc/spfileproc.ora';
-- 重启
SQL> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area  784998400 bytes
Fixed Size                    2257352 bytes
Variable Size                  620760632 bytes
Database Buffers          159383552 bytes
Redo Buffers                    2596864 bytes
SQL> alter database mount;
Database altered.
SQL> alter database open;
Database altered.
 
上一篇:API网关Kong部署和使用文档


下一篇:DAO接口及实现类