[20140418]使用dgmgrl管理dataguard(7).txt

简介: [20140418]使用dgmgrl管理dataguard(7).txt 参考链接: http://blog.itpub.net/267265/viewspace-1142649/ http://blog.

[20140418]使用dgmgrl管理dataguard(7).txt

参考链接:
http://blog.itpub.net/267265/viewspace-1142649/
http://blog.itpub.net/267265/viewspace-1143027/
http://blog.itpub.net/267265/viewspace-1143058/
http://blog.itpub.net/267265/viewspace-1143126/
http://blog.itpub.net/267265/viewspace-1143480/
http://blog.itpub.net/267265/viewspace-1144742/

-- 我的测试环境:primary的tnsnames别名test,standby主机的tnsnames别名testdg。数据库版本:
-- 前面提高要完成切换最好要配置_DGMGRL.为静态服务。
-- 实际上也可以修改staticConnectidentifier参数来替换,自己做一个测试看看。

1.修改监听文件,删除_DGMGRL.的静态注册。两边都要修改:
--test
SID_LIST_LISTENER =
   (SID_LIST =
    (SID_DESC =
      (SDU=32767)
      (GLOBAL_DBNAME = test.com)
      (ORACLE_HOME = /u01/app/oracle11g/product/11.2.0/db_2)
      (SID_NAME = test)
      )
   )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = hisdg)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

ADR_BASE_LISTENER = /u01/app/oracle11g

--testdg
SID_LIST_LISTENER =
   (SID_LIST =
    (SID_DESC =
      (SDU=32767)
      (GLOBAL_DBNAME = test.com)
      (ORACLE_HOME = /u01/app/oracle11g/product/11.2.0/db_2)
      (SID_NAME = testdg)
      )
   )


LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = testdb)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

ADR_BASE_LISTENER = /u01/app/oracle11g

$ lsnrctl reload

2.修改dgmrgl的参数StaticConnectIdentifier:

DGMGRL> show database verbose test StaticConnectIdentifier
  StaticConnectIdentifier = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hisdg)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=test_DGMGRL.com)(INSTANCE_NAME=test)(SERVER=DEDICATED)))'

DGMGRL> show database verbose testdg StaticConnectIdentifier
  StaticConnectIdentifier = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=testdb)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=testdg_DGMGRL.com)(INSTANCE_NAME=testdg)(SERVER=DEDICATED)))'

DGMGRL> edit database test set PROPERTY StaticConnectIdentifier= '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hisdg)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=test.com)(INSTANCE_NAME=test)(SERVER=DEDICATED)))';
Property "staticconnectidentifier" updated

DGMGRL> edit database testdg set PROPERTY StaticConnectIdentifier= '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=testdb)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=test.com)(INSTANCE_NAME=testdg)(SERVER=DEDICATED)))';
Property "staticconnectidentifier" updated

3.测试切换:
DGMGRL> show configuration
Configuration - study
  Protection Mode: MaxPerformance
  Databases:
    test   - Primary database
    testdg - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS

DGMGRL> connect sys/btbtms@testdg
Connected.

DGMGRL> switchover to testdg;
Performing switchover NOW, please wait...
New primary database "testdg" is opening...
Operation requires shutdown of instance "test" on database "test"
Shutting down instance "test"...
ORACLE instance shut down.
Operation requires startup of instance "test" on database "test"
Starting instance "test"...
ORACLE instance started.
Database mounted.
Switchover succeeded, new primary is "testdg"

DGMGRL> show configuration
Configuration - study
  Protection Mode: MaxPerformance
  Databases:
    testdg - Primary database
    test   - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS

--切换完成。

4.修改dgmrgl的参数StaticConnectIdentifier使用tnsnames.ora中的定义,如何呢?
--tnsnames.ora定义如下:
TEST =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.40)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = test.com)
    )
  )

TESTDG =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.101.115)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = test.com)
    )
  )

