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

Duplicate Construction of Oracle 11G DG

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

Share

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

DG build

1. DG's RMAN Duplicate mode

Environment:

IP DB_NAME DB_UNIQUE_NAME ORACLE_SID DB PORT

Main library: 192.168.1.69 hsidb hsidbpr hsidb 1525

Storage: 192.168.1.70 hsidb hsidbsd hsidb 1525

#Active Database Duplicate steps

a. Set parameter values according to PFILE of main library, and generate SPFILE of backup library according to PFILE of main library.

b. generating a password file of the backup library according to the password file of the main library.

c. Start the backup library to nomount state.

d.RMAN connects the main library and backup library at the same time and executes duplicate command.

###Main Library

1.1 Install Oracle Software and static monitor and TNS for master/backup database, build DBCA for master database.

cat /etc/hosts

192.168.1.70 rrfuwu-29.beidou rrfuwu-29

192.168.1.69 rrfuwu-28.beidou rrfuwu-28

1.2 Master Library View Archive Mode

SQL> archive log list;

1.3 Open force_logging

SQL>select NAME,FORCE_LOGGING from v$database;

SQL>shutdown immediate;

SQL>startup mount

SQL>alter database force logging;

SQL>alter database open;

1.4 password file

Check whether the master library exists, password file, if it exists,scp to backup, because the master and backup libraries here ORACLE_SID is the same, so the backup library can be used directly.

Note: The passwords of the master and backup password files must be the same.

[oracle@rrfuwu-28 dbs]$scp -rp orapwhsidb 192.168.1.70:/u01/app/oracle/product/11.2.0/db_1/dbs

1.5 Add standby logfile to main library

standby logfile=(1+logfile groups)*thread=(1+3)*1=4 groups, 4 groups of standby logfile are required.

View main library logfile

Add standby logfile to main library

SQL>alter database add standby logfile 'x' size 300M;

1.6 Master Library Creation pfile

SQL> create pfile from spfile;

Main database inithsidb.ora backup, DB original parameter values can be restored.

vim inithsidb.ora Add the following parameters

Note: The path of the primary and backup database data files is the same as that of the log file. When doing rman duplicate, the parameters db_file_name_convert and log_file_name_convert also need to be set. If the two parameters are not set, it will be reported when doing duplicate.

"ORACLE error from auxiliary database: ORA-19527: physical standby redo log must be renamed

ORA-00312: online log N thread P:'xxxxx';" (N is log group number,P is thread number,xxxxx is log path instead).

*.db_unique_name=hsidbpr

*.log_archive_config='DG_CONFIG=(hsidbpr,hsidbsd)'

*.log_archive_dest_1='LOCATION=/u01/app/oracle/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=hsidbpr'

*.log_archive_dest_2='SERVICE=hsidbsd LGWR SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=hsidbsd'

*.log_archive_dest_state_1=ENABLE

*.log_archive_dest_state_2=ENABLE

*.log_archive_format='%t_%s_%r.arc'

*.FAL_SERVER=hsidbsd

*.FAL_CLIENT=hsidbpr

*.db_file_name_convert='/u01/app/oracle/oradata/hsidb','/u01/app/oracle/oradata/hsidb'

*.log_file_name_convert='/u01/app/oracle/oradata/hsidb','/u01/app/oracle/oradata/hsidb'

*.standby_file_management=AUTO

Close the instance and create an spfile based on the modified pfile.

1.7 Main library scp pfile to backup library

Note: The password of privileged users in the master and backup database password files should be the same.

[oracle@rrfuwu-28 dbs]$ scp -rp inithsidb.ora 192.168.1.70:/u01/app/oracle/product/11.2.0/db_1/dbs

###Backup

2.1 According to the main library pfile dedicated to the backup library, modify the relevant DG parameters.

*.db_unique_name=hsidbsd

*.log_archive_config='DG_CONFIG=(hsidbpr,hsidbsd)'

*.log_archive_dest_1='LOCATION=/u01/app/oracle/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=hsidbsd'

*.log_archive_dest_2='SERVICE=hsidbpr LGWR SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=hsidbpr'

*.log_archive_dest_state_1=ENABLE

*.log_archive_dest_state_2=ENABLE

*.log_archive_format='%t_%s_%r.arc'

*.FAL_SERVER=hsidbpr

*.FAL_CLIENT=hsidbsd

