【DG】dg中如何配置多个后台observer

0    52    1

👉 本文共约9697个字,系统预计阅读时间或需37分钟。

How to run Observer process as a background process (文档 ID 1084681.1)

In this Document
Goal
Solution


APPLIES TO:

Oracle Server - Enterprise Edition - Version: 10.1.0.2 and later [Release: 10.1 and later ]
Information in this document applies to any platform.

GOAL

When setup DataGuard Fast Start Failover, the Observer is a continuous foreground process. How to run it as a background process instead?

SOLUTION

There are a few methods to achieve this:

\1. start the dgmgrl process with nohup command, eg:

\2. create a shell script and run the shell script at background:

create observer.sh like:

\3. From 11.2 onwards, one can use the following command to start observer:

ORACLE 12.2 - Starting the Oracle Data Guard Broker OBSERVER in the BACKGROUND (文档 ID 2285158.1)


In this Document

Goal
Solution
1. Before configuring the wallet check the configuration
2. Create the wallet
3. Start the observer on the Observer system
4. Check the observer log
5. In case of any issues enable tracing

APPLIES TO:

Oracle Database - Enterprise Edition - Version 12.2.0.1 and later
Information in this document applies to any platform.

GOAL

Explain the new Oracle Data Guard 12.2 enhancement to Fast_Start Failover (FSFO) allowing the observer to be started in the background.

SOLUTION

From Oracle 12.2 onward the Fast_Start Failover observer can be started as a background process.To start the OBSERVER in the background, the observer uses wallet authentication to connect to primary and target standby databases. The first step is to configure the WALLET and add credentials for the connect string that the OBSERVER will use to connect to the databases.

By default the observer uses the dgconnectidentifier specified by the user to connect to the primary and standby databases. However if the Broker property 'OBSERVERCONNECTIDENTIFIER' is configured on a database then the observer uses the observerconnectidentifier to connect to the that database.

1. Before configuring the wallet check the configuration

show database verbose ;
show database verbose ;

Example:

DGMGRL> show configuration
Configuration - 122
Protection Mode: MaxProtection
Members:
prod - Primary database
pstdby - (*) Physical standby database

Fast-Start Failover: ENABLED
Configuration Status:
SUCCESS (status updated 30 seconds ago)

a. Primary configuration,

DGMGRL> show database verbose prod;

Database - prod

Role: PRIMARY
Intended State: TRANSPORT-ON
Instance(s):
prod

Properties:
DGConnectIdentifier = ' prod '
ObserverConnectIdentifier = ''

Note: The OBSERVERCONNECTIDENTIFIER property is not set hence the observer will use dgconnectidentifier 'prod' to connect to primary

b. Standby configuration,

DGMGRL> show database verbose pstdby;

Database - pstdby

Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: 0 seconds (computed 0 seconds ago)
Apply Lag: 0 seconds (computed 0 seconds ago)
Average Apply Rate: 5.00 KByte/s
Active Apply Rate: 1.08 MByte/s
Maximum Apply Rate: 2.08 MByte/s
Real Time Query: ON
Instance(s):
pstdby

Properties:
DGConnectIdentifier = 'pstdby'
ObserverConnectIdentifier = ' pstdby_observer '

Note: Here the OBSERVERCONNECTIDENTIFIER property is set and the observer will use the 'pstdby_observer' connection string instead.

2. Create the wallet

2.1 Create the wallet on the Primary system

mkstore -wrl /u01/app/oracle/wallet/ -create
mkstore -wrl /u01/app/oracle/wallet/ -createCredential 'prod' sys sys
mkstore -wrl /u01/app/oracle/wallet/ -createCredential 'pstdby_dgmgrl' sys sys

2.2 Add the wallet location entry in the SQLNET.ora on the Primary system

SQLNET.ora
------------

NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME,EZCONNECT)
WALLET_LOCATION=(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=/u01/app/oracle/wallet/)))
SQLNET.WALLET_OVERRIDE=TRUE

2.3 Copy the wallet file to the standby system and add the wallet location to the standby SQLNET.ORA

SQLNET.ora
------------

NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME,EZCONNECT)
WALLET_LOCATION=(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=/u01/app/oracle/wallet/)))
SQLNET.WALLET_OVERRIDE=TRUE

2.4 Reload the listener(s)

On the primary and target standby systems.

lsnrctl reload

3. Start the observer on the Observer system

From Oracle 12.2 onward each Oracle Data Guard Broker configuration can have a maximum of 3 OBSERVERs. The OBSERVER started first will act as master observer. In this configuration there are three observers, 'dg-workshop1', 'ob3' and 'abc'. In the following example the 'ob3' observer is started and added to the configuration as a 'backup' observer. The other two were started previously.

dgmgrl sys/sys@prod

