Oracle 19cADG集群补丁升级
文章目录
- Oracle 19cADG集群补丁升级
- 1.备库备份
- 2.备库升级Opatch
- 3.备库应用补丁
- 4.主库备份 oracle_home目录
- 5.主库升级Opatch
- 6.注册补丁
- 7.编译无效对象
- 8.检查主库的补丁注册情况
- 9.备库切换主库完成补丁注册
1.备库备份
su - oracle
cd $ORACLE_HOME
cd ..
tar -cvzf db_home.tar.gz db_1/
ls
2.备库升级Opatch
备库关闭数据库、监听
#关闭数据库
sqlplus / as sysdba
startup
shutdown immediate
exit
[oracle@ora_standby19c ~]$ ps -ef | grep sqlplus
oracle 12623 11932 0 17:46 pts/2 00:00:00 grep --color=auto sqlplus
#关闭监听
lsnrctl start
lsnrctl stop
lsnrctl status
#拷贝Opatch目录到OPatch14.bak
su - oracle
cd $ORACLE_HOME
cp -r OPatch OPatch14.bak
#解压p6880880_190000_Linux-x86-64.zip
cd /soft
ls
unzip -d $ORACLE_HOME p6880880_190000_Linux-x86-64.zip
#查看Opatch版本
cd $ORACLE_HOME/OPatch
./opatch version
3.备库应用补丁
#解压补丁
cd /soft
ls
unzip p35943157_190000_Linux-x86-64.zip
cd 35943157
ls
#检查补丁是否冲突
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail
#应用补丁
$ORACLE_HOME/OPatch/opatch apply
4.主库备份 oracle_home目录
#上传补丁包到/soft目录
su - root
chmod -R 755 /soft
chown oracle:oinstall /soft
cd /soft
ls
#备份db_1目录
su - oracle
cd $ORACLE_HOME
cd ..
ls
tar -cvzf db_home.tar.gz db_1/
5.主库升级Opatch
主库关闭数据库及监听程序
#关闭数据库
sqlplus / as sysdba
shutdown immediate
exit
ps -ef |grep sqlplus
#关闭监听
lsnrctl start
lsnrctl stop
lsnrctl status
#拷贝Opatch目录
su - oracle
cd $ORACLE_HOME
cp -r OPatch OPatch14.bak
#进入/soft目录解压Opatch
cd /soft
ls
unzip p35943157_190000_Linux-x86-64.zip
cd 35943157
$ORACLE_HOME/OPatch/opatch prereq -help
#检查补丁冲突
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail
#应用补丁
$ORACLE_HOME/OPatch/opatch apply
一直y就好
#检查补丁应用情况
[oracle@ora_primary19c 35943157]$ $ORACLE_HOME/OPatch/opatch lsinv
6.注册补丁
#注册前检查环境
lsnrctl start
sqlplus / as sysdba
startup upgrade
[oracle@ora_primary19c OPatch]$ ./datapatch -prereq
#注册补丁
[oracle@ora_primary19c OPatch]$ ./datapatch -verbose
7.编译无效对象
cd $ORACLE_HOME//rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> @utlrp.sql
8.检查主库的补丁注册情况
SQL> select VERSION,VERSION_FULL from dba_registry;
9.备库切换主库完成补丁注册
#主库
SQL> select name,open_mode,switchover_status from v$database;
NAME OPEN_MODE SWITCHOVER_STATUS
--------- -------------------- --------------------
ORACLE READ WRITE TO STANDBY
SQL> 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 1258288760 bytes
Fixed Size 8939128 bytes
Variable Size 318767104 bytes
Database Buffers 922746880 bytes
Redo Buffers 7835648 bytes
Database mounted.
SQL> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
RECOVERY NEEDED
SQL> alter database open;
Database altered.
SQL> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
TO PRIMARY
#备库
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
Database altered.
SQL> alter database commit to switchover to primary;
从这里开始报错