zoukankan      html  css  js  c++  java
  • Oracle 11.2.0.4.0 Dataguard部署和日常维护(6)-Active Dataguard篇

    1. 检查主备库的状态

    • on primary
    column DATABASE_ROLE format a20
    column OPEN_MODE format a15
    column PROTECTION_MODE format a20
    column SWITCHOVER_STATUS format a20
    select DATABASE_ROLE,OPEN_MODE,PROTECTION_MODE,SWITCHOVER_STATUS from v$database;
    
    DATABASE_ROLE         OPEN_MODE         PROTECTION_MODE      SWITCHOVER_STATUS
    -------------------- --------------- -------------------- --------------------
    PRIMARY          READ WRITE      MAXIMUM PERFORMANCE  TO STANDBY
    
    select max(sequence#) from v$archived_log;
    
    MAX(SEQUENCE#)
    --------------
            68
    • on standby
    column DATABASE_ROLE format a20
    column OPEN_MODE format a15
    column PROTECTION_MODE format a20
    column SWITCHOVER_STATUS format a20
    select DATABASE_ROLE,OPEN_MODE,PROTECTION_MODE,SWITCHOVER_STATUS from v$database;
    
    DATABASE_ROLE        OPEN_MODE       PROTECTION_MODE      SWITCHOVER_STATUS
    -------------------- --------------- -------------------- --------------------
    PHYSICAL STANDBY     MOUNTED         MAXIMUM PERFORMANCE  NOT ALLOWED
    
    select SEQUENCE#,APPLIED from v$archived_log where SEQUENCE#=(select max(sequence#) from v$archived_log);
    
     SEQUENCE# APPLIED
    ---------- ---------------------------
        68   IN-MEMORY
    
    select process,status,sequence# from v$managed_standby;
    
    PROCESS             STATUS                  SEQUENCE#
    ------------------- ----------------------- ----------
    ARCH                CLOSING                     68
    ARCH                CONNECTED                    0
    ARCH                CONNECTED                    0
    ARCH                CLOSING                     65
    RFS                 IDLE                         0
    RFS                 IDLE                        69
    RFS                 IDLE                         0
    MRP0                APPLYING_LOG                69

    2. 取消备库的MPR恢复线程

    alter database recover managed standby database cancel;

    3. 备库以readonly方式打开

    alter database open read only;
    
    select DATABASE_ROLE,OPEN_MODE,PROTECTION_MODE,SWITCHOVER_STATUS from v$database;
    
    DATABASE_ROLE        OPEN_MODE       PROTECTION_MODE      SWITCHOVER_STATUS
    -------------------- --------------- -------------------- --------------------
    PHYSICAL STANDBY     READ ONLY       MAXIMUM PERFORMANCE  NOT ALLOWED
    
    select process,status,sequence# from v$managed_standby;
    
    PROCESS             STATUS                  SEQUENCE#
    ------------------- ----------------------- ----------
    ARCH                CLOSING                     68
    ARCH                CONNECTED                    0
    ARCH                CONNECTED                    0
    ARCH                CLOSING                     65
    RFS                 IDLE                         0
    RFS                 IDLE                        69
    RFS                 IDLE                         0

    4. 开启备库的MPR线程

    alter database recover managed standby database using current logfile disconnect from session;
    select process,status,sequence# from v$managed_standby; PROCESS STATUS SEQUENCE# ------------------- ----------------------- ---------- ARCH CLOSING 68 ARCH CONNECTED 0 ARCH CONNECTED 0 ARCH CLOSING 65 RFS IDLE 0 RFS IDLE 69 RFS IDLE 0 MRP0 APPLYING_LOG 69

    5. 测试active dataguard

    • on primary
    create table test01 as select FILE_NAME from dba_data_files;
    select * from test01;
    
    FILE_NAME
    ------------------------------------------------------------
    /u01/app/oracle/oradata/userdata/users01.dbf
    /u01/app/oracle/oradata/userdata/undotbs01.dbf
    /u01/app/oracle/oradata/userdata/sysaux01.dbf
    /u01/app/oracle/oradata/userdata/system01.dbf
    • on standby
    select * from test01;
    
    FILE_NAME
    ------------------------------------------------------------
    /u01/app/oracle/oradata/userdata/users01.dbf
    /u01/app/oracle/oradata/userdata/undotbs01.dbf
    /u01/app/oracle/oradata/userdata/sysaux01.dbf
    /u01/app/oracle/oradata/userdata/system01.dbf
  • 相关阅读:
    charles 抓包iOS模拟器 HTTPS请求
    tableView reloadData页面跳动问题
    测试swiftc 命令 插件无法使用的问题( PluginLoading: Required plug-in compatibility UUID.... )
    linux网络设置
    博客园markdown语法高亮
    django继承user类来定制自己的user类
    Django开发bug及问题记录
    震惊!男子使用这一手机设置,从此告别UC!
    吐槽手机的迷之信号
    声控皮卡丘小游戏
  • 原文地址:https://www.cnblogs.com/ilifeilong/p/7123762.html
Copyright © 2011-2022 走看看