Oracle 11g DG Broker Configuration and open

Several parameters to ensure that both sides of the following settings:

1.SQL> alter system set LOG_ARCHIVE_DEST_1='LOCATION=/data/u01/app/oracle/archive/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=db1';

System altered.

2.SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=db1 LGWR aSYNC VALID_FOR=(ONLINE_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=db1';

System altered.

3.SQL> ALTER SYSTEM SET LOG_FILE_NAME_CONVERT='/data/u01/app/oracle/oradata/db2/', '/data/u01/app/oracle/oradata/db1/' scope =spfile;

System altered.

4.SQL> ALTER SYSTEM SET DB_FILE_NAME_CONVERT= '/data/u01/app/oracle/oradata/db2/', '/data/u01/app/oracle/oradata/db1/' scope =spfile;

System altered.

5.SQL> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO SCOPE=SPFILE;

System altered.

6.SQL> ALTER SYSTEM SET FAL_CLIENT = db1 SCOPE=SPFILE;

System altered.

7.SQL> ALTER SYSTEM SET FAL_SERVER = db2 SCOPE=SPFILE;

System altered.

8. The main library prepared library adds standby logfile

9. SQL> alter database force logging;

Database altered.

Premise: the main library db1 db2 library equipment

A: open db broker

On the primary library for each set to true

SQL> alter system set dg_broker_start=true;

After the parameters dg_broker_config_file, default back to when you created the configuration and enable: the main library equipment!

It will generate the corresponding files in this directory!

SQL> show parameter dg_broker_config_file;

NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

dg_broker_config_file1 string /data/u01/app/oracle/product/1

1.2.0 / dbhome_1 / dbs / dr1db2.dat

dg_broker_config_file2 string /data/u01/app/oracle/product/1

1.2.0 / dbhome_1 / dbs / dr2db2.dat

Dg_broker_config_file modify parameters. Here you use the default path, you can specify your own. If you are in a RAC environment, this this file to the shared storage above, if you have ASM ASM can be put in.

Second, the main library equipment listener.ora add db broker switch between listening service, because the service name dg broker use is db_unique_name_DGMGRL, Note: If you do not modify the monitor using the original monitor also can be obtained, the following will introduce this method!

2.1 vim listener.ora, add the red section below! Note that certain format, strict alignment

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))

(ADDRESS = (PROTOCOL = TCP)(HOST = 10.9.21.178)(PORT = 1521))

)

)

SID_LIST_LISTENER=

(SID_LIST=

(SID_DESC=

(GLOBAL_DBNAME=db2)

(ORACLE_HOME=/data/u01/app/oracle/product/11.2.0/dbhome_1)

(SID_NAME=db2))

(SID_DESC=

(GLOBAL_DBNAME=db2_DGMGRL)

(ORACLE_HOME=/data/u01/app/oracle/product/11.2.0/dbhome_1)

(SID_NAME=db2)))

ADR_BASE_LISTENER = /data/u01/app/oracle

2.2 reload the listener:

III. Configuration db broker

3.1. Connect the main library

[oracle@beijing-fuli-hadoop-02 admin]$ dgmgrl sys/oracle@db2

3.2. Creating the Configuration

DGMGRL> help

The following commands are available:

add Adds a standby database to the broker configuration

connect Connects to an Oracle database instance

convert Converts a database from one type to another

create Creates a broker configuration

disable Disables a configuration, a database, or fast-start failover

edit Edits a configuration, database, or instance

enable Enables a configuration, a database, or fast-start failover

exit Exits the program

failover Changes a standby database to be the primary database

help Displays description and syntax for a command

quit Exits the program

reinstate Changes a database marked for reinstatement into a viable standby

rem Comment to be ignored by DGMGRL

remove Removes a configuration, database, or instance

show Displays information about a configuration, database, or instance

shutdown Shuts down a currently running Oracle database instance

sql Executes a SQL statement

start Starts the fast-start failover observer

startup Starts an Oracle database instance

stop Stops the fast-start failover observer

switchover Switches roles between a primary and standby database

