search
HomeDatabaseMysql Tutorial【RAC】11gR2 rac 上滚动安装/回退补丁

在RAC环境上安装小补丁时,可以使用滚动安装的方式(Rolling)以提供无间断的业务应用!在安装补丁的时候,先停止一个数据库实例,

在RAC环境上安装小补丁时,可以使用滚动安装的方式(Rolling)以提供无间断的业务应用!在安装补丁的时候,先停止一个数据库实例,,在此节点安装补丁,然后启动这个实例,再停止另一个实例并安装这个补丁,这样能够保证一直有可用的数据库实例,业务能够无间断提供服务!
   使用滚动安装的前提是这个补丁是可以Rolling安装的,对于如何判断一个补丁是Rolling的,下面的文章中会提到。
一般来说,大体的Rolling安装的方式如下:
1. 下载补丁。
2. 打补丁之前,最好做一下数据库的备份。
3. 检查这次安装的补丁是否和以往的补丁冲突。
4. 如果有测试库,最好先在测试库测试一下这个补丁。
5. 务必仔细阅读补丁的Readme并按照其中的步骤来打补丁:
   1). 用Oracle用户将这个补丁上传到服务器上的一个目录.
   2). 解压这个文件:
   3). 停止节点1这个ORACLE_HOME下所有的数据库实例+ASM实例(如果有,11g rac 可以不用,10g需要);
   4). 在节点1打补丁:
        $cd $ORACLE_HOME/OPatch/9711859 (目录可以根据实际情况更改)
        $opatch apply
    5). 然后opatch会问您是否要打下一个节点2,这时候执行下面的操作:
    6). 启动节点1 的ORACLE_HOME下所有的数据库实例+ASM实例(如果有);
    7). 停止节点2这个ORACLE_HOME下所有的数据库实例+ASM实例(如果有);
    8). 在之前打补丁的那个提示符中,确认继续打下一个节点;
    9). 启动节点2 这个ORACLE_HOME下所有的数据库实例+ASM实例(如果有);
   10).如果有多个节点,依次执行。
一 下载 opatch 和补丁~!
a)检查 opatch 的版本
oracle@rac1:/home/oracle/software>opatch version  
Invoking OPatch 11.1.0.6.6
OPatch Version: 11.1.0.6.6
OPatch succeeded.
b)下载最新的版本
我的是以p9711859_112010_Linux-x86-64.zip 为例!
备份 老的opatch ,解压新的optach
oracle@rac1:/home/oracle/software>cd $ORACLE_HOME
oracle@rac1:/opt/rac/oracle/11.2.0/rac> tar zcvf OPatch_`date +%Y%m%d`.tar.gz OPatch
OPatch/
oracle@rac1:/home/oracle/software>unzip p6880880_112000_Linux-x86-64.zip -d $ORACLE_HOME
Archive:  p6880880_112000_Linux-x86-64.zip
replace /opt/rac/oracle/11.2.0/rac/OPatch/docs/Users_Guide.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: A
..........
 inflating: /opt/rac/oracle/11.2.0/rac/OPatch/crs/s_crsconfig_lib.pm
查看opatch 的版本!
oracle@rac1:/home/oracle/software>opatch version
OPatch Version: 11.2.0.3.0
OPatch succeeded.
oracle@rac1:/home/oracle/software>
c)下载要安装的补丁并且检查是否满足rolling apply
oracle@rac1:/home/oracle>opatch query -all /home/oracle/software/9711859 | grep rolling
Patch is a rolling patch: true
二 停止节点1 rac1 的监听
oracle@rac1:/home/oracle>srvctl stop listener -l LISTENER -n rac1
oracle@rac1:/home/oracle>
oracle@rac1:/home/oracle>srvctl status listener -l LISTENER
监听程序 LISTENER 已启用
监听程序 LISTENER 正在节点上运行: rac2
停止节点1 上的数据库实例 (对于10版本还要停止asm 实例)
oracle@rac1:/home/oracle>srvctl status instance -d rac -i rac1
实例 rac1 正在节点 rac1 上运行
oracle@rac1:/home/oracle>srvctl stop instance -d rac -i rac1
三 开始rolling方式应用补丁:
oracle@rac1:/home/oracle/software/9711859>opatch apply
Oracle 中间补丁程序安装程序版本 11.2.0.3.0
版权所有 (c) 2012, Oracle Corporation。保留所有权利。
Oracle Home       : /opt/rac/oracle/11.2.0/rac
Central Inventory : /opt/rac/oraInventory
   from           : /opt/rac/oracle/11.2.0/rac/oraInst.loc
