• Oracle 10g dataguard broker 配置


    环境:

    OS:rhel6.3_64bit

    DB:Oracle10gR2

    ————————————————————————dataguard broker配置————————————————————————
    主备库修改参数
    SQL>  show parameter broker

    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    dg_broker_config_file1               string      /opt/oracle/product/10.2.0/db/
                                                     dbs/dr1stdy.dat
    dg_broker_config_file2               string      /opt/oracle/product/10.2.0/db/
                                                     dbs/dr2stdy.dat
    dg_broker_start                      boolean     FALSE
    SQL> alter system set dg_broker_start=true scope=both;

    System altered.
    SQL> alter system set dg_broker_start=false scope=both;

    System altered.
    如果使用监听端口是非默认的需要设置local_listener;
    sys@ORA> alter system set local_listener='ora';

    System altered.

    SQL> ho ps -ef | grep dmon
    oracle    9950     1  0 16:54 ?        00:00:00 ora_dmon_stdy
    oracle   10075  3077  0 16:54 pts/6    00:00:00 /bin/bash -c ps -ef | grep dmon

    SQL> show parameter broker

    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    dg_broker_config_file1               string      /opt/oracle/product/10.2.0/db/
                                                     dbs/dr1stdy.dat
    dg_broker_config_file2               string      /opt/oracle/product/10.2.0/db/
                                                     dbs/dr2stdy.dat
    dg_broker_start                      boolean     TRUE
    alter system set dg_broker_config_file1='/opt/oracle/product/10.2.0/db/dbs/dr1dg1.dat' scope=spfile;
    alter system set dg_broker_config_file2='/opt/oracle/product/10.2.0/db/dbs/dr2dg1.dat' scope=spfile;
    [oracle@eagle ~]$ dgmgrl
    DGMGRL for Linux: Version 10.2.0.5.0 - 64bit Production

    Copyright (c) 2000, 2005, Oracle. All rights reserved.

    Welcome to DGMGRL, type "help" for information.
    DGMGRL> help

    The following commands are available:

    add            Add a standby database to the broker configuration
    connect        Connect to an Oracle instance
    create         Create a broker configuration
    disable        Disable a configuration, a database, or Fast-Start Failover
    edit           Edit a configuration, database, or instance
    enable         Enable a configuration, a database, or Fast-Start Failover
    exit           Exit the program
    failover       Change a standby database to be the primary database
    help           Display description and syntax for a command
    quit           Exit the program
    reinstate      Change a disabled database into a viable standby database
    rem            Comment to be ignored by DGMGRL
    remove         Remove a configuration, database, or instance
    show           Display information about a configuration, database, or instance
    shutdown       Shutdown a currently running Oracle instance
    start          Start Fast-Start Failover observer
    startup        Start an Oracle database instance
    stop           Stop Fast-Start Failover observer
    switchover     Switch roles between the primary database and a standby database

    Use "help <command>" to see syntax for individual commands

    DGMGRL> connect sys/orcl
    Connected.
    DGMGRL> CREATE CONFIGURATION 'dg_config' as PRIMARY DATABASE IS 'ora' connect identifier is 'ora';

    Configuration "dg1_config" created with primary database "ora"

    回退方式

    DGMGRL> remove configuration

    DGMGRL> DGMGRL>
    DGMGRL>
    DGMGRL> ADD DATABASE 'stdy' AS CONNECT IDENTIFIER IS 'stdy' MAINTAINED AS PHYSICAL;
    Database "stdy" added
    DGMGRL>
    DGMGRL> ENABLE CONFIGURATION;
    show CONFIGURATION;
    Enabled.
    DGMGRL> show configuration verbose

    Configuration
      Name:                dg1_config
      Enabled:             YES
      Protection Mode:     MaxPerformance
      Fast-Start Failover: DISABLED
      Databases:
        ora - Primary database
        stdy - Physical standby database

    Current status for "dg1_config":
    SUCCESS

    DGMGRL> show database ora

    Database
      Name:            ora
      Role:            PRIMARY
      Enabled:         YES
      Intended State:  ONLINE
      Instance(s):
        ora

    Current status for "ora":
    SUCCESS

    DGMGRL> show database stdy

    Database
      Name:            stdy
      Role:            PHYSICAL STANDBY
      Enabled:         YES
      Intended State:  ONLINE
      Instance(s):
        stdy

    Current status for "stdy":
    SUCCESS
    DGMGRL>  switchover to 'stdy';
    Performing switchover NOW, please wait...
    Operation requires shutdown of instance "ora" on database "ora"
    Shutting down instance "ora"...
    ORA-01109: database not open

    Database dismounted.
    ORACLE instance shut down.
    Operation requires shutdown of instance "stdy" on database "stdy"
    Shutting down instance "stdy"...
    ORA-01109: database not open

    Database dismounted.
    ORACLE instance shut down.
    Operation requires startup of instance "ora" on database "ora"
    Starting instance "ora"...
    Unable to connect to database
    ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

    Failed.
    You are no longer connected to ORACLE
    Please connect again.
    Unable to start instance "ora"
    You must start instance "ora" manually
    Operation requires startup of instance "stdy" on database "stdy"
    You must start instance "stdy" manually
    Switchover succeeded, new primary is "stdy"

    启动现有环境:
    首先启动standby数据库
    [oracle@eagle ~]$ sql

    SQL*Plus: Release 10.2.0.5.0 - Production on Thu Nov 14 16:56:23 2013

    Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

    Connected to an idle instance.

    idle> startup mount
    ORACLE instance started.

    Total System Global Area  213909504 bytes
    Fixed Size                  2095152 bytes
    Variable Size             130025424 bytes
    Database Buffers           75497472 bytes
    Redo Buffers                6291456 bytes
    Database mounted.
    idle>  SELECT PROCESS, STATUS, THREAD#, SEQUENCE#, BLOCK#, BLOCKS  FROM V$MANAGED_STANDBY;

    PROCESS   STATUS          THREAD#  SEQUENCE#     BLOCK#     BLOCKS
    --------- ------------ ---------- ---------- ---------- ----------
    ARCH      CONNECTED             0          0          0          0
    ARCH      CONNECTED             0          0          0          0
    ARCH      CONNECTED             0          0          0          0

    启动主库
    [oracle@eagle ~]$ sql

    SQL*Plus: Release 10.2.0.5.0 - Production on Thu Nov 14 16:56:30 2013

    Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

    Connected to an idle instance.

    idle> startup
    ORACLE instance started.

    Total System Global Area  213909504 bytes
    Fixed Size                  2095152 bytes
    Variable Size             100665296 bytes
    Database Buffers          104857600 bytes
    Redo Buffers                6291456 bytes
    Database mounted.
    Database opened.
    idle>  SELECT PROCESS, STATUS, THREAD#, SEQUENCE#, BLOCK#, BLOCKS  FROM V$MANAGED_STANDBY;

    PROCESS   STATUS          THREAD#  SEQUENCE#     BLOCK#     BLOCKS
    --------- ------------ ---------- ---------- ---------- ----------
    ARCH      CLOSING               1         19          1          1
    ARCH      CLOSING               1         19          1          1
    ARCH      CONNECTED             0          0          0          0
    LNS       WRITING               1         21         22          1
    检查standby的进程
    idle> /

    PROCESS   STATUS          THREAD#  SEQUENCE#     BLOCK#     BLOCKS
    --------- ------------ ---------- ---------- ---------- ----------
    ARCH      CLOSING               1         19          1          1
    ARCH      CLOSING               1         20          1        129
    ARCH      CONNECTED             0          0          0          0
    RFS       IDLE                  1         21         21          1
    RFS       IDLE                  0          0          0          0
    MRP0      APPLYING_LOG          1         21         19     102400
    RFS       IDLE                  0          0          0          0

    检查broker的配置
    [oracle@eagle ~]$ dgmgrl
    DGMGRL for Linux: Version 10.2.0.5.0 - 64bit Production

    Copyright (c) 2000, 2005, Oracle. All rights reserved.

    Welcome to DGMGRL, type "help" for information.
    DGMGRL> connect sys/oracle
    Connected.
    DGMGRL> show configuration verbose

    Configuration
      Name:                dg_config
      Enabled:             YES
      Protection Mode:     MaxPerformance
      Fast-Start Failover: DISABLED
      Databases:
        ora  - Physical standby database
        stdy - Primary database

    Current status for "dg_config":
    Warning: ORA-16610: command 'Broker automatic health check' in progress


    DGMGRL>  show configuration verbose

    Configuration
      Name:                dg_config
      Enabled:             YES
      Protection Mode:     MaxPerformance
      Fast-Start Failover: DISABLED
      Databases:
        ora  - Physical standby database
        stdy - Primary database

    Current status for "dg_config":
    SUCCESS

    dataguard broker配置级别和配置自动auto  failover ,未完待续。。。。。

  • 相关阅读:
    lnmp分离部署
    Nginx
    Keepalived脑裂监控
    KVM虚拟化
    mysql中间件proxysql实现mysql读写分离
    分离部署lnmp
    nginx
    Keepalived脑裂监控
    keepalived高可用
    KVM虚拟化
  • 原文地址:https://www.cnblogs.com/james1207/p/3423962.html
Copyright © 2020-2023  润新知