Oracle rac dataguard sqlplus启动不了数据库
1.问题描述
使用srvctl
命令查看集群节点的数据库状态都是正常的running状态。
[oracle@stbrac2 dbs]$ srvctl status database -d stbrac
Instance stbrac1 is running on node stbrac1
Instance stbrac2 is running on node stbrac2
使用crsctl
命令查询集群的各个服务也是显示正常的。
[oracle@stbrac2 dbs]$ crsctl status res -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr
ONLINE ONLINE stbrac1 STABLE
ONLINE ONLINE stbrac2 STABLE
ora.DATA.dg
ONLINE ONLINE stbrac1 STABLE
ONLINE ONLINE stbrac2 STABLE
ora.LISTENER.lsnr
ONLINE ONLINE stbrac1 STABLE
ONLINE ONLINE stbrac2 STABLE
ora.OCR.dg
ONLINE ONLINE stbrac1 STABLE
ONLINE ONLINE stbrac2 STABLE
ora.chad
ONLINE ONLINE stbrac1 STABLE
ONLINE ONLINE stbrac2 STABLE
ora.net1.network
ONLINE ONLINE stbrac1 STABLE
ONLINE ONLINE stbrac2 STABLE
ora.ons
ONLINE ONLINE stbrac1 STABLE
ONLINE ONLINE stbrac2 STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE stbrac1 STABLE
ora.MGMTLSNR
1 ONLINE ONLINE stbrac1 169.254.142.38 10.0.
0.81,STABLE
ora.asm
1 ONLINE ONLINE stbrac1 Started,STABLE
2 ONLINE ONLINE stbrac2 Started,STABLE
3 OFFLINE OFFLINE STABLE
ora.cvu
1 ONLINE ONLINE stbrac1 STABLE
ora.mgmtdb
1 ONLINE ONLINE stbrac1 Open,STABLE
ora.qosmserver
1 ONLINE ONLINE stbrac1 STABLE
ora.scan1.vip
1 ONLINE ONLINE stbrac1 STABLE
ora.stbrac.db
1 ONLINE INTERMEDIATE stbrac1 Mounted (Closed),HOM
E=/u01/app/oracle/pr
oduct/12.2.0/dbhome_
1,STABLE
2 ONLINE INTERMEDIATE stbrac2 Mounted (Closed),HOM
E=/u01/app/oracle/pr
oduct/12.2.0/dbhome_
1,STABLE
ora.stbrac1.vip
1 ONLINE ONLINE stbrac1 STABLE
ora.stbrac2.vip
1 ONLINE ONLINE stbrac2 STABLE
--------------------------------------------------------------------------------
使用sqlplus
命令进入到客户端控制台,确显示Connected to an idle instance.
[oracle@stbrac2 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Sun Sep 26 07:18:09 2021
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/12.2.0/dbhome_1/dbs/initrac2.ora'
SQL> show parameter dg_broker
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0
SQL>
2.解决办法
执行startup nomount
命令后报错找不到‘/u01/app/oracle/product/12.2.0/dbhome_1/dbs/initrac2.ora’参数文件。由于这台机器是dataguard的rac备机,服务名应该是stbrac2,但是这里提示是initrac2.ora文件不存在,因此我怀疑是ORACLE_SID设置错了。
export ORACLE_SID=stbrac2
修改完ORACLE_SID环境变量后重新进入sqlplus发现正常了。
[oracle@stbrac2 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Sun Sep 26 10:12:44 2021
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> show parameter dg_broker
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
dg_broker_config_file1 string +DATA/STBRAC/DGCONFIG/dr1stbra
c.dat
dg_broker_config_file2 string +DATA/STBRAC/DGCONFIG/dr2stbra
c.dat
dg_broker_start boolean TRUE
SQL>