OPatch version    : 11.2.0.3.0
OUI version       : 11.2.0.1.0
Log file location : /opt/rac/oracle/11.2.0/rac/cfgtoollogs/opatch/9711859_Jun_25_2012_16_16_42/apply2012-06-25_16-16-42下午_1.log
Applying interim patch '9711859' to OH '/opt/rac/oracle/11.2.0/rac'
Verifying environment and performing prerequisite checks...
All checks passed.
提供电子邮件地址以用于接收有关安全问题的通知, 安装 Oracle Configuration Manager 并启动它。如果您使用 My Oracle
Support 电子邮件地址/用户名, 操作将更简单。
有关详细信息, 请访问 。
电子邮件地址/用户名: qilong.yangql@gmail.com
请提供 My Oracle Support 口令以通过 My Oracle Support 帐户接收安全更新。
口令口令 (可选):     
此节点是 Oracle Real Application Cluster 的一部分。
远程节点: 'rac2'
本地节点: 'rac1'
请关闭本地系统上在此 ORACLE_HOME 之外运行的 Oracle 实例。
(Oracle 主目录 = '/opt/rac/oracle/11.2.0/rac')

本地系统是否已准备打补丁? [y|n]y
User Responded with: Y
Backing up files...
正在为组件 oracle.rdbms, 11.2.0.1.0 打补丁...
Verifying the update...
本地系统已打补丁。您可以在本地系统上重新启动 Oracle 实例。
在滚动模式下打补丁。
接下来将为节点 'rac2' 打补丁。
请关闭 'rac2' 上在此 ORACLE_HOME 之外运行的 Oracle 实例。
(Oracle 主目录 = '/opt/rac/oracle/11.2.0/rac')

//在询问你是否在另外一个节点安装补丁的时候
四 在节点rac1上启动数据库和监听操作
oracle@rac1:/home/oracle/software/9711859>srvctl start instance  -d rac -i rac1 -o open             
oracle@rac1:/home/oracle/software/9711859>srvctl status instance  -d rac -i rac1           
实例 rac1 正在节点 rac1 上运行
oracle@rac1:/home/oracle/software/9711859>srvctl start listener -l LISTENER -n rac1
PRCC-1015 : LISTENER 已在 rac1 上运行五 关闭节点rac2 的监听和数据库实例操作
oracle@rac1:/home/oracle/software/9711859>srvctl stop listener -l LISTENER -n rac2
oracle@rac1:/home/oracle/software/9711859>srvctl stop instance  -d rac -i rac2
该节点是否已准备打补丁? [y|n]  y
User Responded with: Y
Updating nodes 'rac2'
   Apply-related files are:
     FP = "/opt/rac/oracle/11.2.0/rac/.patch_storage/9711859_Jun_9_2010_10_13_45/rac/copy_files.txt"
     DP = "/opt/rac/oracle/11.2.0/rac/.patch_storage/9711859_Jun_9_2010_10_13_45/rac/copy_dirs.txt"
     MP = "/opt/rac/oracle/11.2.0/rac/.patch_storage/9711859_Jun_9_2010_10_13_45/rac/make_cmds.txt"
     RC = "/opt/rac/oracle/11.2.0/rac/.patch_storage/9711859_Jun_9_2010_10_13_45/rac/remote_cmds.txt"

