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

New Standby RAC library in the same environment

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Requirements: create a new Standby RAC library in the same environment, that is, on the same disk group as Primary RAC.

Note: generally, it is not recommended to configure DG in production environment, because the storage layer is the same disk group, so disaster recovery is of little practical significance. I am here for the separation of reading and writing.

Basic information:

Db_name: jyzhao

Primary RAC db_unique_name:jyzhao

Standby RAC db_unique_name:jyzhaodg

Standby RAC instance_name: jyzhaodg1, jyzhaodg2

Version: GI 11.2.0.4 + DB 11.2.0.4

Chapter 1 preparation 1.1 ASM Storage

Confirm that RAC Standby storage is in the same ASM disk group as RAC Primary (PS: disaster recovery effect is not obvious), and create RAC Standby storage directory (according to db_unique_name)

Mkdir + DATA/JYZHAODGmkdir + FRA/JYZHAODG1.2 configure tnsnames.ora

Cd $ORACLE_HOME/network/admin/

Cat tnsnames.ora

Add connection information for the main repository (all nodes):

JYZHAO = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = oradb-scan) (PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = jyzhao) jyzhaodg = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = oradb-scan) (PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = jyzhaodg)) 1.3 password file

Node 1:

Export ORACLE_SID=jyzhaodg1 password file; cd $ORACLE_HOME/dbsorapwd file=orapwjyzhaodg1 password=oracle entries=5 or the password file before direct copy, and then mv rename: cp orapwjyzhao1 orapwjyzhaodg1

Node 2:

Export ORACLE_SID=jyzhaodg2 password file; cd $ORACLE_HOME/dbsorapwd file=orapwjyzhaodg2 password=oracle entries=5 or the password file before direct copy, and then mv rename: cp orapwjyzhao2 orapwjyzhaodg2

The final test interconnection is available

Sqlplus sys/oracle@jyzhao as sysdbasqlplus sys/oracle@jyzhaodg as sysdba Chapter II Source Database backup

Vi backup.sh

The backup script is as follows:

Rman target / select member from v$logfile MEMBER----+DATA/jyzhaodg/onlinelog/group_2.262.931878637+FRA/jyzhao/onlinelog/group_2.258.931878639+DATA/jyzhaodg/onlinelog/group_1.261.931878635+FRA/jyzhao / onlinelog/group_1.257.931878637+DATA/jyzhaodg/onlinelog/group_3.265.931879021+FRA/jyzhao/onlinelog/group_3.259.931879023+DATA/jyzhaodg/onlinelog/group_4.266.931879027+FRA/jyzhao/onlinelog/group_4.260.9318790298 rows selected.SQL > select name from v$tempfile NAME----+DATA/jyzhaodg/tempfile/temp.263.931878661SQL > select name from v$controlfile NAME----+DATA/jyzhaodg/controlfile/current.288.937645851+FRA/jyzhaodg/controlfile/current.275.937645851

If you find that the log file has a path that does not match the expected path, correct it:

SQL > show parameter convertNAME TYPE VALUE---db_file_name_convert string + DATA/jyzhao + DATA/jyzhaodglog_file_name_convert string + DATA/jyzhao, + DATA/jyzhaodgSQL > alter system set log_file_name_convert='+DATA/jyzhao','+DATA/jyzhaodg','+FRA/jyzhao','+FRA/jyzhaodg' scope=spfile SQL > shutdown immediate;ORA-01109: database not openDatabase dismounted.ORACLE instance shut down.SQL > startup mount;ORACLE instance started.Total System Global Area 313159680 bytesFixed Size 2252824 bytesVariable Size 222302184 bytesDatabase Buffers 83886080 bytesRedo Buffers 4718592 bytesDatabase mounted.SQL > select member from v$logfile MEMBER----+DATA/jyzhaodg/onlinelog/group_2.262.931878637+FRA/jyzhaodg/onlinelog/group_2.258.931878639+DATA/jyzhaodg/onlinelog/group_1.261.931878635+FRA/jyzhaodg / onlinelog/group_1.257.931878637+DATA/jyzhaodg/onlinelog/group_3.265.931879021+FRA/jyzhaodg/onlinelog/group_3.259.931879023+DATA/jyzhaodg/onlinelog/group_4.266.931879027+FRA/jyzhaodg/onlinelog/group_4.260.9318790298 rows selected. Chapter V rman recovery Database

