Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Build dataguard by oracle 11gR2

2025-02-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report