Instantiating the file "/opt/rac/oracle/11.2.0/rac/.patch_storage/9711859_Jun_9_2010_10_13_45/rac/copy_files.txt.instantiated" by replacing $ORACLE_HOME in "/opt/rac/oracle/11.2.0/rac/.patch_storage/9711859_Jun_9_2010_10_13_45/rac/copy_files.txt" with actual path.
Propagating files to remote nodes...
Instantiating the file "/opt/rac/oracle/11.2.0/rac/.patch_storage/9711859_Jun_9_2010_10_13_45/rac/copy_dirs.txt.instantiated" by replacing $ORACLE_HOME in "/opt/rac/oracle/11.2.0/rac/.patch_storage/9711859_Jun_9_2010_10_13_45/rac/copy_dirs.txt" with actual path.
Propagating directories to remote nodes...
Instantiating the file "/opt/rac/oracle/11.2.0/rac/.patch_storage/9711859_Jun_9_2010_10_13_45/rac/make_cmds.txt.instantiated" by replacing $ORACLE_HOME in "/opt/rac/oracle/11.2.0/rac/.patch_storage/9711859_Jun_9_2010_10_13_45/rac/make_cmds.txt" with actual path.
Running command on remote node 'rac2':
cd /opt/rac/oracle/11.2.0/rac/rdbms/lib; /usr/bin/make -f ins_rdbms.mk ioracle ORACLE_HOME=/opt/rac/oracle/11.2.0/rac || echo REMOTE_MAKE_FAILED::>&2
节点 'rac2' 已打补丁。您可以在该节点上重新启动 Oracle 实例。
远程节点上存在重链接。一定要检查节点 'rac2'  上的二进制文件的大小和时间戳。
已在远程节点上调用以下 make 命令:
'cd /opt/rac/oracle/11.2.0/rac/rdbms/lib; /usr/bin/make -f ins_rdbms.mk ioracle ORACLE_HOME=/opt/rac/oracle/11.2.0/rac
'
Patch 9711859 successfully applied
Log file location: /opt/rac/oracle/11.2.0/rac/cfgtoollogs/opatch/9711859_Jun_25_2012_16_16_42/apply2012-06-25_16-16-42下午_1.log
OPatch succeeded.
六 在两个节点分别执行下面的命令来确认补丁已经安装成功。
oracle@rac1:/home/oracle/software/9711859>opatch lsinventory
Oracle 中间补丁程序安装程序版本 11.2.0.3.0
版权所有 (c) 2012, Oracle Corporation。保留所有权利。
Oracle Home       : /opt/rac/oracle/11.2.0/rac
Central Inventory : /opt/rac/oraInventory
   from                : /opt/rac/oracle/11.2.0/rac/oraInst.loc
OPatch version    : 11.2.0.3.0
OUI version         : 11.2.0.1.0
Log file location   : /opt/rac/oracle/11.2.0/rac/cfgtoollogs/opatch/opatch2012-06-25_16-36-30下午_1.log
Lsinventory Output file location : /opt/rac/oracle/11.2.0/rac/cfgtoollogs/opatch/lsinv/lsinventory2012-06-25_16-36-30下午.txt
--------------------------------------------------------------------------------
已安装的顶级产品 (1):
Oracle Database 11g                                                  11.2.0.1.0
此 Oracle 主目录中已安装 1 个产品。
中间补丁程序 (1) :
Patch  9711859      : applied on Mon Jun 25 16:22:36 CST 2012
Unique Patch ID:  12670211
   Created on 9 Jun 2010, 10:13:45 hrs PST8PDT
   Bugs fixed:
     9711859
包含多个节点的 RAC 系统
  Local node = rac1
  Remote node = rac2
--------------------------------------------------------------------------------
OPatch succeeded.
同样在节点2上的确认 输出略!


回退补丁9711859的过程~
一  将节点1 的数据库实例关闭
  执行
  srvctl stop instance -d rac -i rac1
  srvctl stop listener -l LISTENER -n rac1