DGMGRL> start observer ob3 in background logfile is '/u01/observerlog' connect identifier is prod;

Submitted command "START OBSERVER" using connect identifier "prod"

Observer 'ob3' started

DGMGRL> show observer;

Configuration - 122

Primary: prod
Target: pstdby

Observer "dg-workshop1" - Master

Host Name: dg-observer
Last Ping to Primary: 3 seconds ago
Last Ping to Target: 3 seconds ago

本人提供Oracle、MySQL、PG等数据库的培训和考证业务,私聊QQ646634621或微信db_bao,谢谢!

Observer "ob3" - Backup

Host Name: dg-prod
Last Ping to Primary: 3 seconds ago
Last Ping to Target: 3 seconds ago

Observer "abc" - Backup

Host Name: dg-standby
Last Ping to Primary: 574 seconds ago
Last Ping to Target: 538 seconds ago

4. Check the observer log

$ tail -f /u01/observerlog

[W000 07/11 14:06:59.63] FSFO target standby is pstdby
[W000 07/11 14:07:02.15] Observer 'ob3' started
[W000 07/11 14:07:02.15] Observer trace level is set to USER
[W000 07/11 14:07:02.15] Try to connect to the primary.
[W000 07/11 14:07:02.15] Try to connect to the primary prod.
[W000 07/11 14:07:02.16] The standby pstdby is ready to be a FSFO target
[W000 07/11 14:07:04.16] Connection to the primary restored!
[W000 07/11 14:07:07.18] Disconnecting from database prod.

5. In case of any issues enable tracing

Disconnect from the existing DGMGRL session and reconnect

dgmgrl -debug sys/sys@prod

DGMGRL> start observer ob3 in background logfile is '/u01/observerlog' connect identifier is prod trace_level is support;

The trace_level support will clearly explain why observer was not able to connect to primary or target standby.

NOTE: With trace_level support we get additional details of what connect string OBSERVER using to connect to primary and target standby.

[W000 07/11 14:02:44.78] Observer successfully registered with obid=0x3ba51662 (1000674914)
[W000 07/11 14:02:44.78] FSFO target standby is pstdby
[W000 07/11 14:02:44.78] State written: local_obid=0x3ba51662 (1000674914), version=0, svrflgs=0x0, target=2, cltflgs=0x60, FSFO_MIV=41.
[W000 07/11 14:02:44.79] Sending command CONNECT to thread P001
[S002 07/11 14:02:44.79] New thread started.
[P001 07/11 14:02:44.79] New thread started.
[P001 07/11 14:02:44.79] Executing CONNECT command.
[P001 07/11 14:02:44.79] Connecting to database using prod. <<<<<<<<<<<<<<<<<<for primary observer using prod
[B003 07/11 14:02:44.79] New thread started.
[P001 07/11 14:02:44.79] Attempt logon as SYSDG
[P001 07/11 14:02:45.88] Attempt logon as SYSDBA
[P001 07/11 14:02:45.92] Executing query [select db_unique_name from v$database].
[P001 07/11 14:02:45.92] Query result is 'prod'
Connected to "prod"
[P001 07/11 14:02:45.92] Checking broker version [BEGIN :version := dbms_drs.dg_broker_info('VERSION'); END;].
[P001 07/11 14:02:45.92] Oracle database version is '12.2.0.1.0'
[W000 07/11 14:02:45.92] Command CONNECT to thread P001 returned status=0
[W000 07/11 14:02:45.92] Sending command CONNECT to thread S002
[S002 07/11 14:02:45.92] Executing CONNECT command.
[S002 07/11 14:02:45.92] Connecting to database using pstdby_observer. <<<<<<<<<<for standby observer using pstdby_observer
[S002 07/11 14:02:45.92] Attempt logon as SYSDG
[S002 07/11 14:02:47.05] Attempt logon as SYSDBA
[S002 07/11 14:02:47.14] Executing query [select db_unique_name from v$database].
[S002 07/11 14:02:47.15] Query result is 'pstdby'
Connected to "pstdby"
[S002 07/11 14:02:47.15] Checking broker version [BEGIN :version := dbms_drs.dg_broker_info('VERSION'); END;].
[S002 07/11 14:02:47.15] Oracle database version is '12.2.0.1.0'
[W000 07/11 14:02:47.15] Command CONNECT to thread S002 returned status=0
[W000 07/11 14:02:47.15] Observer 'ob3' started

*
*

**Oracle 12.2 - Simplified OBSERVER Management for Multiple Fast-Start Failover Configurations (文档 ID 2285891.1)**\

In this Document

