签到成功

知道了

CNDBA社区CNDBA社区

Oracle 12c RAC 连接PDB 报ORA-01033 ORACLE initialization or shutdown in progress 错误解决方法

2016-09-06 01:15 7422 0 原创 Oracle 18c
作者: dave


http://www.cndba.cn/dave/article/217http://www.cndba.cn/dave/article/217

  在12c RAC 中每个节点的CDB 管理自己的PDB,也就是说,当我们在节点1对PDB进行操作时,不会影响到节点2的PDB.

示例:http://www.cndba.cn/dave/article/217

--节点1:
SQL> show pdbs

    CON_ID CON_NAME              OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
     2 PDB$SEED              READ ONLY  NO
     3 DAVE               MOUNTED
SQL> alter pluggable database dave open;

Pluggable database altered.

SQL> show pdbs

    CON_ID CON_NAME              OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
     2 PDB$SEED              READ ONLY  NO
     3 DAVE               READ WRITE NO
SQL>




--节点2:http://www.cndba.cn/dave/article/217

SQL> show pdbs

    CON_ID CON_NAME              OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
     2 PDB$SEED              READ ONLY  NO
     3 DAVE               MOUNTED
SQL>



在客户端通过service 连接时:

http://www.cndba.cn/dave/article/217

cndba_rac=
(DESCRIPTION =
 (ADDRESS_LIST =
  (LOAD_BALANCE = yes)
  (FAILOVER=ON)
  (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.31)(PORT = 1521))
  (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.41)(PORT = 1521))
 )
 (CONNECT_DATA =
   (SERVICE_NAME =dave)
   (failover_mode=(type=select)(method=basic))
   )
)


因为这种方式配置了负载均衡和故障转移,先tnsping 测试service是否正常。

http://www.cndba.cn/dave/article/217
http://www.cndba.cn/dave/article/217
http://www.cndba.cn/dave/article/217

C:/Users/Dave>tnsping cndba_rac

TNS Ping Utility for 64-bit Windows: Version 11.2.0.4.0 - Production on 27-OCT-2015 19:29:14

Copyright (c) 1997, 2013, Oracle.  All rights reserved.

Used parameter files:
D:/app/Dave/product/11.2.0/dbhome_1/NETWORK/ADMIN/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (LOAD_BALANCE = yes) (FAILOVER=ON) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.31)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.41)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME =dave) (failover_mode=(type=select)(method=basic))))
OK (80 msec)


--连接到PDB:http://www.cndba.cn/dave/article/217

C:/Users/Dave>sqlplus system/oracle@cndba_rac

SQL*Plus: Release 11.2.0.4.0 Production on Tue Oct 27 19:41:19 2015

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
cndba1

SQL>


此时连接到节点1,所以正常连接,但是RAC 有负载均衡的概念,如果连接到节点2,就会异常,我们这里多连接几次。

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

C:/Users/Dave>sqlplus system/oracle@cndba_rac

SQL*Plus: Release 11.2.0.4.0 Production on Tue Oct 27 19:43:12 2015

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options

C:/Users/Dave>sqlplus system/oracle@cndba_rac

SQL*Plus: Release 11.2.0.4.0 Production on Tue Oct 27 19:43:35 2015

Copyright (c) 1982, 2013, 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:




ORA-01033的错误出现,但如果我们看CDB,都是正常的,只是PDB没有open。

解决方法就是在启动CDB的时候,一定要检查PDB 是否都mount了,可以创建触发器,在启动CDB的时候,自动open PDB.

触发器如下:

CREATE OR REPLACE TRIGGER open_pdbs
  AFTER STARTUP ON DATABASE
BEGIN
   EXECUTE IMMEDIATE 'ALTER PLUGGABLE DATABASE ALL OPEN';
END open_pdbs;
/


http://www.cndba.cn/dave/article/217

版权声明:本文为博主原创文章,未经博主允许不得转载。

用户评论
* 以下用户言论只代表其个人观点,不代表CNDBA社区的观点或立场
dave

dave

关注

人的一生应该是这样度过的:当他回首往事的时候,他不会因为虚度年华而悔恨,也不会因为碌碌无为而羞耻;这样,在临死的时候,他就能够说:“我的整个生命和全部精力,都已经献给世界上最壮丽的事业....."

  • 2286
    原创
  • 3
    翻译
  • 581
    转载
  • 197
    评论
  • 访问:8223900次
  • 积分:4440
  • 等级:核心会员
  • 排名:第1名
精华文章
    最新问题
    查看更多+
    热门文章
      热门用户
      推荐用户
        Copyright © 2016 All Rights Reserved. Powered by CNDBA · 皖ICP备2022006297号-1·

        QQ交流群

        注册联系QQ