[toc]

ORACLE RAC 到单机 DG Broker 配置与切换

环境信息

IP 地址 hostname db_name db_unique_name 备注 tnsnames.ora
172.8.8.82 11g-node1 rac11g rac11g RAC node1 rac11g_RAC11GDG
172.8.8.83 11g-node2 rac11g rac11g RAC node2 rac11g_RAC11GDG
172.8.8.86 rac11g-cluster rac11g \ RAC scan IP
172.8.8..201 dgbrok rac11g RAC11GDG 单机IP RAC11GDG_rac11g

DG Broker 基础知识
image-20240405103152985

ORACLE DG Broker 的前提

0、数据库版本10gr1 以上

1、Data Guard 搭建完成,数据在应用同步

2、_DGMGRL_DGB监听服务

  • 其中 _DGMGRL 完整名称为:<db_unique_name>_DGMGRL.<db_domain>,需要静态注册。

    Note: Static “_DGMGRL” entries are no longer needed as of Oracle Database 12.1.0.2 in Oracle Data Guard Broker configurations that are managed by Oracle Restart, RAC On Node or RAC as the Broker will use the clusterware to restart an instance.

    需要注意的是 _DGMGRL 在12.1.0.2 之后不是必须的。

  • 其中_DGB 完整名称为:<db_unique_name>_DGB.<db_domain>,官方介绍 _DGB 会在DMON进程启动时候自动注册,也就是 dg_broker_start 设置为 true 时会自动启动并动态注册 _DGB 服务。

    When you start the Data Guard Broker (DMON)-Process on your Primary and Standby Database, it will start and register Services on the Local Listener:
    _DGB.: This Service is used by the DMON-Processes to communicate between each other

3、DG_BROKER_START参数设置为TRUE,会启动 DMON 进程

4、需要 spfile 启动数据库(基本可以忽略,生产库通常都是spfile启动

5、dg_broker_config_file1[2] 参数在 RAC 环境需要配置在共享文件系统比如 ASM

RAC 环境监听新增 _DGMGRL 静态注册

1.1 RAC node 1 监听配置前的状态

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
[grid@11g-node1 ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 08-FEB-2023 06:07:17

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 06-DEC-2022 09:01:23
Uptime 63 days 21 hr. 5 min. 54 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/11.2.0.4/grid/network/admin/listener.ora
Listener Log File /u01/app/11.2.0.4/grid/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.8.8.84)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.8.8.82)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "rac11g" has 1 instance(s).
Instance "rac11g1", status READY, has 1 handler(s) for this service...
The command completed successfully

1.2 listener.ora 监听文件新增静态注册

1
[grid@11g-node1 ~]$ vi  /u01/app/11.2.0.4/grid/network/admin/listener.ora
1
2
3
4
5
6
7
8
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = rac11g_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0.4/dbhome_1)
(SID_NAME = rac11g1)
)
)

注意:这里的 ORACLE_HOME 就是 $ORACLE_HOME ,不是 GRID_HOME ,写$GRID_HOME 在切换的时候会报: ORA-01017: invalid username/password; logon denied

1.3 listener.ora监听文件完整信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[grid@11g-node1 ~]$cat  /u01/app/11.2.0.4/grid/network/admin/listener.ora
LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))) # line added by Agent
LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))) # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent

INBOUND_CONNECT_TIMEOUT_LISTENER=0
DIAG_ADR_ENABLED_LISTENER=OFF
INBOUND_CONNECT_TIMEOUT_LISTENER_SCAN1=0
DIAG_ADR_ENABLED_LISTENER_SCAN1=OFF
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = rac11g_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0.4/dbhome_1)
(SID_NAME = rac11g1)
)
)

1.4 reload 监听

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
[grid@11g-node2 ~]$ lsnrctl reload

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 08-FEB-2023 06:12:53

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
The command completed successfully
[grid@11g-node2 ~]$ lsnrctl status
wait a limite
[grid@11g-node1 ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 08-FEB-2023 06:14:14

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 06-DEC-2022 09:01:23
Uptime 63 days 21 hr. 12 min. 50 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/11.2.0.4/grid/network/admin/listener.ora
Listener Log File /u01/app/11.2.0.4/grid/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.8.8.82)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.8.8.84)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "rac11g" has 1 instance(s).
Instance "rac11g1", status READY, has 1 handler(s) for this service...
Service "rac11g_DGMGRL" has 1 instance(s).
Instance "rac11g1", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

1.5 _DGMGRL 服务确认

可以看到监听新增了 rac11g_DGMGRLService ,其status 为静态注册 (UNKNOWN),对应的 Instancerac11g1

1.6 RAC node 2监听配置