Goal
Solution
1. Check what connect string observer using to connect to Primary and target standby
1.1 DG configuration - I
1.1.a. Primary configuration
1.1.b. Standby configuration
1.2 DG configuration - II
1.2.a Primary configuration
1.2.b Standby configuration
2. TNS Alias on OBSERVER HOST
3. Configure Wallet from the OBSERVER host
3.1 Create wallet Key
3.2 Make entry in SQLNET
3.3 Reload all the listeners on all DG configuration.
4. Create ObserverConfigFile
5. Connect to dgmgrl and start the observer(s)
5.1 From observer host
5.2 Start the observer(s) for two DG broker configurations
5.3 Check the OBSERVERs status
6. Troubleshooting 6.1. OBSERVER status shows UNKNOWN
6.2. Starting OBSERVER failing with ORA-01017

APPLIES TO:

Oracle Database - Enterprise Edition - Version 12.2.0.1 to 12.2.0.1 [Release 12.2]
Information in this document applies to any platform.

GOAL

Simplified observer management :- One command to manage multiple observers on different FSFO configuration. Separate observers are must to manage each FSFO configuration but the management of Observers are done in a group via single dgmgrl prompt. Users can either manage the observer separately like pre 12.2 case or manage observers in a group.

SOLUTION

1. Check what connect string observer using to connect to Primary and target standby

show configuration
show database verbose show database verbose

Configuration Example: Here two DG configuration with FSFO taken as an example namely ‘122’ and ‘ora122’.

Example:

1.1 DG configuration - I

DGMGRL> show configuration
Configuration - 122
Protection Mode: MaxProtection
Members:
prod - Primary database
pstdby - (*) Physical standby database

Fast-Start Failover: ENABLED
Configuration Status:
SUCCESS (status updated 30 seconds ago)

1.1.a. Primary configuration

DGMGRL> show database verbose prod;

Database - prod

Role: PRIMARY
Intended State: TRANSPORT-ON
Instance(s):
prod

Properties:
DGConnectIdentifier = 'prod'
ObserverConnectIdentifier = '' <<<<OBSERVERCONNECTIDENTIFIER is not set hence observer will use dgconnectidentifier 'prod' to connect to primary

1.1.b. Standby configuration

DGMGRL> show database verbose pstdby;

Database - pstdby

Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: 0 seconds (computed 0 seconds ago)
Apply Lag: 0 seconds (computed 0 seconds ago)
Average Apply Rate: 5.00 KByte/s
Active Apply Rate: 1.08 MByte/s
Maximum Apply Rate: 2.08 MByte/s
Real Time Query: ON
Instance(s):
pstdby

Properties:
DGConnectIdentifier = 'pstdby'
ObserverConnectIdentifier = 'pstdby_dgmgrl' <<<<OBSERVERCONNECTIDENTIFIER is set

1.2 DG configuration - II

DGMGRL> show configuration

Configuration - ora122

Protection Mode: MaxPerformance
Members:
ora122 - Primary database
stby122 - (*) Physical standby database

Fast-Start Failover: ENABLED

Configuration Status:
SUCCESS (status updated 57 seconds ago)
ora122_observer is a configurationwiseservicename which is common to both priamry and standby

1.2.a Primary configuration

DGMGRL> show database verbose ora122;

Database - ora122

Role: PRIMARY
Intended State: TRANSPORT-ON
Instance(s):
ORA122

Properties:
DGConnectIdentifier = 'ora122'
ObserverConnectIdentifier = 'ora122_observer'

1.2.b Standby configuration

DGMGRL> show database verbose stby122

Database - stby122

Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: 0 seconds (computed 1 second ago)
Apply Lag: 0 seconds (computed 1 second ago)
Average Apply Rate: 14.00 KByte/s
Active Apply Rate: 1.56 MByte/s
Maximum Apply Rate: 6.49 MByte/s
Real Time Query: ON
Instance(s):
stby122

Properties:
DGConnectIdentifier = 'stby122'
ObserverConnectIdentifier = 'stby122_observer'

2. TNS Alias on OBSERVER HOST

prod =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.184.32.130)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = prod)
)
)

pstdby_observer =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.184.32.130)(PORT = 1526))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pstdby_observer)
)
)
ORA122_observer =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ha.idc.oracle.com)(PORT = 1520))
(ADDRESS = (PROTOCOL = TCP)(HOST = ha.idc.oracle.com)(PORT = 1522))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ora122_observer)
)
)
stby122_observer=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ha.idc.oracle.com)(PORT = 1522))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = stby122)
)
)

3. Configure Wallet from the OBSERVER host

3.1 Create wallet Key

mkdir –p /u01/app/oracle/wallet/
mkstore –wrl /u01/app/oracle/wallet/ -create
mkstore -wrl /u01/app/oracle/wallet/ -createCredential 'prod' sys sys
mkstore -wrl /u01/app/oracle/wallet/ -createCredential 'pstdby_observer' sys sys
mkstore -wrl /u01/app/oracle/wallet/ -createCredential 'ora122_observer' sys oracle
mkstore -wrl /u01/app/oracle/wallet/ -createCredential 'stby122_observer' sys oracle

