专栏首页从ORACLE起航,领略精彩的IT技术。测试12.2.0.1RAC PDB级别的Failover

测试12.2.0.1RAC PDB级别的Failover

关键步骤:手工添加服务名A并启动(已验证默认的服务名测试验证无法实现Failover)

[oracle@db90 ~]$ srvctl add service -db orcl -service A -preferred cdb11,cdb12 -pdb pdb1
[oracle@db90 ~]$ srvctl start service -db orcl -service A

完整步骤:

1.确认环境信息

1.1 服务端信息:

SQL> show parameter name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
cdb_cluster_name                     string      orcl
cell_offloadgroup_name               string
db_file_name_convert                 string
db_name                              string      orcl
db_unique_name                       string      orcl
global_names                         boolean     FALSE
instance_name                        string      cdb11
lock_name_space                      string
log_file_name_convert                string
pdb_file_name_convert                string
processor_group_name                 string

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      orcl
SQL> show con_id

CON_ID
------------------------------
1
SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB1                           READ WRITE NO
         4 PDB2                           READ WRITE NO

1.2 客户端tnsnames.ora配置:

PDB=
        (DESCRIPTION =
                (ADDRESS_LIST =
        (LOAD_BALANCE = off)
        (FAILOVER=on)
                (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.90)(PORT = 1521))
                (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.92)(PORT = 1521))
        )
        (CONNECT_DATA =
                (SERVER = DEDICATED)
                (SERVICE_NAME = A)
                (FAILOVER_MODE =
                        (TYPE = SELECT)
                        (METHOD = BASIC)
                        (RETRIES = 180)
                        (DELAY = 5)
                        )
                )
        )

2.手工添加服务并启动

[oracle@db90 ~]$ srvctl add service -db orcl -service A -preferred cdb11,cdb12 -pdb pdb1
[oracle@db90 ~]$ srvctl start service -db orcl -service A

查看服务状态,看到已经成功增加了ora.orcl.a.svc:

[grid@db90 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr
               ONLINE  ONLINE       db90                     STABLE
               ONLINE  ONLINE       db92                     STABLE
ora.DATA.dg
               ONLINE  ONLINE       db90                     STABLE
               ONLINE  ONLINE       db92                     STABLE
ora.FRA.dg
               ONLINE  ONLINE       db90                     STABLE
               ONLINE  ONLINE       db92                     STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       db90                     STABLE
               ONLINE  ONLINE       db92                     STABLE
ora.MGMT.dg
               ONLINE  ONLINE       db90                     STABLE
               ONLINE  ONLINE       db92                     STABLE
ora.OCRVT.dg
               ONLINE  ONLINE       db90                     STABLE
               ONLINE  ONLINE       db92                     STABLE
ora.chad
               ONLINE  ONLINE       db90                     STABLE
               ONLINE  ONLINE       db92                     STABLE
ora.net1.network
               ONLINE  ONLINE       db90                     STABLE
               ONLINE  ONLINE       db92                     STABLE
ora.ons
               ONLINE  ONLINE       db90                     STABLE
               ONLINE  ONLINE       db92                     STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       db92                     STABLE
ora.MGMTLSNR
      1        ONLINE  ONLINE       db92                     169.254.59.133 10.0.
                                                             0.92,STABLE
ora.asm
      1        ONLINE  ONLINE       db90                     Started,STABLE
      2        ONLINE  ONLINE       db92                     Started,STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.cvu
      1        ONLINE  ONLINE       db90                     STABLE
ora.db90.vip
      1        ONLINE  ONLINE       db90                     STABLE
ora.db92.vip
      1        ONLINE  ONLINE       db92                     STABLE
ora.mgmtdb
      1        ONLINE  ONLINE       db92                     Open,STABLE
ora.orcl.a.svc
      1        ONLINE  ONLINE       db90                     STABLE
      2        ONLINE  ONLINE       db92                     STABLE
ora.orcl.db
      1        ONLINE  ONLINE       db90                     Open,HOME=/u01/app/o
                                                             racle/product/12.2.0
                                                             /db_1,STABLE
      2        ONLINE  ONLINE       db92                     Open,HOME=/u01/app/o
                                                             racle/product/12.2.0
                                                             /db_1,STABLE
ora.qosmserver
      1        ONLINE  ONLINE       db90                     STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       db92                     STABLE
--------------------------------------------------------------------------------

3.测试客户端连接到服务端

[oracle@db01 admin]$ sqlplus scott/tiger@pdb

SQL*Plus: Release 11.2.0.4.0 Production on Fri Mar 1 17:35:08 2019

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> show parameter name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
cdb_cluster_name                     string      orcl
cell_offloadgroup_name               string
db_file_name_convert                 string
db_name                              string      orcl
db_unique_name                       string      orcl
global_names                         boolean     FALSE
instance_name                        string      cdb11
lock_name_space                      string
log_file_name_convert                string
pdb_file_name_convert                string
processor_group_name                 string

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      orcl

4.关闭实例1的pdb1

[oracle@db90 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Fri Mar 1 18:21:33 2019

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 pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB1                           READ WRITE NO
         4 PDB2                           READ WRITE NO
SQL> alter session set container=pdb1;

Session altered.

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         3 PDB1                           READ WRITE NO
SQL> shutdown immediate;
Pluggable Database closed.
SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         3 PDB1                           MOUNTED
SQL> 

5.客户端再次连接到服务端

[oracle@db01 admin]$ sqlplus scott/tiger@pdb

SQL*Plus: Release 11.2.0.4.0 Production on Fri Mar 1 18:23:48 2019

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> show parameter name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
cdb_cluster_name                     string      orcl
cell_offloadgroup_name               string
db_file_name_convert                 string
db_name                              string      orcl
db_unique_name                       string      orcl
global_names                         boolean     FALSE
instance_name                        string      cdb12
lock_name_space                      string
log_file_name_convert                string
pdb_file_name_convert                string
processor_group_name                 string

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      orcl
SQL> 

6.测试完成重新启动实例1的pdb1

启动节点1的服务就会拉起实例1的pdb1:

[oracle@db90 ~]$ srvctl start service -db orcl -service A -node db90

整个测试过程已完成。

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • 模拟生产搭建Standby RAC实验环境(11.2.0.4 DG)

    目前,我有一套正常运行的Oracle 11.2.0.4 RAC实验环境。这是一套VirtualBox的虚拟化环境,整套环境均放在我的台式机服务器的D盘(SSD固...

    Alfred Zhao
  • Linux平台 Oracle 10gR2(10.2.0.5)RAC安装 Part3:db安装和升级

    Linux平台 Oracle 10gR2(10.2.0.5)RAC安装 Part3:db安装和升级 环境:OEL 5.7 + Oracle 10.2.0.5 ...

    Alfred Zhao
  • 案例:数据库open时报错ORA-1172,ORA-1151 处理

    环境:OEL 5.7 + Oracle 10.2.0.5 Clusterware + Oracle 10.2.0.5 RAC 故障:数据库open时报错ORA...

    Alfred Zhao
  • 模拟生产搭建Standby RAC实验环境(11.2.0.4 DG)

    目前,我有一套正常运行的Oracle 11.2.0.4 RAC实验环境。这是一套VirtualBox的虚拟化环境,整套环境均放在我的台式机服务器的D盘(SSD固...

    Alfred Zhao
  • 案例:数据库open时报错ORA-1172,ORA-1151 处理

    环境:OEL 5.7 + Oracle 10.2.0.5 Clusterware + Oracle 10.2.0.5 RAC 故障:数据库open时报错ORA...

    Alfred Zhao
  • Linux平台 Oracle 19c RAC安装Part3:DB配置

    Linux平台 Oracle 19c RAC安装指导: Part1:Linux平台 Oracle 19c RAC安装Part1:准备工作 Part2:Lin...

    Alfred Zhao
  • 4.1 解压DB的安装包

    Linux平台 Oracle 19c RAC安装指导: Part1:Linux平台 Oracle 19c RAC安装Part1:准备工作 Part2:Lin...

    Alfred Zhao
  • DMLC对于机器学习和系统开发者意味着什么?

    用户1737318
  • HTC或将面临严峻挑战,Valve确认有其他厂商正在研发Steam VR头显

    VRPinea
  • 20140920遇到的问题--JAVA----JS------Tomcat7.0+Onselect灵敏度+fakepath等若干问题

    相信大家在配置tomcat的时候,运行之后有时候出现一个  8005的问题,这个解决很简单:

    wust小吴

扫码关注云+社区

领取腾讯云代金券