Korean English Japanese Chinese (Simplified) Chinese (Traditional)

 

 

 

A manual failover is explain in the previous section. Using fast start failover feature, broker automatically fails over to the standby database without requiring manual steps when the primary database is not unavailable. 

 

 

 

 

 

 

Q1. Enable fast start failover, create a database service and create a trigger to start it when the database acts like a primary database. Then connect to the primary db using the database using the database service and run a session. When the session is running, shutdown the primary database and make sure the automatic switchover is performed. Check the status of the first session. At the end, perform a switchover back to the previous primary database. (25min)

더보기

1. Create a data guard configuration, and make sure you successfully created Data Guard Broker configuration. 

References: https://yooliberalhouse.tistory.com/148 ,  https://yooliberalhouse.tistory.com/146 

 

 

 

2. Change the protection mode to maximum availability. Before changing it, set LogXptMode property to set redo transport service to SYNC. Next, specify database unique name of the standby database for each database as a value of FastStartFailoverTarget property to set target of the fast-start failover and change the protection mode to maximum available.

/* DGMGRL, on node1 */
EDIT DATABASE oradb_s2 SET PROPERTY 'LogXptMode'='SYNC';
EDIT DATABASE oradb SET PROPERTY 'LogXptMode'='SYNC';
EDIT DATABASE oradb_s2 SET PROPERTY FastStartFailoverTarget=oradb;
EDIT DATABASE oradb SET PROPERTY FastStartFailoverTarget=oradb_s2;
EDIT CONFIGURATION SET PROTECTION MODE AS MAXAVAILABILITY;
EDIT CONFIGURATION SET PROPERTY FastStartFailoverThreshold = 45;

 

 

 

3. Enable Flashback Database by issuing the following statements on each database

/* both node1, node2 */
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER SYSTEM SET DB_FLASHBACK_RETENTION_TARGET=4320 SCOPE=BOTH;
ALTER DATABASE ARCHIVELOG;
ALTER SYSTEM SET db_recovery_file_dest_size=<size>;
ALTER SYSTEM SET db_recovery_file_dest=<directory-specification>;
ALTER DATABASE FLASHBACK ON;
ALTER DATABASE OPEN;

 

 

 

4. Enable FAST_START FAILOVER, and observer.

/* on node1 */
ENABLE FAST_START FAILOVER;
start observer

 

 

 

 

5. Create a database service and create a trigger to start it when the database acts like a primary database. (optional)

/* on node1 */
EXEC DBMS_SERVICE.CREATE_SERVICE (service_name => 'SERV',
								  network_name => 'SERV',
                                  failover_method => 'BASIC',
                                  failover_type => 'SELECT',
                                  failover_retries => 180,
                                  failover_delay => 1);
CREATE OR REPLACE TRIGGER manage_dgservice
AFTER STARTUP
ON DATABASE
DECLARE
	role	VARCHAR2(30);
BEGIN
	SELECT database_role INTO role FROM v$database;
	
	IF role = 'PRIMARY'
	THEN
		DBMS_SERVICE.START_SERVICE('SERV');
	END IF;
END;
/

 

 

 

6. Start the service manually and switch the log file. (optional)

/* on node1 */
EXEC DBMS_SERVICE.START_SERVICE('SERV');
ALTER SYSTEM SWITCH LOGFILE;

 

 

 

7. Add this entry to the tnsnames.ora file of primary database. (optional)

/* on node1 */
cd $ORACLE_HOME/network/admin
vi tnsnames.ora

FSO_TEST =
  (DESCRIPTION =
    (ADDRESS_LIST = 
	(ADDRESS = (PROTOCOL = TCP)(HOST = srv1.localdomain)(PORT = 1521))
	(ADDRESS = (PROTOCOL = TCP)(HOST = srv2.localdomain)(PORT = 1521))
	(LOAD_BALANCE = yes)
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = SERV)
    )
  )

 

 

 

 

 

 

 

 

8. Abort the primary database.

/* on node1 */
SHUTDOWN ABORT;

/* on node2 */
select open_mode from v$database;

show configuration;

 

 

 

9. reinstate the pre-primary database, and check configuration. But when mount the pre-primary database, it will auto reinstate.

/* on node1 */
STARTUP MOUNT;

dgmgrl
connect sys

REINSTATE DATABASE oradb; /* optional */

show configuration;

switchover to oradb;

 

 

 

 

 

 

 

If you like this post, please give me a ❤️...!
 
✰Popular Posts✰
✰Recent Posts✰
 

❤ from Seoul, Daejeon, Tokyo, Fukuoka