*.db_file_name_convert='/u01/app/oracle/oradata/hsidb','/u01/app/oracle/oradata/hsidb'

*.log_file_name_convert='/u01/app/oracle/oradata/hsidb','/u01/app/oracle/oradata/hsidb'

*.standby_file_management=AUTO

2.2 Create related directories for backup library

According to the directory information in pfile, create related directories in the backup library

[oracle@rrfuwu-29 ~]$ mkdir -p /u01/app/oracle/admin/hsidb/adump

[oracle@rrfuwu-29 ~]$ mkdir -p /u01/app/oracle/oradata/hsidb/

[oracle@rrfuwu-29 ~]$ mkdir -p /u01/app/oracle/arch

2.3 Startup nomount

SQL> startup nomount pfile=?/ dbs/inithsidb.ora;

2.4 RMAN DUPLICATE

[oracle@rrfuwu-29 ~]$ rman target sys/SIGasmlib@HSIDBPR auxiliary sys/SIGasmlib@HSIDBSD

RMAN>duplicate target database for standby from active database nofilenamecheck dorecover;

...... Intermediate process omitted...

2.5 logfile application

SQL>alter database open;

SQL>alter database recover managed standby database using current logfile disconnect from session;

SQL>select NAME,LOG_MODE,OPEN_MODE,PROTECTION_MODE,PROTECTION_LEVEL,FORCE_LOGGING,DATABASE_ROLE,DB_UNIQUE_NAME from v$database;

Backup library starts to open.

DB generates MRP process after performing alter database recover managed standby database using current logfile disconnect from session, and performs logfile recovery. The RFS process accepts the main library log function.

Looking at the main library status so far, protected mode is maximum performance mode, DB role is PRIMARY

SQL>select NAME,LOG_MODE,OPEN_MODE,PROTECTION_MODE,PROTECTION_LEVEL,FORCE_LOGGING,DATABASE_ROLE,DB_UNIQUE_NAME from v$database;

View standby status, protection mode is maximum performance mode, DB role is PHYSICAL STANDBY.

If protection mode is maximum availability mode, then DG mode conversion is required.

2.6 Check whether the master and backup logs are synchronized.

sql>archive log list;

sql>select unique(thread#),max(sequence#) over(partition by thread#) from v$archived_log;

Before switching to archive---main library log sequence

Before switching to archive---backup database log sequence, query the log sequence of primary and backup databases to synchronize before switching to archive.

Manual cut archive test.

After cutting archive----main library log sequence

After cutting archive---backup log sequence

The master/backup logs are synchronized.

2.7 maximum availability mode

SQL>alter database set standby database to maximize availability;

The main library is switched.

View backup library has been switched from maximum performance mode to maximum availability mode.

2.8 Main/standby library switchover test.

SQL>alter database commit to switchover to physical standby;

SQL>shutdown immediate;

SQL>startup

SQL>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE disconnect from session;

The backup library cuts the main library.

SQL>alter database recover managed standby database cancel;

SQL>alter database commit to switchover to primary;

SQL>shutdown immediate;

SQL>startup

SQL>select NAME,LOG_MODE,OPEN_MODE,PROTECTION_MODE,PROTECTION_LEVEL,FORCE_LOGGING,DATABASE_ROLE,DB_UNIQUE_NAME from v$database;

Note:

When doing RMAN DUPLICATE, even if the directory structure of the primary/standby database is the same, the parameters.db_file_name_convert and log_file_name_convert also need to be configured. If not configured, the error "ORACLE error from auxiliary database: ORA-19527: physical standby redo log must be renamed ORA-00312: online log N thread P:'xxxxx';" will be reported when doing rman duplicate finally (N is log group number,P is thread number,xxxxx is log path instead).

After the duplication of the primary/backup library, the backup library TNSNAMES.ORA has an additional LISTENER_HSIDB monitoring information for the primary library. rrfuwu-28 is the HOSTNAME of the primary library, so it can be written as the IP of the primary library here, or the domain name resolution of rrfuwu-28 can be written to the backup library/etc/hosts. If you forget to modify here, the backup library will switch from master to backup library, and an error will be reported during startup. "ORA-00119: invalid specification for system parameter LOCAL_LISTENER "

SQL> startup

ORA-00119: invalid specification for system parameter LOCAL_LISTENER

ORA-00130: invalid listener address '(ADDRESS=(PROTOCOL=TCP)(HOST=rrfuwu-28)(PORT=1525))'

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