top of page
Search
Writer's picturepartition liu

A easy and simple way to establish Oracle ADG



Yes, thanks to




Then, I can give simple and reasy way to make it.


Suppose hosts and IPs like that:


150.150.186.16 linux3 (primary)

150.150.186.26 linux4 (secondary or standby)


On primary node:



(1) parameter:


SQL> show parameter db_name


NAME TYPE VALUE


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


db_name string TEST


SQL> show parameter db_uniq


NAME TYPE VALUE


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


db_unique_name string TEST


SQL> show parameter LOG_ARCHIVE_CONFIG


NAME TYPE VALUE


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


log_archive_config string DG_CONFIG=(TEST,TESTDR)


SQL>show parameter LOG_ARCHIVE_DEST_1


NAME TYPE VALUE


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


log_archive_dest_1 string LOCATION=/oracle/archive


SQL> show parameter LOG_ARCHIVE_DEST_2


NAME TYPE VALUE


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


log_archive_dest_2 string SERVICE=TESTDR NOAFFIRM ASYNC


VALID_FOR=(ONLINE_LOGFILES,PRI


MARY_ROLE) DB_UNIQUE_NAME=TEST


DR



SQL> show parameter log_archive_dest_state_2


NAME TYPE VALUE


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


log_archive_dest_state_2 string ENABLE


SQL> show parameter log_archive_forma


NAME TYPE VALUE


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


log_archive_format string %t_%s_%r.arc


SQL> show parameter log_archive_max_processes


NAME TYPE VALUE


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


log_archive_max_processes integer 30


SQL> show parameter remote_login_passwordfile


NAME TYPE VALUE


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


remote_login_passwordfile string EXCLUSIVE


SQL> show parameter fal_server


NAME TYPE VALUE


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


fal_server string TESTDR


SQL> show parameter standby_file_management


NAME TYPE VALUE


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


standby_file_management string AUTO


SQL> show parameter service


NAME TYPE VALUE


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


service_names string TEST



The redo log would better like:


SQL> select member from v$logfile;


MEMBER


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


/oracle/system/redo01.log


/oracle/system/redo02.log


/oracle/system/redo03.log


/oracle/system/standby_redo01.log


/oracle/system/standby_redo02.log


/oracle/system/standby_redo03.log


/oracle/system/standby_redo04.log



(2) listener and TNS


[oracle@linux3 admin]$ cat listener.ora


LISTENER =


(DESCRIPTION_LIST =


(DESCRIPTION =


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


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


)


)



SID_LIST_LISTENER =


(SID_DESC =


(ORACLE_HOME = /oracle/app/product/11.2.0)


(SID_NAME = TEST)


)


)


ADR_BASE_LISTENER = /oracle


[oracle@linux3 admin]$ cat tnsnames.ora


TEST =


(DESCRIPTION =


(ADDRESS_LIST =


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


)


(CONNECT_DATA =


### (SID = TEST)


(SERVICE_NAME = TEST) (UR = A)


)


)


TESTDR =


(DESCRIPTION =


(ADDRESS_LIST =


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


)


(CONNECT_DATA =


### (SID = TEST)


(SERVICE_NAME = TESTDR) (UR = A)


)


)



On Secondary node:


(1) parameter


SQL> show parameter db_name


NAME TYPE VALUE


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


db_name string TEST


SQL> show parameter db_uniq


NAME TYPE VALUE


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


db_unique_name string TESTDR


SQL> show parameter LOG_ARCHIVE_CONFIG


NAME TYPE VALUE


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


log_archive_config string DG_CONFIG=(TEST,TESTDR)


SQL> show parameter LOG_ARCHIVE_DEST_1


NAME TYPE VALUE


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


log_archive_dest_1 string LOCATION=/oracle/archive


SQL> show parameter LOG_ARCHIVE_DEST_2


NAME TYPE VALUE


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


log_archive_dest_2 string SERVICE=TEST NOAFFIRM ASYNC VA


LID_FOR=(ONLINE_LOGFILES,PRIMA


RY_ROLE) DB_UNIQUE_NAME=TEST


SQL> show parameter log_archive_dest_state_2


NAME TYPE VALUE


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


log_archive_dest_state_2 string ENABLE


SQL> show parameter log_archive_format


NAME TYPE VALUE


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


log_archive_format string %t_%s_%r.arc


SQL> show parameter log_archive_max_processes


NAME TYPE VALUE


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


log_archive_max_processes integer 30


SQL> show parameter remote_login_passwordfile


NAME TYPE VALUE


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


remote_login_passwordfile string EXCLUSIVE


SQL> show parameter fal_server


NAME TYPE VALUE


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


fal_server string TEST


SQL> show parameter standby_file_management


NAME TYPE VALUE


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


standby_file_management string AUTO


SQL> show parameter service


NAME TYPE VALUE


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


service_names string TESTDR


The redo log would better like:


SQL> select member from v$logfile;


MEMBER


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


/oracle/system/redo01.log


/oracle/system/redo02.log


/oracle/system/redo03.log


/oracle/system/standby_redo01.log


/oracle/system/standby_redo02.log


/oracle/system/standby_redo03.log


/oracle/system/standby_redo04.log



(2) listener and TNS


[oracle@linux4 admin]$ cat listener.ora


LISTENER =


(DESCRIPTION_LIST =


(DESCRIPTION =


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


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


)


)


SID_LIST_LISTENER =


(SID_DESC =


(ORACLE_HOME = /oracle/app/product/11.2.0)


(SID_NAME = TEST)


(SERVICE_NAME = TESTDR)


)


)


ADR_BASE_LISTENER = /oracle


[oracle@linux4 admin]$ cat tnsnames.ora


TEST =


(DESCRIPTION =


(ADDRESS_LIST =


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


)


(CONNECT_DATA =


(SID = TEST)


(SERVICE_NAME = TEST) (UR = A)


)


)


TESTDR =


(DESCRIPTION =


(ADDRESS_LIST =


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


)


(CONNECT_DATA =


(SID = TEST)


(SERVICE_NAME = TESTDR) (UR = A)


)


)



So , at the end, when both nodes are ready. You execute following command like:



SQL> startup nomount;


ORACLE instance started.


Total System Global Area 3657797632 bytes


Fixed Size 2258600 bytes


Variable Size 805308760 bytes


Database Buffers 2835349504 bytes


Redo Buffers 14880768 bytes


SQL> alter database mount standby database;


SQL> alter database recover managed standby database disconnect from session;


Database altered.


then you just get an normal style DG


SQL> select name,open_mode,database_role from v$database;


NAME OPEN_MODE DATABASE_ROLE


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


TEST MOUNTED PHYSICAL STANDBY



If we want to get active data guard. we should do like :


SQL> startup nomount;


ORACLE instance started.


Total System Global Area 3657797632 bytes


Fixed Size 2258600 bytes


Variable Size 805308760 bytes


Database Buffers 2835349504 bytes


Redo Buffers 14880768 bytes


SQL> alter database mount standby database;


Database altered.


SQL> alter database open read only;


Database altered.


SQL> alter database recover managed standby database disconnect from session;


Database altered.


SQL> select name,open_mode,database_role from v$database;


NAME OPEN_MODE DATABASE_ROLE


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


TEST READ ONLY WITH APPLY PHYSICAL STANDBY



Then , please enjoy yourself

4 views0 comments

Recent Posts

See All

Comments


bottom of page