Standby RAC Node 1:

Determine the ORACLE_SID variable:

Echo $ORACLE_SIDexport ORACLE_SID=jyzhaodg1

a. If you are using the method of restoring from a backup set

Vi restore.sh

Rman target / switch database to copy;using target database control file instead of recovery catalogdatafile 1 switched to datafile copy "+ DATA/jyzhaodg/datafile/0eru6m4s.dbf" datafile 2 switched to datafile copy "+ DATA/jyzhaodg/datafile/0fru6m4s.dbf" datafile 3 switched to datafile copy "+ DATA/jyzhaodg/datafile/0hru6meo.dbf" datafile 4 switched to datafile copy "+ DATA/jyzhaodg/datafile/0iru6mg5.dbf" datafile 5 switched to datafile copy "+ DATA/jyzhaodg/datafile/0jru6mg6.dbf" datafile 6 switched to datafile copy "+ DATA/jyzhaodg/datafile/0gru6men.dbf" Chapter 6 prepares the log application

Verify that the log transfer link for Primary RAC is open:

Echo $ORACLE_SIDexport ORACLE_SID=jyzhao1SQL > alter system set log_archive_dest_state_3=enable

Standby RAC Node 1 opens the log application in mount:

Echo $ORACLE_SIDexport ORACLE_SID=jyzhaodg1SQL > alter database recover managed standby database disconnect from session; Chapter 7 create standby log

Stop preparing the library application:

SQL > alter database recover managed standby database cancel

View log information:

SQL > select * from v$Log GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIME NEXT_CHANGE# NEXT_TIME -1 1 69 52428800 512 2 YES CURRENT 2450934 03-MAR-17 2.8147E+14 2 1 0 52428800 512 2 YES UNUSED 2440706 03-MAR-17 2450934 03-MAR-17 3 2 0 52428800 512 2 YES UNUSED 2440817 03-MAR-17 2450939 03-MAR-17 42 36 52428800 512 2 YES CURRENT 2450939 03-MAR-17 2.8147E+14SQL > col member for a70SQL > select group# Type, member from v$logfile GROUP# TYPE MEMBER- 2 ONLINE + DATA/jyzhaodg/onlinelog/group_2.298.937648563 2 ONLINE + FRA/jyzhaodg/onlinelog/group_2.278.937648565 1 ONLINE + DATA/jyzhaodg/onlinelog/group_1.297.937648559 1 ONLINE + FRA/jyzhaodg/onlinelog/group_1.279.937648561 3 ONLINE + DATA/jyzhaodg/onlinelog/group_3.299.937648567 3 ONLINE + FRA/jyzhaodg/onlinelog/group_3.389.937648569 4 ONLINE + DATA/jyzhaodg/onlinelog/group_4.300.937648573 4 ONLINE + FRA/jyzhaodg/onlinelog/group_4.390.9376485738 rows selected.

According to the results of the check, add standby logfile to the database reasonably:

Alter database add standby logfile thread 1 group 11 ('+ DATA','+FRA') size 52428800 alter database add standby logfile thread 1 group 12 ('+ DATA','+FRA') size 52428800 alter database add standby logfile thread 1 group 13 ('+ DATA','+FRA') size 52428800 alter database add standby logfile thread 2 group 21 ('+ DATA','+FRA') size 52428800 alter database add standby logfile thread 2 group 22 ('+ DATA','+FRA') size 52428800 alter database add standby logfile thread 2 group 23 ('+ DATA','+FRA') size 52428800

After adding it, view it again:

SQL > select group#, type, member from v$logfile GROUP# TYPE MEMBER- 2 ONLINE + DATA/jyzhaodg/onlinelog/group_2.298.937648563 2 ONLINE + FRA/jyzhaodg/onlinelog/group_2.278.937648565 1 ONLINE + DATA/jyzhaodg/onlinelog/group_1.297.937648559 1 ONLINE + FRA/jyzhaodg/onlinelog/group_1.279.937648561 3 ONLINE + DATA/jyzhaodg/onlinelog/group_3.299.937648567 3 ONLINE + FRA/jyzhaodg/onlinelog/group_3.389.937648569 4 ONLINE + DATA/jyzhaodg/onlinelog/group_4.300.937648573 4 ONLINE + FRA/jyzhaodg/onlinelog / group_4.390.937648573 11 STANDBY + DATA/jyzhaodg/onlinelog/group_11.301.937648773 11 STANDBY + FRA/jyzhaodg/onlinelog/group_11.391.937648775 12 STANDBY + DATA/jyzhaodg/onlinelog/group_12.302.937648777 GROUP# TYPE MEMBER 12 STANDBY + FRA/jyzhaodg/onlinelog/group_12.392.937648779 13 STANDBY + DATA/jyzhaodg/onlinelog/group_13.303.937648779 13 STANDBY + FRA/jyzhaodg/onlinelog/group_13.393.937648781 21 STANDBY + DATA/jyzhaodg/onlinelog/group_21.304.937648783 21 STANDBY + FRA/jyzhaodg/onlinelog / group_21.394.937648783 22 STANDBY + DATA/jyzhaodg/onlinelog/group_22.305.937648785 22 STANDBY + FRA/jyzhaodg/onlinelog/group_22.395.937648787 23 STANDBY + DATA/jyzhaodg/onlinelog/group_23.306.937648787 23 STANDBY + FRA/jyzhaodg/onlinelog/group_23.396.93764878920 rows selected.

Continue to open the database application, make sure that the log is restored and no error message is reported, cancel the log application, open the database, and open ADG:

Alter database recover managed standby database disconnect from session;alter database recover managed standby database cancel; alter database open;alter database recover managed standby database using current logfile disconnect from session

View DG synchronization status:

SQL > SELECT OPEN_MODE, DATABASE_ROLE, SWITCHOVER_STATUS, FORCE_LOGGING, DATAGUARD_BROKER, GUARD_STATUS FROM V$DATABASE OPEN_MODE DATABASE_ROLE SWITCHOVER_STATUS FOR DATAGUAR GUARD_S--READ ONLY WITH APPLY PHYSICAL STANDBY NOT ALLOWED NO DISABLED NONESQL > set lines 1000SQL > select * from v$dataguard_stats NAME VALUE UNIT TIME_COMPUTED DATUM_TIME -transport lag + 00 00:09:37 day (2) to second (0) interval 03max 03max 2017 10:03:20 03max 03max 03max 2017 10:03:13apply lag + 00:09:38 Day (2) to second (0) interval 03max 03max 10:03:20 03max 2017 10:03:13apply finish time day (2) to second (3) interval 03max 03max 2017 10:03:20estimated startup time 40 second 03Accord 03According to 2017 10VOV 03VOUR-you can archive the current log on Primary RAC to simulate business switching. Archive: SQL > SELECT OPEN_MODE DATABASE_ROLE, SWITCHOVER_STATUS, FORCE_LOGGING, DATAGUARD_BROKER, GUARD_STATUS FROM V$DATABASE OPEN_MODE DATABASE_ROLE SWITCHOVER_STATUS FOR DATAGUAR GUARD_S--READ WRITE PRIMARY TO STANDBY NO DISABLED NONESQL > alter system archive log current System altered.-- again checks the DG synchronization status on Standby RAC: SQL > r 1* select * from v$dataguard_statsNAME VALUE UNIT TIME_COMPUTED DATUM_TIME- -transport lag + 00 00:00:00 day (2) to second (0) interval 03Unip 03Universe 10:04:45 03Accord 03Compact 2017 10:04:44apply lag + 00 00:00:00 day (2) to second (0) interval 03Universe 03 10:04:45 03gamble 2017 10:04:44apply finish time Day (2) to second (3) interval 03 *

So far, the creation of the RAC Standby library in the same environment has been completed.

Chapter VIII check the status of resources

We can also add RAC Standby to the crs resource:

[oracle@oradb23 ~] $srvctl add database-d jyzhaodg-o $ORACLE_HOME-I jyzhaodg1-n jyzhao [oracle@oradb23 ~] $srvctl add instance-d jyzhaodg-I jyzhaodg1-n oradb23 [oracle@oradb23 ~] $srvctl add instance-d jyzhaodg-I jyzhaodg2-n oradb24-- launch database [oracle@oradb23 ~] $srvctl start database-d salehrdg-- View Resource status: [grid@oradb23 ~] $crsctl stat res-t

Summary: the most important thing to pay attention to when building a Standby RAC in the same environment is to be careful. Make sure you are operating the correct ORACLE_SID before operation, and the path to the preparation database should be confirmed repeatedly before operation.

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