同样主库 RAC 的节点2也是如上操作,将 instance 修改为 rac11g2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
[grid@11g-node2 ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 08-FEB-2023 06:12:11

Copyright (c) 1991, 2013, Oracle. All rights reserved.
LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))) # line added by Agent

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 04-DEC-2022 19:28:20
Uptime 65 days 10 hr. 43 min. 51 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/11.2.0.4/grid/network/admin/listener.ora
Listener Log File /u01/app/11.2.0.4/grid/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.8.8.85)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.8.8.83)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM2", status READY, has 1 handler(s) for this service...
Service "rac11g" has 1 instance(s).
Instance "rac11g2", status READY, has 1 handler(s) for this service...
The command completed successfully
[grid@11g-node2 ~]$ vi /u01/app/11.2.0.4/grid/network/admin/listener.ora
新增如下内容
------
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = rac11g_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0.4/dbhome_1)
(SID_NAME = rac11g2)
)
)
------
reload 监听
[grid@11g-node2 ~]$ lsnrctl reload

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 08-FEB-2023 06:12:53

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
The command completed successfully
[grid@11g-node2 ~]$ lsnrctl status
Listener Parameter File /u01/app/11.2.0.4/grid/network/admin/listener.ora
Listener Log File /u01/app/11.2.0.4/grid/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.8.8.83)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.8.8.85)(PORT=1521)))
Services Summary...
Service "rac11g" has 1 instance(s).
Instance "rac11g2", status READY, has 1 handler(s) for this service...
Service "rac11g_DGMGRL" has 1 instance(s).
Instance "rac11g2", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

1.7 RAC node 2监听确认

可以看到主库RAC的节点2 也是新增了 rac11g_DGMGRL 的静态监听,对应的Instancerac11g2

注意:RAC的 静态监听每个节点写各自的实例名称即可,不需要写全部节点的 SID。

单机环境监听新增 _DGMGRL 静态注册

2.1 单机环境 listener.ora 修改前的状态

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
oracle@dgbrok:/home/oracle $lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 08-FEB-2023 06:18:45

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.8.8..201)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 13-JAN-2023 21:33:47
Uptime 25 days 8 hr. 44 min. 58 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/dgbrok/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.8.8..201)(PORT=1521)))
Services Summary...
Service "RAC11G" has 1 instance(s).
Instance "RAC11GDG", status READY, has 1 handler(s) for this service...
Service "RAC11GDG" has 2 instance(s).
Instance "RAC11GDG", status UNKNOWN, has 1 handler(s) for this service...
Instance "RAC11GDG", status READY, has 1 handler(s) for this service...
The command completed successfully
oracle@dgbrok:/home/oracle $vi /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/listener.ora
----
old
LISTENER=
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.8.8..201)(PORT = 1521))
)
)

SID_LIST_LISTENER=
(SID_LIST =
(SID_DESC =
(SID_NAME = RAC11GDG)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0.4/dbhome_1)
(GLOBAL_DBNAME = RAC11GDG)
)
)
----
LISTENER=
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dgbrok)(PORT = 1521))
)
)

SID_LIST_LISTENER=
(SID_LIST =
(SID_DESC =
(SID_NAME = RAC11GDG)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0.4/dbhome_1)
(GLOBAL_DBNAME = RAC11GDG)
)
(SID_DESC =
(GLOBAL_DBNAME = RAC11GDG_DGMGRL)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0.4/dbhome_1)
(SID_NAME = RAC11GDG)
)
)

此处有了 RAC11GDG 静态注册了,是搭建DG 进行dup 的时候使用的,DG 搭建好之后,可以去掉,也可以新增一个 _DGMGRL的静态注册,本次操作是新增。

2.2reload 监听之后的信息确认

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
oracle@dgbrok:/home/oracle $lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 08-FEB-2023 06:26:25

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dgbrok)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 08-FEB-2023 06:25:47
Uptime 0 days 0 hr. 0 min. 37 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/dgbrok/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dgbrok)(PORT=1521)))
Services Summary...
Service "RAC11G" has 1 instance(s).
Instance "RAC11GDG", status READY, has 1 handler(s) for this service...
Service "RAC11GDG" has 2 instance(s).
Instance "RAC11GDG", status UNKNOWN, has 1 handler(s) for this service...
Instance "RAC11GDG", status READY, has 1 handler(s) for this service...
Service "RAC11GDG_DGMGRL" has 1 instance(s).
Instance "RAC11GDG", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

可以看到监听新增了 RAC11GDG_DGMGRLService ,其 status 为静态注册 (UNKNOWN),对应的 InstanceRAC11GDG

2.3 tnsnames.ora信息确认

三台主机的 tnsnames.ora信息都相同,具体如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[grid@11g-node2 admin]$ cat tnsnames.ora

