本文主要是介绍oracle 19c 主备 补丁升级19.22,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
-
补丁升级流程
-
备库升级
备库备份$ORALCE_HOME
-
du -sh $ORACLE_HOME |
· 备份目录将dbhome_1压缩
cd $ORACLE_HOME cd .. Ls tar -cvzf db_home.tar.gz db_home_1 /opt/oracle/product/19c |
-
-
- 关闭监听关闭数据库查看sqlplus进程
-
lsnrctl stop
lsnrctl status
sqlplus / as sysdba
startup
shutdown immediate
exit
ps -ef | grep sqlplus
-
su - oracle cd /u01/app mkdir -p /u01/app/backup tar -pcvf /u01/app/backup/oracle_backup.tar /u01/app/oracle/ |
- 替换高版本opatch
- 拷贝当前Opatch目录
su - oracle cd $ORACLE_HOME cp OPatch -r OPatch1 cd /soft unzip -d $ORACLE_HOME p6880880_190000_Linux-x86-64.zip A cd $ORALCE_HOME/OPatch ./opatch version |
刚开始的:
替换之后的:
-
- 应用补丁
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_HOME/OPatch/opatch lsinv |
-
-
主库升级
- 目录准备
-
su - root chmod -R 755 /soft chown oracle:oinstall /soft cd /soft ls |
-
-
- 备份oraclehome目录
-
su - oracle cd $ORALCE_HOEM cd .. ls tar -cvzf dbhome_1.tar.gz dbhome_1 |
-
-
- 关闭监听、数据库
-
lsnrctl start lsnrctl stop sqlplus / as sysdba startup shutdown immediate exit ps -ef | grep sqlplus |
-
-
- 升级Opatch
-
cd $ORACLE_HOME cp -R OPatch OPatch1 cd /soft unzip -d $ORACLE_HOME p6880880_190000_Linux-x86-64.zip |
-
-
- 查看OPatch版本
-
cd $ORACLE_HOME cd OPatch ./opatch version |
-
-
- 解压补丁包
-
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_HOME/OPatch/opatch lsinv |
-
-
- 主库注册前检测
-
cd $ORACLE_HOME/OPatch lsnrctl start sqlplus / as sysdba startup upgrade 最后使用 startup upgrade 命令启动数据库并在升级模式下运行。这将启动数据库实例并将其升级到新版本,但不会打开数据库以供用户连接。 ! ./datapatch -prereq |
-
-
- 检查完成 注册补丁
-
./datapatch -verbose |
-
-
- 编译无效对象
-
cd $ORACLE_HOME//rdbms/admin sqlplus / as sysdba SQL> @utlrp.sql |
-
-
- 查看主库的补丁注册情况
-
select VERSION,VERSION_FULL from dba_registry; |
完成
-
主备库切换,完成补丁注册
- 主库操作p19cadg1
SQL>select name,open_mode,switchover_status from v$database; SQL>alter system switch logfile; SQL>alter system archive log current; SQL>alter database commit to switchover to physical standby with session shutdown; SQL>shutdown abort SQL>startup mount SQL>select switchover_status from v$database; SQL>alter database open; SQL>select switchover_status from v$database; |
-
- 备库操作mount状态p19cadg2
在主库启动时,备库在mount状态 sqlplus / as sysdba SQL>startup mount SQL>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION; SQL> alter database commit to switchover to primary; SQL> select name,DATABASE_ROLE from v$database; SQL> alter database open; SQL> select name,open_mode,switchover_status from v$database; |
-
- 查看当前主备库状态
主库: SQL> select name,open_mode,switchover_status from v$database; |
备库: SQL> select name,open_mode,switchover_status from v$database; |
-
- 检查新主库(原备库)补丁注册
SQL> select VERSION,VERSION_FULL from dba_registry; |
-
补丁回退流程
- 关闭数据库和监听
- 现备库(原主库p19cadg1)
- 关闭数据库和监听
关闭监听 lsnrctl stop lsnrctl start 关闭数据库 shu immediate exit ps -ef | grep sqlplus |
-
-
- 现主库(原备库p19cadg2)
-
关闭监听 lsnrctl stop lsnrctl start 关闭数据库 shu immediate exit ps -ef | grep sqlplus |
-
-
- 查看进程(主备)
-
ps -ef | grep sqlplus 只能有一个 |
-
- 现备库p19cadg1
su - oracle cd $ORACLE_HOME/OPatch ./opatch rollback -id 35943157 |
-
- 编译无效对象
cd $ORACLE_HOME//rdbms/admin $ sqlplus /nolog SQL> CONNECT / AS SYSDBA Connected. SQL> @utlrp.sql 主库补丁回退 cd $ORACLE_HOME/OPatch ./opatch lspatches ./opatch rollback -id 35943157 |
-
-
主库回退注册补丁p19cadg2
- 注册前检查
-
cd $ORACLE_HOME/OPatch lsnrctl start sqlplus / as sysdba startup upgrade ! ./datapatch -prereq |
-
-
- 主库注册补丁p19cadg2
-
./datapatch -verbose |
-
-
- 主库切换备库p19cadg2(主->备)
-
主p19cadg2 open状态 备p19cadg2 mount状态 |
SQL> select name,open_mode,switchover_status from v$database; SQL> alter system switch logfile; SQL> alter system archive log current; SQL> alter database commit to switchover to physical standby with session shutdown; SQL> shutdown abort SQL> startup mount SQL> select switchover_status from v$database; SQL> alter database open; SQL> select switchover_status from v$database; |
-
- 备库切换主库p19cadg1(备->主)
SQL>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION; SQL> alter database commit to switchover to primary; SQL> select name,DATABASE_ROLE from v$database; SQL> alter database open; SQL> select name,open_mode,switchover_status from v$database; |
-
-
- 备库启用实时日历p19cadg2
-
SQL> alter database recover managed standby database using current logfile disconnect from session; SQL> select name,open_mode,switchover_status from v$database; |
-
-
- 新主库切换日志
-
SQL> alter system switch logfile; |
SQL> archive log list |
主
备
-
- 查看数据库状态
select name,open_mode,switchover_status from v$database; |
主
备
-
-
- 检查补丁注册情况
-
select VERSION,VERSION_FULL from dba_registry; |
主
备
完成
这篇关于oracle 19c 主备 补丁升级19.22的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!