• oracle rac与单实例DG切换


    1.主库查看状态(RAC库)

    SQL> select database_role,switchover_status from v$database; 
    
    DATABASE_ROLE    SWITCHOVER_STATUS
    ---------------- --------------------
    PRIMARY          SESSIONS ACTIVE
    
    SQL> select inst_id,database_role,switchover_status from gv$database;
    
       INST_ID DATABASE_ROLE    SWITCHOVER_STATUS
    ---------- ---------------- --------------------
             2 PRIMARY          SESSIONS ACTIVE
             1 PRIMARY          SESSIONS ACTIVE

    2.进行切换(任何一个节点执行即可)

    SQL> alter database commit to switchover to physical standby with session shutdown;

    3.第二步后RAC数据库实例会关闭,把两个实例启动至mount状态

    [oracle@rac01 ~]$ sqlplus / as sysdba
    
    SQL*Plus: Release 11.2.0.4.0 Production on Thu Apr 16 11:41:54 2020
    
    Copyright (c) 1982, 2013, Oracle.  All rights reserved.
    
    Connected to an idle instance.
    
    SQL> startup mount;
    ORACLE instance started.
    
    Total System Global Area 5344731136 bytes
    Fixed Size                  2262656 bytes
    Variable Size            1040189824 bytes
    Database Buffers         4294967296 bytes
    Redo Buffers                7311360 bytes
    Database mounted.
    
    [oracle@rac02 ~]$ sqlplus / as sysdba
    
    SQL*Plus: Release 11.2.0.4.0 Production on Thu Apr 16 11:42:39 2020
    
    Copyright (c) 1982, 2013, Oracle.  All rights reserved.
    
    Connected to an idle instance.
    
    SQL> startup nomount;
    ORACLE instance started.
    
    Total System Global Area 5344731136 bytes
    Fixed Size                  2262656 bytes
    Variable Size            1040189824 bytes
    Database Buffers         4294967296 bytes
    Redo Buffers                7311360 bytes

    4.查看RAC库状态

    SQL> select open_mode ,database_role from v$database;
    
    OPEN_MODE            DATABASE_ROLE
    -------------------- ----------------
    MOUNTED              PHYSICAL STANDBY

    5.备库(单实例库)查看状态

    SQL> select database_role,switchover_status from v$database;
    
    DATABASE_ROLE    SWITCHOVER_STATUS
    ---------------- --------------------
    PHYSICAL STANDBY SESSIONS ACTIVE

    6.切换

    SQL> alter database commit to switchover to primary with session shutdown ; 
    
    Database altered.
    
    SQL> select database_role,switchover_status from v$database;
    
    DATABASE_ROLE    SWITCHOVER_STATUS
    ---------------- --------------------
    PRIMARY          NOT ALLOWED
    
    SQL> alter database open;
    
    Database altered.
    
    SQL> select database_role,switchover_status from v$database;
    
    DATABASE_ROLE    SWITCHOVER_STATUS
    ---------------- --------------------
    PRIMARY          RESOLVABLE GAP

    7.RAC库(此时已是备库)打开数据库并应用日志

    SQL> alter database open; 两节点都要执行
    SQL> alter database recover managed standby database disconnect; 任何一个节点执行即可

    从实际来看,单实例到RAC的DG,RAC只会使用一个实例来进行日志的应用

    参考:https://blog.csdn.net/xxzhaobb/article/details/79109155

  • 相关阅读:
    example_php文件上传处理
    andorid SQLite数据库创建文件
    andorid 手机外部储存
    手机界面
    andorid 数据储存、SharedPreferences存储和手机内部储存
    andorid 数据储存
    andorid 多线程handler用法
    andorid 配置器组件和提示消息
    andorid 网格视图GridView
    andorid 列表视图之SimpleAdapter
  • 原文地址:https://www.cnblogs.com/monkey6/p/12712530.html
Copyright © 2020-2023  润新知