rac11g_RAC11GDG =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.8.8.84 )(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.8.8.85 )(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = rac11g)
)
)
RAC11GDG_rac11g =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.8.8..201 )(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = RAC11GDG)
)
)

配置 DG Broker

3.1 创建 ASM 文件夹

1
2
3
su - grid
[grid@11g-node1 ~]$ asmcmd
ASMCMD> mkdir +data/RAC11G/dgbroker

3.2 RAC 环境 修改 dg_broker_config_file1[2]

RAC 环境 修改 dg_broker_config_file1[2] 到 ASM

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
SQL>  show parameter broker
NAME TYPE VALUE
------------------------------------ ---------------------- ------------------------------
dg_broker_config_file1 string /u01/app/oracle/product/11.2.0
.4/dbhome_1/dbs/dr1rac11g.dat
dg_broker_config_file2 string /u01/app/oracle/product/11.2.0
.4/dbhome_1/dbs/dr2rac11g.dat
dg_broker_start boolean TRUE
SQL> alter system set dg_broker_start=false scope=both sid='*';
SQL> System altered.
ALTER SYSTEM SET DG_BROKER_CONFIG_FILE1='+data/RAC11G/dgbroker/dgb_config1.ora' SCOPE=BOTH sid='*';
SQL> System altered.
ALTER SYSTEM SET DG_BROKER_CONFIG_FILE2='+data/RAC11G/dgbroker/dgb_config2.ora' SCOPE=BOTH sid='*';
SQL> System altered.
alter system set dg_broker_start=true scope=both sid='*';
SQL> System altered.
SQL> show parameter dg_broker

SQL>
NAME TYPE VALUE
------------------------------------ ------- ------------------------------
dg_broker_config_file1 string +data/RAC11G/dgbroker/dgb_config1.ora
dg_broker_config_file2 string +data/RAC11G/dgbroker/dgb_config2.ora
dg_broker_start boolean TRUE

注意:RAC环境 dg_broker_config_file1|[2] 参数必须放到共享文件系统里。否则会报ORA-16532

1
2
3
4
5
6
7
8
9
10
oracle@11g-node1:/home/oracle $oerr ORA 16532
16532, 00000, "Data Guard broker configuration does not exist"
// *Cause: A broker operation was requested that required a broker
// configuration to already be created.
// *Action: Create a Data Guard broker configuration prior to performing
// other broker operations. If only one instance of a RAC
// database is reporting this error, ensure that the
// DG_BROKER_CONFIG_FILE[1|2] initialization parameters are
// set to file locations that are shared by all instances of
// the RAC database.

3.3 配置 DG Broker

  • 登录 dgmgrl

    1
    2
    3
    4
    5
    6
    7
    oracle@11g-node1:/home/oracle $ dgmgrl   sys/password@rac11g_RAC11GDG
    DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production

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

    Welcome to DGMGRL, type "help" for information.
    Connected.
  • 配置 DG Broker

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
DGMGRL>  CREATE CONFIGURATION dgbrok AS PRIMARY DATABASE IS rac11g CONNECT IDENTIFIER IS rac11g_RAC11GDG;
Configuration "dgbrok" created with primary database "rac11g"
DGMGRL> ADD DATABASE RAC11GDG AS CONNECT IDENTIFIER IS RAC11GDG_rac11g MAINTAINED AS PHYSICAL;
Database "rac11gdg" added
DGMGRL> show configuration;

Configuration - dgbrok

Protection Mode: MaxPerformance
Databases:
rac11g - Primary database
rac11gdg - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
DISABLED
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
DGMGRL>  enable configuration
Enabled.
DGMGRL> show configuration;

Configuration - dgbrok

Protection Mode: MaxPerformance
Databases:
rac11g - Primary database
rac11gdg - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

3.4 DG Broker 常用命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
show configuration;
show database rac11g;
show database rac11gdg;
show database verbose rac11g;
show database verbose rac11gdg;

DGMGRL> show database verbose rac11g;

Database - rac11g

Role: PRIMARY
Intended State: OFFLINE
Instance(s):
rac11g1
rac11g2