NOTE: sys password on DG configuration ora122 is oracle

3.2 Make entry in SQLNET

NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME,EZCONNECT)
WALLET_LOCATION=(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=/u01/app/oracle/wallet/)))
SQLNET.WALLET_OVERRIDE=TRUE

3.3 Reload all the listeners on all DG configuration.

4. Create ObserverConfigFile

Observerconfigfile has two parts
– Configuration Declaration : Mandatory section. Used to define the different FSFO configuration
– Group Definition : Optional section. If provided each group needs to have at least one broker configuration defined

vi observer.ora <<default name

BROKER_CONFIGS = (
(CONFIG = (NAME=ORDER) (CONNECT_ID=PROD_observer)(config_home=/u01/app/oracle/oradata/))
(CONFIG = (NAME=REPORTING) (CONNECT_ID=ORA122_observer)(config_home=/u01/app/oracle/oradata/)))
CONFIG_GROUPS = (
(GROUP =(NAME=GRP_A )
(CONFIG_LIST = (NAME=ORDER)(NAME=REPORTING)))
(GROUP= (NAME=GRP_B)
(CONFIG_LIST = (NAME=REPORTING)))
(GROUP= (NAME=GRP_C)
(CONFIG_LIST = (NAME=ORDER))))

5. Connect to dgmgrl and start the observer(s)

5.1 From observer host

dgmgrl sys/sys@prod
DGMGRL>show observerconfigfile;

observer.ora is the default file name. For different file names first set the observerconfigfile using set observerconfigfile

5.2 Start the observer(s) for two DG broker configurations

DGMGRL> start observing grp_a

DGMGRL> start observing grp_a
ObserverConfigFile=observer.ora
observer configuration file parsing succeeded
Submitted command "START OBSERVER" using connect identifier "PROD"
Submitted command "START OBSERVER" using connect identifier "ORA122_observer"

Check superobserver.log and individual observer logs for execution details.

5.3 Check the OBSERVERs status

Show observers or show observers for grp_a

DGMGRL> show observers
ObserverConfigFile=observer.ora
observer configuration file parsing succeeded
Submit command SHOW OBSERVER using the connect identifier 'PROD'.
Connected to "prod"

Configuration - 122

Primary: prod
Target: pstdby

Observer "dg-workshop1" - Master

Host Name: dg-workshop
Last Ping to Primary: 1 second ago
Last Ping to Target: 4 seconds ago

Submit command SHOW OBSERVER using the connect identifier 'ORA122_observer'.
Connected to "ORA122"
Configuration - ora122
Primary: ora122
Target: stby122

Observer "dg-workshop1" - Master

Host Name: dg-workshop
Last Ping to Primary: 3 seconds ago
Last Ping to Target: 6 seconds ago

6. Troubleshooting 6.1. OBSERVER status shows UNKNOWN

DGMGRL> show observers;
ObserverConfigFile=observer.ora
observer configuration file parsing succeeded
Submit command SHOW OBSERVER using the connect identifier 'PROD'.
Connected to "prod"
Configuration - 122
Primary: prod
Target: pstdby
Observer "dg-workshop1" - Master
Host Name: dg-workshop
Last Ping to Primary: (unknown)
Last Ping to Target: (unknown)

CAUSE : Last ping to Primary and Last ping to Target is UNKNOWN if OBSERVER host not able to ping to observerconnectidentifier(if defined) or dgconnectidentifier.

SOLUTION : Make sure to have connect string entry on OBSERVER host for all the databases in the DG configurations.

6.2. Starting OBSERVER failing with ORA-01017

DGMGRL> start observer new in background connect identifier is prod_observer;
Submitted command "START OBSERVER" using connect identifier "prod_observer"
DGMGRL> DGMGRL for Linux: Release 12.2.0.1.0 - Production on Fri Jul 7
15:32:37 2017

Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights
reserved.

Welcome to DGMGRL, type "help" for information.
ORA-01017: invalid username/password; logon denied

Warning: You are no longer connected to ORACLE.
not logged on
Failed to start the observer.

CAUSE : While starting observer from the observerconfigfile as a group OBSERVER uses wallet authentication to connect to primary and standby databases even though SYS credentials are used while connecting to DGMGR.

SOLUTION : Check the wallet configuration. Verify any errors observed while doing listener reload.

标签:

头像

小麦苗

学习或考证,均可联系麦老师,请加微信db_bao或QQ646634621

您可能还喜欢...

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

17 + 8 =

 

嘿,我是小麦,需要帮助随时找我哦
  • 18509239930
  • 个人微信

  • 麦老师QQ聊天
  • 个人邮箱
  • 点击加入QQ群
  • 个人微店

  • 回到顶部
返回顶部