DGMGRL> help create

Creates a broker configuration

Syntax:

CREATE CONFIGURATION <configuration name> AS

PRIMARY DATABASE IS <database name>

CONNECT IDENTIFIER IS <connect identifier>;

DGMGRL> CREATE CONFIGURATION dbha_c AS PRIMARY DATABASE IS db2 CONNECT IDENTIFIER IS db2;

(Explanation: where dbha_c is just from the name, db2 database is the only name of the Lord, identifier is the network service name is the tnsnames.ora can then be used to delete the following configuration created!!

DGMGRL> REMOVE CONFIGURATION;)

Library prepared by adding 3.3

DGMGRL> help add

DGMGRL> add database 'db1' as connect identifier is 'db1' maintained as physical;

Database "db1" added

Note identifier is 'db1' db1 here is that you tnsnames.ora inside of that name on the standby database!

After adding

3.4 CONFIGURATION start of this db broker!

DGMGRL> help enable

DGMGRL> ENABLE CONFIGURATION;

3.5 View db broker of the relevant configuration

DGMGRL> help show

DGMGRL> SHOW CONFIGURATION;

The following error:

DGMGRL> show configuration

Configuration - dbha_c

Protection Mode: MaxPerformance

Databases:

db2 - Primary database

db1 - Physical standby database (disabled)

Fast-Start Failover: DISABLED

Configuration Status:

SUCCESS

Solution:

The master file is deleted from this catalog, and then re-create configuration, you can!

SQL> show parameter dg_broker_config_file;

NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

dg_broker_config_file1 string /data/u01/app/oracle/product/1

1.2.0 / dbhome_1 / dbs / dr1db2.dat

dg_broker_config_file2 string /data/u01/app/oracle/product/1

1.2.0 / dbhome_1 / dbs / dr2db2.dat

Explanation: The role of these two documents?

Below shows a representative normal !!!

DGMGRL> show configuration

Configuration - dbha_c

Protection Mode: MaxPerformance

Databases:

db2 - Primary database

db1 - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:

SUCCESS

View the status of the database:

DGMGRL> show database verbose db1;

# Here to pay attention. service_name connection broker which is <db_unique_name> _DGMGRL, so the above have to adapt to listen!

If you do not modify the file to listen, then you can also execute the following command to change StaticConnectIdentifier:

DGMGRL>edit database db1 set property StaticConnectIdentifier= '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=beijing-fuli-hadoop-01)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=db1)(INSTANCE_NAME=db1)(SERVER=DEDICATED)))';

DGMGRL> edit database db2 set property StaticConnectIdentifier='(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=beijing-fuli-hadoop-02)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=db2)(INSTANCE_NAME=db2)(SERVER=DEDICATED)))';

Four: the relevant command on db broker:

4.1: Switching master-slave!

DGMGRL> help switchover

DGMGRL> switchover to db1

Performing switchover NOW, please wait...

Operation requires a connection to instance "db1" on database "db1"

Connecting to instance "db1"...

Connected.

New primary database "db1" is opening...

Operation requires startup of instance "db2" on database "db2"

Starting instance "db2"...

ORACLE instance started.

Database mounted.

Database opened.

Switchover succeeded, new primary is "db1"

DGMGRL>

4.2: the state replaced snapshot from JM Coetzee (provided that opened the flashback database)!

Main library operations

DGMGRL> SHOW CONFIGURATION

DGMGRL> help convert

DGMGRL> CONVERT DATABASE db1 TO SNAPSHOT STANDBY;

DGMGRL> SHOW CONFIGURATION;

4.3: modifications dg synchronous redo the way, as well as protected mode!

DGMGRL> help edit

DGMGRL> EDIT DATABASE db2 SET PROPERTY LogXptMode=SYNC; ---主库

DGMGRL> EDIT DATABASE db1 SET PROPERTY LogXptMode=SYNC; ---备库

DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MaxAvailability; ---主库

DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MaxAvailability; ---备库

Guess you like

Origin www.linuxidc.com/Linux/2019-08/160289.htm