zoukankan      html  css  js  c++  java
  • oracle 服务的故障转移测试


    ###################

    SQL*Plus: Release 19.0.0.0.0 - Production on Tue Sep 29 10:47:09 2020
    Version 19.7.0.0.0


    创建新的服务

    [oracle@rac1:/home/oracle]$ srvctl add service -d tbcsa -s tbcsa2_1 -r tbcsa2 -a tbcsa1
    [oracle@rac1:/home/oracle]$ srvctl start service -d tbcsa -s tbcsa2_1
    [oracle@rac1:/home/oracle]$ srvctl modify service -d tbcsa -s tbcsa2_1 -e SESSION -m BASIC -w 10 -z 3
    [oracle@rac1:/home/oracle]$ srvctl modify service -d tbcsa -s tbcsa2_1 -failback YES

    srvctl relocate service -db tbcsa -service tbcsa2_1 -newinst tbcsa2 -oldinst tbcsa1

    节点2测试连接

    -----------session 1

    [oracle@rac2:/home/oracle]$ sqlplus c##dbmt/dba_123@192.168.220.173:1521/tbcsa2_1

    SQL*Plus: Release 19.0.0.0.0 - Production on Tue Sep 29 10:47:09 2020
    Version 19.7.0.0.0

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

    Last Successful login time: Tue Sep 29 2020 10:45:14 +08:00

    Connected to:
    Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
    Version 19.7.0.0.0

    SQL> select instance_name from v$instance;

    INSTANCE_NAME
    ----------------
    tbcsa2

    -------------节点2监听状态 服务tbcsa2_1在节点2

    [oracle@rac2:/home/oracle]$ lsnrctl status

    LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 29-SEP-2020 10:47:02

    Copyright (c) 1991, 2019, Oracle. All rights reserved.

    Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
    STATUS of the LISTENER
    ------------------------
    Alias LISTENER
    Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production
    Start Date 29-SEP-2020 10:22:24
    Uptime 0 days 0 hr. 24 min. 37 sec
    Trace Level off
    Security ON: Local OS Authentication
    SNMP OFF
    Listener Parameter File /oracle/app/19.0.0/grid/network/admin/listener.ora
    Listener Log File /oracle/app/grid/diag/tnslsnr/rac2/listener/alert/log.xml
    Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.220.72)(PORT=1521)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.220.172)(PORT=1521)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=rac2)(PORT=5500))(Security=(my_wallet_directory=/oracle/app/oracle/product/19.0.0/db_1/admin/tbcsa/xdb_wallet))(Presentation=HTTP)(Session=RAW))
    Services Summary...
    Service "+ASM" has 1 instance(s).
    Instance "+ASM2", status READY, has 1 handler(s) for this service...
    Service "+ASM_CRSDG" has 1 instance(s).
    Instance "+ASM2", status READY, has 1 handler(s) for this service...
    Service "+ASM_DATADG" has 1 instance(s).
    Instance "+ASM2", status READY, has 1 handler(s) for this service...
    Service "86b637b62fdf7a65e053f706e80a27ca" has 1 instance(s).
    Instance "tbcsa2", status READY, has 1 handler(s) for this service...
    Service "a59ce61dd45c3171e05347dca8c05c05" has 1 instance(s).
    Instance "tbcsa2", status READY, has 1 handler(s) for this service...
    Service "pdb" has 1 instance(s).
    Instance "tbcsa2", status READY, has 1 handler(s) for this service...
    Service "tbcsa" has 1 instance(s).
    Instance "tbcsa2", status READY, has 1 handler(s) for this service...
    Service "tbcsa2_1" has 1 instance(s).
    Instance "tbcsa2", status READY, has 1 handler(s) for this service...
    Service "tbcsaXDB" has 1 instance(s).
    Instance "tbcsa2", status READY, has 1 handler(s) for this service...
    The command completed successfully

    -------kill节点2实例
    [oracle@rac2:/home/oracle]$ ps -ef | grep pmon
    grid 5830 1 0 10:22 ? 00:00:00 asm_pmon_+ASM2
    oracle 16029 1 0 10:45 ? 00:00:00 ora_pmon_tbcsa2
    oracle 16711 9619 0 10:47 pts/0 00:00:00 grep --color=auto pmon
    [oracle@rac2:/home/oracle]$ kill -9 16029


    ---服务自动relocate到节点1,此时session1不敲回车,(如果此时session1敲回车,则该会话会连接至节点1,待crs拉起节点2实例后服务会重新回到2节点,但该session不会重连至节点2,而是保持长连接在节点1)

    [oracle@rac1:/home/oracle]$ lsnrctl status

    LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 29-SEP-2020 10:36:17

    Copyright (c) 1991, 2019, Oracle. All rights reserved.

    Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
    STATUS of the LISTENER
    ------------------------
    Alias LISTENER
    Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production
    Start Date 29-SEP-2020 10:21:46
    Uptime 0 days 0 hr. 14 min. 30 sec
    Trace Level off
    Security ON: Local OS Authentication
    SNMP OFF
    Listener Parameter File /oracle/app/19.0.0/grid/network/admin/listener.ora
    Listener Log File /oracle/app/grid/diag/tnslsnr/rac1/listener/alert/log.xml
    Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.220.71)(PORT=1521)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.220.171)(PORT=1521)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=rac1)(PORT=5500))(Security=(my_wallet_directory=/oracle/app/oracle/product/19.0.0/db_1/admin/tbcsa/xdb_wallet))(Presentation=HTTP)(Session=RAW))
    Services Summary...
    Service "+ASM" has 1 instance(s).
    Instance "+ASM1", status READY, has 1 handler(s) for this service...
    Service "+ASM_CRSDG" has 1 instance(s).
    Instance "+ASM1", status READY, has 1 handler(s) for this service...
    Service "+ASM_DATADG" has 1 instance(s).
    Instance "+ASM1", status READY, has 1 handler(s) for this service...
    Service "86b637b62fdf7a65e053f706e80a27ca" has 1 instance(s).
    Instance "tbcsa1", status READY, has 1 handler(s) for this service...
    Service "a59ce61dd45c3171e05347dca8c05c05" has 1 instance(s).
    Instance "tbcsa1", status READY, has 1 handler(s) for this service...
    Service "pdb" has 1 instance(s).
    Instance "tbcsa1", status READY, has 1 handler(s) for this service...
    Service "tbcsa" has 1 instance(s).
    Instance "tbcsa1", status READY, has 1 handler(s) for this service...
    Service "tbcsa2_1" has 1 instance(s).
    Instance "tbcsa1", status READY, has 1 handler(s) for this service...
    Service "tbcsaXDB" has 1 instance(s).
    Instance "tbcsa1", status READY, has 1 handler(s) for this service...
    The command completed successfully


    -----节点2集群自动拉起实例 session1敲回车,可以看到服务切换回节点2且重连至2实例

    Connected to:
    Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
    Version 19.7.0.0.0

    SQL> select instance_name from v$instance;

    INSTANCE_NAME
    ----------------
    tbcsa2

    SQL> select instance_name from v$instance;
    select instance_name from v$instance
    *
    ERROR at line 1:
    ORA-25408: can not safely replay call


    SQL> select instance_name from v$instance;

    INSTANCE_NAME
    ----------------
    tbcsa2


    总结:1.服务设置了TFA BASIC和failback后实例异常宕,该服务会自动relocate到另一个节点上
    2.如果在节点宕之前session通过该服务连接至2实例,2节点宕之后,如果敲回车则该session会随服务转移到节点1并成为长连接,且不会在节点2 重启后重连至节点2。
    3.如果在节点宕之前session通过该服务连接至2实例,2节点宕之后,如果不敲回车则该session不会立即连接到节点1,节点2重启后敲回车会重连至节点2。

  • 相关阅读:
    Java 上传文件总结
    Java和C# MD5加密比较
    ORM映射框架总结数据操作(七)
    ORM映射框架总结数据操作(五)
    ORM映射框架总结数据操作(一)
    ORM映射框架总结数据操作(四)
    ORM映射框架总结数据操作(六)
    ORM映射框架总结文件下载
    STM32USART DMA_Interrupt例程的学习
    开始STM32的学习
  • 原文地址:https://www.cnblogs.com/nadian-li/p/13749456.html
Copyright © 2011-2022 走看看