二 执行回退补丁:
oracle@rac1:/home/oracle/software/9711859>opatch rollback -id 9711859
Oracle 中间补丁程序安装程序版本 11.2.0.3.0
版权所有 (c) 2012, Oracle Corporation。保留所有权利。
Oracle Home       : /opt/rac/oracle/11.2.0/rac
Central Inventory : /opt/rac/oraInventory
   from           : /opt/rac/oracle/11.2.0/rac/oraInst.loc
OPatch version    : 11.2.0.3.0
OUI version       : 11.2.0.1.0
Log file location : /opt/rac/oracle/11.2.0/rac/cfgtoollogs/opatch/9711859_Jun_25_2012_17_30_32/rollback2012-06-25_17-30-32下午_1.log
RollbackSession 从 OH '/opt/rac/oracle/11.2.0/rac' 回退中间补丁程序 '9711859'
此节点是 Oracle Real Application Cluster 的一部分。
远程节点: 'rac2'
本地节点: 'rac1'
请关闭所有节点上在此 ORACLE_HOME 之外运行的 Oracle 实例。
(Oracle 主目录 = '/opt/rac/oracle/11.2.0/rac')
所有节点是否都已准备打补丁? [y|n]
y
User Responded with: Y
正在为组件 oracle.rdbms, 11.2.0.1.0 打补丁...
RollbackSession 从产品清单中删除中间补丁程序 '9711859'
在滚动模式下打补丁。
接下来将为节点 'rac2' 打补丁。
请关闭 'rac2' 上在此 ORACLE_HOME 之外运行的 Oracle 实例。
(Oracle 主目录 = '/opt/rac/oracle/11.2.0/rac')
三 在节点rac1上启动数据库和监听操作
oracle@rac1:/home/oracle/software/9711859>srvctl start instance  -d rac -i rac1 -o open             
oracle@rac1:/home/oracle/software/9711859>srvctl status instance  -d rac -i rac1           
实例 rac1 正在节点 rac1 上运行
oracle@rac1:/home/oracle/software/9711859>srvctl start listener -l LISTENER -n rac1
PRCC-1015 : LISTENER 已在 rac1 上运行 四 关闭节点rac2 的监听和数据库实例操作
oracle@rac1:/home/oracle/software/9711859>srvctl stop listener -l LISTENER -n rac2
oracle@rac1:/home/oracle/software/9711859>srvctl stop instance  -d rac -i rac2
五 选择在节点rac2上卸载补丁!
该节点是否已准备打补丁? [y|n]
y
User Responded with: Y
Updating nodes 'rac2'
   Rollback-related files are:
     FR = "/opt/rac/oracle/11.2.0/rac/.patch_storage/9711859_Jun_9_2010_10_13_45/rac/remove_files.txt"
     DR = "/opt/rac/oracle/11.2.0/rac/.patch_storage/9711859_Jun_9_2010_10_13_45/rac/remove_dirs.txt"
     FP = "/opt/rac/oracle/11.2.0/rac/.patch_storage/9711859_Jun_9_2010_10_13_45/rac/copy_files.txt"
     MP = "/opt/rac/oracle/11.2.0/rac/.patch_storage/9711859_Jun_9_2010_10_13_45/rac/make_cmds.txt"
     RC = "/opt/rac/oracle/11.2.0/rac/.patch_storage/9711859_Jun_9_2010_10_13_45/rac/remote_cmds.txt"

