zoukankan      html  css  js  c++  java
  • 『ORACLE』 DG切换主备库角色(11g)

    切换前enmo1为主库,enmo2为备库

    [oracle@enmo1 admin]$ sqlplus / as sysdba

    SQL*Plus: Release 11.2.0.4.0 Production on Sat May 6 10:14:57 2017

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


    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options

    查看主库的基本信息:

    SYS@enmo1 hey~1->select open_mode,protection_mode,database_role,switchover_status from v$database;

    OPEN_MODE            PROTECTION_MODE             DATABASE_ROLE         SWITCHOVER_STATUS
    -------------------- ----------------------------- ------------------------ ------------------------
    READ WRITE           MAXIMUM PERFORMANCE      PRIMARY                      TO STANDBY

    查看备库的基本信息:

    SYS@enmo2 hey~2->select open_mode,protection_mode,database_role,switchover_status from v$database;

    OPEN_MODE                   PROTECTION_MODE             DATABASE_ROLE         SWITCHOVER_STATUS
    ------------------------- ----------------------------- ------------------------ ------------------------
    READ ONLY WITH APPLY MAXIMUM PERFORMANCE      PHYSICAL STANDBY      NOT ALLOWED

    备库应用日志保持和主库数据一致(如果不一致,执行如下语句应用日志)

    SYS@enmo2 hey~2->recover managed standby database using current logfile disconnect from session;
    Media recovery complete.

    SYS@enmo2 hey~2->recover managed standby database cancel;
    Media recovery complete.

    主库切换到备库角色并查看切换之后的状态为RECOVERY NEEDED

    SYS@enmo1 hey~1->alter database commit to switchover to physical standby with session shutdown;

    Database altered.

    SYS@enmo1 hey~1->shutdown abort;

    ORACLE instance started.

    Total System Global Area 830930944 bytes
    Fixed Size 2257800 bytes
    Variable Size 700451960 bytes
    Database Buffers 121634816 bytes
    Redo Buffers 6586368 bytes
    Database mounted.
    SYS@enmo1 hey~1->select switchover_status from v$database;

    SWITCHOVER_STATUS
    --------------------
    RECOVERY NEEDED

    切换应用日志,然后在查看切换状态为TO primary正常:

    SYS@enmo1 hey~1->recover managed standby database using current logfile disconnect from session;
    Media recovery complete.
    SYS@enmo1 hey~1->select switchover_status from v$database;

    SWITCHOVER_STATUS
    --------------------
    TO PRIMARY

    备库切主库:

    SYS@enmo2 hey~2->select open_mode,protection_mode,database_role,switchover_status from v$database;

    OPEN_MODE PROTECTION_MODE DATABASE_ROLE SWITCHOVER_STATUS
    -------------------- -------------------- ---------------- --------------------
    MOUNTED MAXIMUM PERFORMANCE PHYSICAL STANDBY TO PRIMARY

    SYS@enmo2 hey~2->alter database commit to switchover to primary with session shutdown;

    Database altered.

    SYS@enmo2 hey~2->alter database open;

    Database altered.

    SYS@enmo2 hey~2->select switchover_status,database_role from v$database;

    SWITCHOVER_STATUS DATABASE_ROLE
    -------------------- ----------------
    FAILED DESTINATION PRIMARY

    SYS@enmo2 hey~2->select open_mode,protection_mode,database_role from v$database;

    OPEN_MODE PROTECTION_MODE DATABASE_ROLE
    -------------------- -------------------- ----------------
    READ WRITE MAXIMUM PERFORMANCE PRIMARY

     

  • 相关阅读:
    Hermite插值是牛顿插值的极限情形
    An introduction to numerical analysis theorem 6.3 :Hermite Interpolation Theorem
    matrix theory_basic results and techniques_exercise_1.2.10
    Hermite插值是牛顿插值的极限情形
    用带余除法可以解决一切部分分式的题目
    matrix theory_basic results and techniques_exercise_1.2.10
    详解物联网Modbus通讯协议
    手把手带你做LiteOS的树莓派移植
    在Vue中使用JSX,很easy的
    解读鸿蒙轻内核的监控器:异常钩子函数
  • 原文地址:https://www.cnblogs.com/KT-melvin/p/6816769.html
Copyright © 2011-2022 走看看