12C -- ORA-01033: ORACLE initialization or shutdown in progress
2017-04-13 19:56 abce 阅读(3522) 评论(0) 编辑 收藏 举报初装oracle 12.2 rac数据库。
登录RAC数据库中第1节点
$ sqlplus '/as sysdba' SQL> select name,open_mode from v$pdbs; NAME OPEN_MODE ------------------------------ ---------- PDB$SEED READ ONLY DB12PDB1 MOUNTED DB12PDB2 MOUNTED PLUG_TEST MOUNTED 打开PDB(plug_test) SQL> alter pluggable database plug_test open; Pluggable database altered. SQL> select name,open_mode from v$pdbs; NAME OPEN_MODE ------------------------------ ---------- PDB$SEED READ ONLY DB12PDB1 MOUNTED DB12PDB2 MOUNTED PLUG_TEST READ WRITE SQL>
尝试通过scan ip连接pdb(plug_test),有时候能登录数据库plug_test;但是有时候会无法登录,并报以下错误:
$ sqlplus robert/robert@plug_test SQL*Plus: Release 12.2.0.1.0 Production on Thu Apr 13 19:04:18 2017 Copyright (c) 1982, 2016, Oracle. All rights reserved. ERROR: ORA-01033: ORACLE initialization or shutdown in progress Process ID: 0 Session ID: 0 Serial number: 0 Enter user-name: ERROR: ORA-01017: invalid username/password; logon denied Enter user-name: ERROR: ORA-01017: invalid username/password; logon denied SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
困惑从这里开始。不明白为何有时能登录,有时又不能登录。
登录第二节点查看pdb状态:
SQL> select name,open_mode from v$pdbs; NAME OPEN_MODE ------------------------------ ---------- PDB$SEED READ ONLY DB12PDB1 MOUNTED DB12PDB2 MOUNTED PLUG_TEST MOUNTED SQL>
从这里可以看出,在第二节点上,实例plug_test处于mounted状态
查看gv$pdbs:
SQL> select inst_id,name,open_mode from gv$pdbs; INST_ID NAME OPEN_MODE ---------- ------------------------------ ---------- 1 PDB$SEED READ ONLY 1 DB12PDB1 MOUNTED 1 DB12PDB2 MOUNTED 1 PLUG_TEST READ WRITE 2 PDB$SEED READ ONLY 2 DB12PDB1 MOUNTED 2 DB12PDB2 MOUNTED 2 PLUG_TEST MOUNTED 8 rows selected. SQL>
这里可以看出,出现上面的问题是因为只在节点1开启了pdb(plug_test)实例。而通过scan ip连接该pdb的时候,scan ip会随机路由,如果路由到第二节点的时候,就会报错无法连接。
为了验证这个问题,增加了一个测试环节。直接通过节点1的vip连接,就不会报上面的错误。
通过查看alter pluggable database 语法可以看出,使用该命令的时候,还要指定参数instances。如果不加,默认是本地实例。
所以,从第二节点启动plug_test实例即可。
alter pluggable database plug_test open instances=('DB12C2');
如果想启动所有实例,可以使用一下命令:
SQL> alter pluggable database plug_test close instances=all;
或者
SQL> alter pluggable database plug_test OPEN instances=('DB12C1','DB12C2');