The Oracle ADG has been set up.
When the Oracle ADG needs to perform planned migration, you need to configure the Oracle built-in components in advance. Data Guard Broker is the name of an Oracle standby database solution for disaster recovery and high availability. This section gives an example of setting up and managing Data Guard using Data Guard Broker.
SELECT log_mode FROM v$database;
If the noarchivelog mode is used, run the following command to switch to the archive log mode.
SHUTDOWN IMMEDIATE; STARTUP MOUNT; ALTER DATABASE ARCHIVELOG; ALTER DATABASE OPEN;
ALTER DATABASE FORCE LOGGING;. ALTER SYSTEM SWITCH LOGFILE;
When creating a standby REDO log file, ensure that the size of the log file is at least the same as that of the original REDO log file.
select group#,member from v$logfile order by group#;
The following figure shows the query result:
You need to create standby log files on the active/standby based on the number of REDO log files, and the start value of the group increases from the existing value. Take Figure 1 as an example, when only Thread 1 exists and the maximum value of GROUP in the figure is 2, the start value of GROUP must be greater than 2.
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 GROUP 3 ('+REDO/hwdb/standby_redo01.log') SIZE 1024M;
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 GROUP 4 ('+REDO/hwdb/standby_redo02.log') SIZE 1024M;
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 GROUP 5 ('+REDO/hwdb/standby_redo03.log') SIZE 1024M;
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 GROUP 3 ('+REDO/hwdbdg/standby_redo01.log') SIZE 1024M;
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 GROUP 4 ('+REDO/hwdbdg/standby_redo02.log') SIZE 1024M;
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 GROUP 5 ('+REDO/hwdbdg/standby_redo03.log') SIZE 1024M;
HWDBDG =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node2)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = hwdbdg)
)
lsnrctl stop lsnrctl start
ALTER SYSTEM SET dg_broker_start=true;
su - oracle ; dgmgrl sys/passwd@hwdb
Assume that hwdb is db_unique_name of the ADG primary end and hwdbdg is the db_unique_name of the ADG secondary end.
CREATE CONFIGURATION my_config AS PRIMARY DATABASE IS hwdb CONNECT IDENTIFIER IS hwdb;
ADD DATABASE hwdbdg AS CONNECT IDENTIFIER IS hwdbdg MAINTAINED AS PHYSICAL;
Run the following command on the primary server:
ALTER SYSTEM SET DG_BROKER_START=FALSE;
ALTER SYSTEM SET DG_BROKER_CONFIG_FILE1 = '+REDO/{primary_db_unique_name}/DR1.DAT' SCOPE=BOTH;
ALTER SYSTEM SET DG_BROKER_CONFIG_FILE2 = '+REDO/{primary_db_unique_name}/DR2.DAT' SCOPE=BOTH;
ALTER SYSTEM SET DG_BROKER_START=TRUE;
Run the following command on the standby server:
ALTER SYSTEM SET DG_BROKER_START=FALSE;
ALTER SYSTEM SET DG_BROKER_CONFIG_FILE1 = '+REDO/{standby_db_unique_name}/DR1.DAT' SCOPE=BOTH;
ALTER SYSTEM SET DG_BROKER_CONFIG_FILE2 = '+REDO/{standby_db_unique_name}/DR2.DAT' SCOPE=BOTH;
ALTER SYSTEM SET DG_BROKER_START=TRUE;
ENABLE CONFIGURATION;
SHOW CONFIGURATION;
If SUCCESS is displayed, the configuration is successful and you can perform the Oracle ADG planned migration. Otherwise, the migration fails.