本文主要是介绍oarcle 19c ADG补丁升级(19.3-19.22),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
一、备库操作
1.关闭备库数据库实例
sqlplus / as sysdba
startup
shutdown immediate
# 查看oracle进程
ps -ef | grep sqlplus
2.关闭监听
lsnrctl start
lsnrctl stop
lsnrctl status
3.升级Opatch
# 备份当前Opatch目录
su - oracle
cd $ORACLE_HOME
mv OPatch OPatch14.bak
4.解压6880880_190000_Linux-x86-64.zip
cd /softls
unzip -d $ORACLE_HOME p6880880_190000_Linux-x86-64.zip
# 解压完查看OPatch版本
cd $ORACLE_HOME/OPatch
./opatch version
5.解压和应用33806152补丁
cd /soft
ls
unzip p35943157_190000_Linux-x86-64.zip
su - root
cd /soft
chown oracle:oinstall p35943157_190000_Linux-x86-64.zip
6.检查补丁是否冲突
cd 35943157
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail
7.应用补丁
$ORACLE_HOME/OPatch/opatch apply
查看是否应用成功
cd $ORACLE_HOME/OPatch
./opatch lspatches
二、主库操作
1.备份oracle文件
cd $ORACLE_HOME
cd ..
ls
tar -cvzf db_home.tar.gz db_1/
2.主库关闭数据库及监听程序
sqlplus / as sysdba
shutdown immediate
exit
ps -ef |grep sqlplus
**##关闭监听**
lsnrctl start
lsnrctl stop
lsnrctl status
3.升级OPatch
##拷贝当前Opatch目录
su - oracle
cd $ORACLE_HOME
mv OPatch OPatch14.bak
# 解压p6880880_190000_Linux-x86-64.zip安装包cd /softls
unzip -d $ORACLE_HOME p6880880_190000_Linux-x86-64.zip# 查看OPatch版本
cd $ORACLE_HOME/OPatch
./opatch version
4.应用补丁
# 解压补丁包
cd /soft
ls
unzip p35943157_190000_Linux-x86-64.zipcd 35943157
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail$ORACLE_HOME/OPatch/opatch apply
cd $ORACLE_HOME/OPatch
./opatch lspatches
5.注册前检查
cd $ORACLE_HOME/OPatchlsnrctl start
sqlplus / as sysdba
startup upgrade[oracle@ora19 OPatch]$ ./datapatch -prereq
6.检查完成注册补丁
./datapatch -verbose
7.编译无效对象
cd $ORACLE_HOME//rdbms/admin$ sqlplus / as sysdbaSQL> @utlrp.sql
8.检查主库补丁注册情况
select VERSION,VERSION_FULL from dba_registry;
9.备库切换主库完成补丁注册
1、主库SQL> select name,open_mode,switchover_status from v$database;NAME OPEN_MODE SWITCHOVER_STATUS
--------- -------------------- --------------------
PROD1 READ WRITE TO STANDBYSQL> alter system switch logfile;System altered.SQL> alter system archive log current;System altered.SQL> alter database commit to switchover to physical standby with session shutdown;Database altered.SQL> shutdown abort
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.Total System Global Area 849530880 bytes
Fixed Size 1348244 bytes
Variable Size 511708524 bytes
Database Buffers 331350016 bytes
Redo Buffers 5124096 bytes
Database mounted.
SQL> select switchover_status from v$database;SWITCHOVER_STATUS
--------------------
RECOVERY NEEDEDSQL> alter database open;Database altered.SQL> select switchover_status from v$database;SWITCHOVER_STATUS
--------------------
TO PRIMARY2、备库
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;Database altered.SQL> alter database commit to switchover to primary;Database altered.SQL> select name,DATABASE_ROLE from v$database;NAME DATABASE_ROLE
--------- ----------------
RUIADG PRIMARYSQL> alter database open;Database altered.SQL> select name,open_mode,switchover_status from v$database;NAME OPEN_MODE SWITCHOVER_STATUS
--------- -------------------- --------------------
PROD1 READ WRITE TO STANDBY3、新备库(原主库)启用实时日志应用SQL> alter database recover managed standby database using current logfile disconnect from session;Database altered.SQL> select name,open_mode,switchover_status from v$database;NAME OPEN_MODE SWITCHOVER_STATUS
--------- -------------------- --------------------
RMANPRI READ ONLY RECOVERY NEEDED4、新主库切换日志SQL> alter system switch logfile;System altered.5、分别查看当前主备库切换后当前日志序列号主库:SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /oracle/archive
Oldest online log sequence 52
Next log sequence to archive 54
Current log sequence 54备库:SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /oracle/archive
Oldest online log sequence 53
Next log sequence to archive 0
Current log sequence 546、查看当前主备库状态主库:SQL> select name,open_mode,switchover_status from v$database;NAME OPEN_MODE SWITCHOVER_STATUS
--------- -------------------- --------------------
RMANPRI READ WRITE TO STANDBY备库:SQL> select name,open_mode,switchover_status from v$database;NAME OPEN_MODE SWITCHOVER_STATUS
--------- -------------------- --------------------
RMANPRI READ ONLY WITH APPLY NOT ALLOWED
三、回退补丁
sqlplus / as sysdba
startup
shutdown immediate
exit# 关闭监听
lsnrctl start
lsnrctl stop
lsnrctl status
# 回退补丁
cd $ORACLE_HOME/OPatch
./opatch lspatches
./opatch rollback -id 35943157
这篇关于oarcle 19c ADG补丁升级(19.3-19.22)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!