[20140416]使用dgmgrl管理dataguard(3)

[20140416]使用dgmgrl管理dataguard(3).txt

参考链接:

http://blog.itpub.net/267265/viewspace-1142649/
http://blog.itpub.net/267265/viewspace-1143027/

从前面的测试看配置启用dgmgrl还是非常简单的。不需要太多的命令。举一些例子来说明:

1.关闭dataguard数据库。看看情况。
SYS@testdg> shutdown immediate ;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.

DGMGRL> show configuration verbose
Configuration - study
  Protection Mode: MaxPerformance
  Databases:
    test   - Primary database
      Error: ORA-16778: redo transport error for one or more databases
    testdg - Physical standby database (disabled)
  Properties:
    FastStartFailoverThreshold      = '30'
    OperationTimeout                = '30'
    FastStartFailoverLagLimit       = '30'
    CommunicationTimeout            = '180'
    FastStartFailoverAutoReinstate  = 'TRUE'
    FastStartFailoverPmyShutdown    = 'TRUE'
    BystandersFollowRoleChange      = 'ALL'

Fast-Start Failover: DISABLED

Configuration Status:
ERROR

DGMGRL> show database  testdg

Database - testdg

  Role:            PHYSICAL STANDBY
  Intended State:  OFFLINE
  Transport Lag:   (unknown)
  Apply Lag:       (unknown)
  Real Time Query: OFF
  Instance(s):
    testdg

Database Status:
SHUTDOWN
--可以发现提示dg处于关闭状态。

2.启动dataguard到mount状态。
DGMGRL> show configuration verbose

Configuration - study

  Protection Mode: MaxPerformance
  Databases:
    test   - Primary database
    testdg - Physical standby database

  Properties:
    FastStartFailoverThreshold      = '30'
    OperationTimeout                = '30'
    FastStartFailoverLagLimit       = '30'
    CommunicationTimeout            = '180'
    FastStartFailoverAutoReinstate  = 'TRUE'
    FastStartFailoverPmyShutdown    = 'TRUE'
    BystandersFollowRoleChange      = 'ALL'

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

DGMGRL> show database  testdg
Database - testdg

  Role:            PHYSICAL STANDBY
  Intended State:  APPLY-ON
  Transport Lag:   0 seconds
  Apply Lag:       0 seconds
  Real Time Query: OFF
  Instance(s):
    testdg

Database Status:
SUCCESS

--可以发现redo 日志自动传输,不需要在输入alter database recover managed standby database using current logfile disconnect ;之类的命令。
--从以下命令也可以看出redo日志在传输:
SYS@testdg> 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      CLOSING               1        978      18432         74
ARCH      CLOSING               1        979          1        231
RFS       IDLE                  0          0          0          0
RFS       IDLE                  1        980        165          1
RFS       IDLE                  0          0          0          0
MRP0      APPLYING_LOG          1        980        165     102400
8 rows selected.

3.启动dataguard到read only状态。
SYS@testdg> alter database open read only;
Database altered.

-- 11G 有一个新特性 read-time apply,日志依旧传输与应用。
DGMGRL> show configuration verbose

Configuration - study

  Protection Mode: MaxPerformance
  Databases:
    test   - Primary database
    testdg - Physical standby database

  Properties:
    FastStartFailoverThreshold      = '30'
    OperationTimeout                = '30'
    FastStartFailoverLagLimit       = '30'
    CommunicationTimeout            = '180'
    FastStartFailoverAutoReinstate  = 'TRUE'
    FastStartFailoverPmyShutdown    = 'TRUE'
    BystandersFollowRoleChange      = 'ALL'

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

DGMGRL> show database  testdg

Database - testdg

  Role:            PHYSICAL STANDBY
  Intended State:  APPLY-ON
  Transport Lag:   0 seconds
  Apply Lag:       0 seconds
  Real Time Query: ON
  Instance(s):
    testdg

Database Status:
SUCCESS

--可以发现日志一样在应用。
SYS@testdg> 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      CLOSING               1        978      18432         74
ARCH      CLOSING               1        979          1        231
RFS       IDLE                  0          0          0          0
RFS       IDLE                  1        980        760          1
RFS       IDLE                  0          0          0          0
MRP0      APPLYING_LOG          1        980        760     102400

8 rows selected.
--你也可以在主数据库修改一条记录,看看备用库是否相应也修改这条记录,测试忽略。

总结:
可以发现使用dgmgrl来管理后,一切变的很简单。如果认真理解broker的含义(表示 n.掮客, 经纪人的意思。),
就很容易理解,这些操作在后台已经由ora_dmon_XXX来完成。

下面讲解已经使用了dgmgrl来管理dataguard,在使用sqlplus修改一些相关参数会出现什么情况呢?请看下篇。

上一篇:安全问题已不再是云计算首要关注的问题


下一篇:【物联网智能网关-06】GPS定位+星图显示(WinForm库应用实例)