• notice
  • Congratulations on the launch of the Sought Tech site

How to upgrade Oracle DataGuard disaster recovery? Enough to read this

Preface

With the widespread application of Oracle, this member of DataGuard has basically become the standard configuration of the database disaster recovery environment. When you need to upgrade the Oracle database, you also need to consider upgrading the DataGuard database version at the same time.How to upgrade quickly and safely?


Upgrade process

Recommended plan:

Upgrade to NON-CDB mode:

1.Turn off ADG synchronization first, upgrade the main database to 19C, open the standby database in mount mode at 19C, and turn on ADG synchronization.

Upgrade to CDB mode:

1.First upgrade the main database to 19C cdb+pdb mode, and rebuild ADG for the standby database.

2.First set up a 19C CDB main and backup ADG environment, first turn off ADG synchronization, then upgrade the main library and insert it into the main library CDB, and turn on ADG synchronization.

The following mainly introduces the CDB mode scheme 1:

1.Environmental preparation

Ignore the environment installation process, you can refer to:

10 minutes! One-click deployment of Oracle 11GR2 stand-alone

30 minutes! One-click deployment of Oracle 19C stand-alone CDB+PDB

For script usage and download, please refer to Github : https://github.com/pc-study/InstallOracleshell

For setting up ADG, please refer to:

ADG single instance build series (Active Database Duplicate Using Image Copies)

ADG single instance series construction (RMAN backup and recovery)

ADG Single Instance Construction Series (DBCA)

ADG build series of 11G RAC to Single DATABASE

This test tries to simulate as far as possible in accordance with the production environment upgrade:

nodeHost versionCPU nameInstance nameOracle versionIP address
Main libraryredhat 7.9orclorcl+cdb19c11.2.0.4 + 19.3.0 (patch 29585399)10.211.55.100
Backup databaseredhat 7.9orcl_stbyDo not create an instance19.3.0 (Patch 29585399)10.211.55.101

Note: It is best to copy the source database to a new machine for upgrade in cold backup, and reserve the source database for rollback.

According to the MOS document 2485457.1, you can get the download address of the latest version of the AutoUpgrade tool :

The most recent version of AutoUpgrade can be downloaded via this link: version 20210421.

Two, upgrade the main library

1.Use the autoUpgrade tool to upgrade the main library

Reference article: It 's 2021, are you worried about the troublesome Oracle upgrade steps? Learn this article, upgrade like drinking water

The config file is as follows:

cat<<EOF >/soft/conifg.cfg
# Global configurations
global.autoupg_log_dir=/soft/uplogs
global.raise_compatible=yes
global.drop_grp_after_upgrade=yes

# Database number 3 - Noncdb to PDB upgrade
upg3.log_dir=/soft/logs
upg3.sid=orcl
upg3.source_home=/u01/app/oracle/product/11.2.0/db
upg3.target_cdb=cdb19c
upg3.target_home=/u01/app/oracle/product/19.3.0/db
upg3.target_pdb_name=orcl
upg3.target_pdb_copy_option=file_name_convert=('/oradata/orcl/', '/oradata/CDB19C/orcl/')
upg3.start_time=NOW                  # Optional. 10 Minutes from now
upg3.upgrade_node=orcl           # Optional. To find out the name of your node, run the hostname utility. Default is 'localhost'
upg3.run_utlrp=yes              # Optional. Whether or not to run utlrp after upgrade
upg3.timezone_upg=yes           # Optional. Whether or not to run the timezone upgrade
upg3.target_version=19  # Oracle version of the target ORACLE_HOME.  Only required when the target Oracle database version is 12.2
upg3.remove_underscore_parameters=yes
upg3.source_tns_admin_dir=/u01/app/oracle/product/11.2.0/db/network/admin
upg3.target_tns_admin_dir=/u01/app/oracle/product/19.3.0/db/network/admin
EOF

Start to upgradeConvert non-cdb to pdb
update completed
At this point, the main library has been upgraded.


Check the upgrade status:

Set pdb to start with cdb:
alter pluggable database all save state;
Insert picture description here

Three, build ADG

1.Build ADG with active and standby CDB

Backup database execution:

dbca -silent -createDuplicateDB \
-gdbName cdb19c \
-sid cdb19c \
-sysPassword oracle \
-primaryDBConnectionString 10.211.55.100:1521/cdb19c \
-nodelist orcl_stby \
-databaseConfigType SINGLE \
-createAsStandby -dbUniqueName cdb19c_stby \
-datafileDestination '/oradata'

DBCA creates a standby database instancepdb

--主库设置DG参数
ALTER SYSTEM SET LOG_ARCHIVE_CONFIG='DG_CONFIG=(CDB19C,CDB19C_STBY)';
ALTER SYSTEM SET LOG_ARCHIVE_DEST_1='LOCATION=/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=CDB19C';
ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=CDB19C_stby ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=CDB19C_STBY';
ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE;
ALTER SYSTEM SET LOG_ARCHIVE_FORMAT='%t_%s_%r.arc' SCOPE=SPFILE;
ALTER SYSTEM SET LOG_ARCHIVE_MAX_PROCESSES=4;
ALTER SYSTEM SET REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE SCOPE=SPFILE;
ALTER SYSTEM SET FAL_SERVER=CDB19C_STBY;
ALTER SYSTEM SET FAL_CLIENT=CDB19C;
ALTER SYSTEM SET DB_FILE_NAME_CONVERT='/oradata/CDB19C','/oradata/CDB19C_STBY' SCOPE=SPFILE;
ALTER SYSTEM SET LOG_FILE_NAME_CONVERT='/oradata/CDB19C','/oradata/CDB19C_STBY'  SCOPE=SPFILE;
ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO;

--备库设置DG参数
ALTER SYSTEM SET LOG_ARCHIVE_CONFIG='DG_CONFIG=(CDB19C_STBY,CDB19C)';
ALTER SYSTEM SET LOG_ARCHIVE_DEST_1='LOCATION=/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=CDB19C_STBY';
ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=CDB19C ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=CDB19C';
ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE;
ALTER SYSTEM SET LOG_ARCHIVE_FORMAT='%t_%s_%r.arc' SCOPE=SPFILE;
ALTER SYSTEM SET LOG_ARCHIVE_MAX_PROCESSES=4;
ALTER SYSTEM SET REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE SCOPE=SPFILE;
ALTER SYSTEM SET FAL_SERVER=CDB19C;
ALTER SYSTEM SET FAL_CLIENT=CDB19C_STBY;
ALTER SYSTEM SET DB_FILE_NAME_CONVERT='/oradata/CDB19C_STBY','/oradata/CDB19C' SCOPE=SPFILE;
ALTER SYSTEM SET LOG_FILE_NAME_CONVERT='/oradata/CDB19C_STBY','/oradata/CDB19C'  SCOPE=SPFILE;
ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO;

Configure ADG parameters
2, CDB active and standby start synchronization

##备库执行
alter database recover managed standby database using current logfile disconnect from session;

##主库执行
alter system set log_archive_dest_state_2=enable;

Synchronization check

Fourth, the upgrade is completed and the test is completed

The main library creates test data:

alter session set container=orcl;
Create a connected user
sqlplus lucifer/[email protected]
Create test data
Check whether the standby database is synchronized: the
Insert picture description here
upgrade is over, and the ADG synchronization is normal and perfect.


Tags

Technical otaku

Sought technology together

Related Topic

0 Comments

Leave a Reply

+