Instantiating the file "/opt/rac/oracle/11.2.0/rac/.patch_storage/9711859_Jun_9_2010_10_13_45/rac/remove_files.txt.instantiated" by replacing $ORACLE_HOME in "/opt/rac/oracle/11.2.0/rac/.patch_storage/9711859_Jun_9_2010_10_13_45/rac/remove_files.txt" with actual path.
Removing files on remote nodes...
Instantiating the file "/opt/rac/oracle/11.2.0/rac/.patch_storage/9711859_Jun_9_2010_10_13_45/rac/remove_dirs.txt.instantiated" by replacing $ORACLE_HOME in "/opt/rac/oracle/11.2.0/rac/.patch_storage/9711859_Jun_9_2010_10_13_45/rac/remove_dirs.txt" with actual path.
Removing directories on remote nodes...
Instantiating the file "/opt/rac/oracle/11.2.0/rac/.patch_storage/9711859_Jun_9_2010_10_13_45/rac/copy_files.txt.instantiated" by replacing $ORACLE_HOME in "/opt/rac/oracle/11.2.0/rac/.patch_storage/9711859_Jun_9_2010_10_13_45/rac/copy_files.txt" with actual path.
Propagating files to remote nodes...
Instantiating the file "/opt/rac/oracle/11.2.0/rac/.patch_storage/9711859_Jun_9_2010_10_13_45/rac/copy_dirs.txt.instantiated" by replacing $ORACLE_HOME in "/opt/rac/oracle/11.2.0/rac/.patch_storage/9711859_Jun_9_2010_10_13_45/rac/copy_dirs.txt" with actual path.
Propagating directories to remote nodes...
Instantiating the file "/opt/rac/oracle/11.2.0/rac/.patch_storage/9711859_Jun_9_2010_10_13_45/rac/make_cmds.txt.instantiated" by replacing $ORACLE_HOME in "/opt/rac/oracle/11.2.0/rac/.patch_storage/9711859_Jun_9_2010_10_13_45/rac/make_cmds.txt" with actual path.
Running command on remote node 'rac2':
cd /opt/rac/oracle/11.2.0/rac/rdbms/lib; /usr/bin/make -f ins_rdbms.mk ioracle ORACLE_HOME=/opt/rac/oracle/11.2.0/rac || echo REMOTE_MAKE_FAILED::>&2


节点 'rac2' 已打补丁。您可以在该节点上重新启动 Oracle 实例。
远程节点上存在重链接。一定要检查节点 'rac2'  上的二进制文件的大小和时间戳。
已在远程节点上调用以下 make 命令:
'cd /opt/rac/oracle/11.2.0/rac/rdbms/lib; /usr/bin/make -f ins_rdbms.mk ioracle ORACLE_HOME=/opt/rac/oracle/11.2.0/rac'
Log file location: /opt/rac/oracle/11.2.0/rac/cfgtoollogs/opatch/9711859_Jun_25_2012_17_30_32/rollback2012-06-25_17-30-32下午_1.log
OPatch succeeded.
六 在两个节点检查是否回滚成功!
oracle@rac1:/home/oracle/software/9711859>opatch lsinventory       
Oracle 中间补丁程序安装程序版本 11.2.0.3.0
版权所有 (c) 2012, Oracle Corporation。保留所有权利。
Oracle Home       : /opt/rac/oracle/11.2.0/rac
Central Inventory : /opt/rac/oraInventory
   from           : /opt/rac/oracle/11.2.0/rac/oraInst.loc
OPatch version    : 11.2.0.3.0
OUI version       : 11.2.0.1.0
Log file location : /opt/rac/oracle/11.2.0/rac/cfgtoollogs/opatch/opatch2012-06-25_17-41-29下午_1.log
Lsinventory Output file location : /opt/rac/oracle/11.2.0/rac/cfgtoollogs/opatch/lsinv/lsinventory2012-06-25_17-41-29下午.txt
-------------------------------------------------------------------------------
已安装的顶级产品 (1):
Oracle Database 11g                                                  11.2.0.1.0
此 Oracle 主目录中已安装 1 个产品。
此 Oracle 主目录中未安装任何中间补丁程序。
包含多个节点的 RAC 系统
  Local node = rac1
  Remote node = rac2
--------------------------------------------------------------------------------
OPatch succeeded.

linux

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Adding Users to MySQL: The Complete TutorialAdding Users to MySQL: The Complete TutorialMay 12, 2025 am 12:14 AM