Properties:
DGConnectIdentifier = 'rac11g_rac11gdg'
ObserverConnectIdentifier = ''
LogXptMode = 'ASYNC'
DelayMins = '0'
Binding = 'optional'
MaxFailure = '0'
MaxConnections = '1'
ReopenSecs = '300'
NetTimeout = '30'
RedoCompression = 'DISABLE'
LogShipping = 'ON'
PreferredApplyInstance = ''
ApplyInstanceTimeout = '0'
ApplyParallel = 'AUTO'
StandbyFileManagement = 'AUTO'
ArchiveLagTarget = '600'
LogArchiveMaxProcesses = '4'
LogArchiveMinSucceedDest = '1'
DbFileNameConvert = '+DATA/rac11g/, /oradg/RAC11GDG/'
LogFileNameConvert = '+DATA/rac11g/, /oradg/RAC11GDG/'
FastStartFailoverTarget = ''
InconsistentProperties = '(monitor)'
InconsistentLogXptProps = '(monitor)'
SendQEntries = '(monitor)'
LogXptStatus = '(monitor)'
RecvQEntries = '(monitor)'
ApplyLagThreshold = '0'
TransportLagThreshold = '0'
TransportDisconnectedThreshold = '30'
SidName(*)
StaticConnectIdentifier(*)
StandbyArchiveLocation(*)
AlternateLocation(*)
LogArchiveTrace(*)
LogArchiveFormat(*)
TopWaitEvents(*)
(*) - Please check specific instance for the property value

Database Status:
DISABLED

DGMGRL> show database verbose rac11gdg

Database - rac11gdg

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

Properties:
DGConnectIdentifier = 'rac11gdg_rac11g'
ObserverConnectIdentifier = ''
LogXptMode = 'ASYNC'
DelayMins = '0'
Binding = 'OPTIONAL'
MaxFailure = '0'
MaxConnections = '1'
ReopenSecs = '300'
NetTimeout = '30'
RedoCompression = 'DISABLE'
LogShipping = 'ON'
PreferredApplyInstance = ''
ApplyInstanceTimeout = '0'
ApplyParallel = 'AUTO'
StandbyFileManagement = 'AUTO'
ArchiveLagTarget = '600'
LogArchiveMaxProcesses = '4'
LogArchiveMinSucceedDest = '1'
DbFileNameConvert = ''
LogFileNameConvert = ''
FastStartFailoverTarget = ''
InconsistentProperties = '(monitor)'
InconsistentLogXptProps = '(monitor)'
SendQEntries = '(monitor)'
LogXptStatus = '(monitor)'
RecvQEntries = '(monitor)'
ApplyLagThreshold = '0'
TransportLagThreshold = '0'
TransportDisconnectedThreshold = '30'
SidName = 'RAC11GDG'
StaticConnectIdentifier = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dgbrok)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=RAC11GDG_DGMGRL)(INSTANCE_NAME=RAC11GDG)(SERVER=DEDICATED)))'
StandbyArchiveLocation = '/oradg'
AlternateLocation = ''
LogArchiveTrace = '0'
LogArchiveFormat = '%t_%s_%r.dbf'
TopWaitEvents = '(monitor)'

Database Status:
DISABLED

3.5 DG Broker 切换与回切

1
2
switchover to rac11gdg;    
switchover to rac11g;
  • DG Broker 切换
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    DGMGRL> switchover to rac11gdg;
    Performing switchover NOW, please wait...
    Operation requires a connection to instance "RAC11GDG" on database "rac11gdg"
    Connecting to instance "RAC11GDG"...
    Connected.
    New primary database "rac11gdg" is opening...
    Operation requires startup of instance "rac11g1" on database "rac11g"
    Starting instance "rac11g1"...
    ORACLE instance started.
    Database mounted.
    Database opened.
    Switchover succeeded, new primary is "rac11gdg"
  • DG Broker 回切
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    DGMGRL> switchover to rac11g;
    Performing switchover NOW, please wait...
    Operation requires a connection to instance "rac11g1" on database "rac11g"
    Connecting to instance "rac11g1"...
    Connected.
    New primary database "rac11g" is opening...
    Operation requires startup of instance "RAC11GDG" on database "rac11gdg"
    Starting instance "RAC11GDG"...
    ORACLE instance started.
    Database mounted.
    Database opened.
    Switchover succeeded, new primary is "rac11g"
    在本次回切的过程中遇到了 ORA-12545: Connect failed because target host or object does not exist 详见下一篇水文。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
DGMGRL> switchover to rac11g;
Performing switchover NOW, please wait...
Operation requires a connection to instance "rac11g1" on database "rac11g"
Connecting to instance "rac11g1"...
Connected.
New primary database "rac11g" is opening...
Operation requires startup of instance "RAC11GDG" on database "rac11gdg"
Starting instance "RAC11GDG"...
Unable to connect to database
ORA-12545: Connect failed because target host or object does not exist

Failed.
Warning: You are no longer connected to ORACLE.

Please complete the following steps to finish switchover:
start up instance "RAC11GDG" of database "rac11gdg"

原文作者: liups.com

原文链接: http://liups.cn/posts/869daf9f/

许可协议: 知识共享署名-非商业性使用 4.0 国际许可协议