Get the App
SLTechnology News&Howtos  ›  Database  › 

Build dataguard by oracle 11gR2

Shulou Source: shulou.com Published: 2022-06-01 14:31:45 10月06日 Update

1. Build the environment

Main library oracle11gR2 standby library oracle11gR2

Db_name orcl orcl

Db_unique_name orcl standby239

Configure the host file

Main library: primaryHost standby library: standbyHost

The preparation libraries are all placed in archive mode.

2. Configure static monitoring

Both main and standby libraries are configured.

Listener.ora

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(SID_NAME = CLRExtProc)

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

(PROGRAM = extproc)

)

(SID_DESC =

(GLOBAL_DBNAME = orcl)

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

(SID_NAME = orcl)

)

)

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(SID_NAME = CLRExtProc)

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

(PROGRAM = extproc)

)

(SID_DESC =

(GLOBAL_DBNAME = standby239)

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

(SID_NAME = orcl)

)

)

Configure tnsnames.ora

Master and standby library configuration

Standby239 =

(DESCRIPTION =

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

(CONNECT_DATA =

(UR = A)

(SERVER = DEDICATED)

(SERVICE_NAME = standby239)

)

)

ORCL =

(DESCRIPTION =

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

(CONNECT_DATA =

(UR = A)

(SERVER = DEDICATED)

(SERVICE_NAME = orcl)

)

)

3. The main and standby libraries generate password files.

Use orapwd

Orapwd file=$ORACLE_HOME/dbs/orapworcl password=xxxxx ignorecase=Y

4. Generate standbylog

Alter database add standby logfile ('/ data/oracle/flash_recovery_area/orcl/standby/standby07.log') size 50m

Alter database add standby logfile ('/ data/oracle/flash_recovery_area/orcl/standby/standby05.log') size 50m

Alter database add standby logfile ('/ data/oracle/flash_recovery_area/orcl/standby/standby04.log') size 50m

Alter database add standby logfile ('/ data/oracle/flash_recovery_area/orcl/standby/standby06.log') size 50m

5. Modify dg parameters

Main library

Alter system set db_unique_name=orcl scope=spfile

Alter system set log_archive_config='dg_config= (orcl,standby239) 'scope=both

Alter system set log_archive_dest_1='location=/data/oracle/flash_recovery_area/ORCL valid_for= (all_logfiles,all_roles) db_unique_name=orcl' scope=both

Alter system set log_archive_dest_2='service=standby239 async lgwr valid_for= (online_logfiles,primary_role) db_unique_name=standby239' scope=both

Alter system set log_archive_dest_state_1=enable scope=both

Alter system set log_archive_dest_state_2=enable scope=both

Alter system set fal_server=standby239 scope=both

Alter system set fal_client=orcl scope=both

Alter system set standby_file_management=AUTO

Prepare the library

Alter system set db_unique_name=standby239 scope=spfile

Alter system set log_archive_config='dg_config= (orcl,standby239) 'scope=both

Alter system set log_archive_dest_1='location=/data/oracle/flash_recovery_area/ORCL valid_for= (all_logfiles,all_roles) db_unique_name=standby239' scope=both

Alter system set log_archive_dest_2='service=orcl async lgwr valid_for= (online_logfiles,primary_role) db_unique_name=orcl' scope=both

Alter system set log_archive_dest_state_1=enable scope=both

Alter system set log_archive_dest_state_2=enable scope=both

Alter system set fal_server=orcl scope=both

Alter system set fal_client=standby239 scope=both

Alter system set standby_file_management=AUTO

6. Use rman duplicate master library to standby library

Put the standby library in an unloaded state

Rman target sys/xxxx auxiliary sys/xxxx@standby239

Duplicate target database for standby nofilenamecheck from active database

Use set newname for if renaming is needed

7. Put the repository in active dataguard mode

Alter database mount standby database

Alter database open read only

Alter database recover managed standby database disconnect from session

Or alter database recover managed standby database using current logfile disconnect from session; (real-time application log mode)

In this way, you can experiment with the state of the main and standby libraries.

Tags: Configuration mode file status generation parameters real-time password log environment static preparation experiment application monitoring loading Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Shulou Technology macOS Microsoft Shulou Tech Info