DGMGRL> show database verbose test StaticConnectIdentifier
  StaticConnectIdentifier = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hisdg)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=test.com)(INSTANCE_NAME=test)(SERVER=DEDICATED)))'
DGMGRL> show database verbose testdg StaticConnectIdentifier
  StaticConnectIdentifier = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=testdb)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=test.com)(INSTANCE_NAME=testdg)(SERVER=DEDICATED)))'

DGMGRL> edit database test set PROPERTY StaticConnectIdentifier= 'test';
Property "staticconnectidentifier" updated
DGMGRL> edit database testdg set PROPERTY StaticConnectIdentifier= 'testdg';
Property "staticconnectidentifier" updated

5.再次测试切换:
DGMGRL> show configuration
Configuration - study
  Protection Mode: MaxPerformance
  Databases:
    testdg - Primary database
    test   - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS

DGMGRL> connect sys/btbtms@test
Connected.

DGMGRL> connect sys/btbtms@test
Connected.
DGMGRL> switchover to test;
Performing switchover NOW, please wait...
New primary database "test" is opening...
Operation requires shutdown of instance "testdg" on database "testdg"
Shutting down instance "testdg"...
ORACLE instance shut down.
Operation requires startup of instance "testdg" on database "testdg"
Starting instance "testdg"...
ORACLE instance started.
Database mounted.
Switchover succeeded, new primary is "test"

DGMGRL> show configuration

Configuration - study

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

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

--切换正常。

总结:
说明只要staticconnectidentifier配置正确,切换是没有问题的。

目录
相关文章
|
Oracle 关系型数据库 数据库
[20170914]tnsnames.ora的管理.txt
[20170914]tnsnames.ora的管理.txt --//昨天朋友讲tnsnams.ora的内容太长了,而且许多不需要的.管理不方便.我记得以前写[20150409]tnsnames.
980 0
|
数据库 Go 测试技术
[20151109]使用dgmgrl管理dataguard(15)
[20151109]使用dgmgrl管理dataguard(15).txt 参考链接: http://blog.itpub.net/267265/viewspace-1142649/ http://blog.
1072 0
|
Oracle 关系型数据库 数据库
配置DATAGUARD时报ORA-12528
说明:在dataguard的搭建中,运行rman恢复的时候报错ORA-12528的错误; 脚本如下:RMAN>  connect auxiliary sys/oracle@SCMPRD02     解决...
952 0
|
Oracle 关系型数据库 数据库
[20140519]使用dgmgrl配置dataguard.txt
[20140519]使用dgmgrl配置dataguard.txt --最近一段时间看了dgmgrl的使用文档,主要是了解一些细节,我也在生产系统使用dgmgrl来管理dataguard,我发现在10g下, --不是很好用,也许这个是国内许多人并没有使用它来管理。
806 0
|
Oracle 关系型数据库 测试技术
[20140420]使用dgmgrl管理dataguard(9).txt
[20140420]使用dgmgrl管理dataguard(9).txt 参考链接: http://blog.itpub.net/267265/viewspace-1142649/ http://blog.
857 0
|
Oracle 关系型数据库 测试技术
[20140420]使用dgmgrl管理dataguard(8).txt
[20140420]使用dgmgrl管理dataguard(8).txt 参考链接: http://blog.itpub.net/267265/viewspace-1142649/ http://blog.
952 0
|
数据库 关系型数据库 Oracle
[20140416]使用dgmgrl管理dataguard(5).txt
[20140416]使用dgmgrl管理dataguard(5).txt 参考链接: http://blog.itpub.net/267265/viewspace-1142649/ http://blog.itpub.net/267265/viewspace-1143027/ http://blog.itpub.net/267265/viewspace-1143058/ http://blog.itpub.net/267265/viewspace-1143126/ 前面我提到一旦使用dgmgrl,就一直使用它,除非禁用它。
812 0