Mastering the method of adding MySQL users is crucial for database administrators and developers because it ensures the security and access control of the database. 1) Create a new user using the CREATEUSER command, 2) Assign permissions through the GRANT command, 3) Use FLUSHPRIVILEGES to ensure permissions take effect, 4) Regularly audit and clean user accounts to maintain performance and security.

Mastering MySQL String Data Types: VARCHAR vs. TEXT vs. CHARMastering MySQL String Data Types: VARCHAR vs. TEXT vs. CHARMay 12, 2025 am 12:12 AM

ChooseCHARforfixed-lengthdata,VARCHARforvariable-lengthdata,andTEXTforlargetextfields.1)CHARisefficientforconsistent-lengthdatalikecodes.2)VARCHARsuitsvariable-lengthdatalikenames,balancingflexibilityandperformance.3)TEXTisidealforlargetextslikeartic

MySQL: String Data Types and Indexing: Best PracticesMySQL: String Data Types and Indexing: Best PracticesMay 12, 2025 am 12:11 AM

Best practices for handling string data types and indexes in MySQL include: 1) Selecting the appropriate string type, such as CHAR for fixed length, VARCHAR for variable length, and TEXT for large text; 2) Be cautious in indexing, avoid over-indexing, and create indexes for common queries; 3) Use prefix indexes and full-text indexes to optimize long string searches; 4) Regularly monitor and optimize indexes to keep indexes small and efficient. Through these methods, we can balance read and write performance and improve database efficiency.

MySQL: How to Add a User RemotelyMySQL: How to Add a User RemotelyMay 12, 2025 am 12:10 AM

ToaddauserremotelytoMySQL,followthesesteps:1)ConnecttoMySQLasroot,2)Createanewuserwithremoteaccess,3)Grantnecessaryprivileges,and4)Flushprivileges.BecautiousofsecurityrisksbylimitingprivilegesandaccesstospecificIPs,ensuringstrongpasswords,andmonitori

The Ultimate Guide to MySQL String Data Types: Efficient Data StorageThe Ultimate Guide to MySQL String Data Types: Efficient Data StorageMay 12, 2025 am 12:05 AM

TostorestringsefficientlyinMySQL,choosetherightdatatypebasedonyourneeds:1)UseCHARforfixed-lengthstringslikecountrycodes.2)UseVARCHARforvariable-lengthstringslikenames.3)UseTEXTforlong-formtextcontent.4)UseBLOBforbinarydatalikeimages.Considerstorageov

MySQL BLOB vs. TEXT: Choosing the Right Data Type for Large ObjectsMySQL BLOB vs. TEXT: Choosing the Right Data Type for Large ObjectsMay 11, 2025 am 12:13 AM

When selecting MySQL's BLOB and TEXT data types, BLOB is suitable for storing binary data, and TEXT is suitable for storing text data. 1) BLOB is suitable for binary data such as pictures and audio, 2) TEXT is suitable for text data such as articles and comments. When choosing, data properties and performance optimization must be considered.

MySQL: Should I use root user for my product?MySQL: Should I use root user for my product?May 11, 2025 am 12:11 AM

No,youshouldnotusetherootuserinMySQLforyourproduct.Instead,createspecificuserswithlimitedprivilegestoenhancesecurityandperformance:1)Createanewuserwithastrongpassword,2)Grantonlynecessarypermissionstothisuser,3)Regularlyreviewandupdateuserpermissions

MySQL String Data Types Explained: Choosing the Right Type for Your DataMySQL String Data Types Explained: Choosing the Right Type for Your DataMay 11, 2025 am 12:10 AM

MySQLstringdatatypesshouldbechosenbasedondatacharacteristicsandusecases:1)UseCHARforfixed-lengthstringslikecountrycodes.2)UseVARCHARforvariable-lengthstringslikenames.3)UseBINARYorVARBINARYforbinarydatalikecryptographickeys.4)UseBLOBorTEXTforlargeuns

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools