基於11GR2的PSU補丁安裝
場景:hp-unix新裝數據庫11.2.0.4.0,爲了便於在線上觸發此版本的一些bug而導致停機來維護,在安裝後,應用MOS上提供最新的PSU補丁,
操作:利用OPatch工具來打GI和ORACLE軟件的PSU
操作系統版本:
$ uname -a
HP-UX dbsrv B.11.31 U ia64 3837480657unlimited-user license
一、打PSU之前的檢查工作
==>查看數據庫版本
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise EditionRelease 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE 11.2.0.4.0 Production
TNS for HPUX: Version 11.2.0.4.0 -Production
NLSRTL Version 11.2.0.4.0 - Production
==>下載補丁,建議在MOS上下載自己需要的補丁
這裏應用補丁是基於HPUX-IA64的p18139609的PSU,將其版本打到11.2.0.4.2
==>解壓補丁,放在自己指定的目錄下
$ pwd
/tmp/psu/18139609
$ ll
total 144
drwxr-xr-x 4 grid oinstall 8192 May 15 17:30 18031668
drwxr-xr-x 5 grid oinstall 96 May 15 17:30 18031740
-rw-r--r-- 1 grid oinstall 55880 May 15 17:29 README.html
-rw-r--r-- 1 grid oinstall 0 May 15 17:30 README.txt
-rw-r--r-- 1 grid oinstall 452 May 15 17:29 bundle.xml
==>檢查GI和oracle下的OPatch工具是否滿足README.html裏的版本要求,如果不滿足下載其滿足的版本
$ /u01/app/grid/11.2.0/OPatch/opatchversion
OPatch Version: 11.2.0.3.6
OPatch succeeded.
$ /u01/app/oracle/product/11.2.0/dbhome_1/OPatch/opatchversion
OPatch Version: 11.2.0.3.6
OPatch succeeded.
==>驗證一下GI和ORACLE用戶的inventory是否有效,如果有錯誤或者不一致,就必須優先打滿足的補丁使其滿足打PSU補丁的要求
/u01/app/grid/11.2.0/OPatch/opatchlsinventory -detail -oh /u01/app/grid/11.2.0
/u01/app/oracle/product/11.2.0/dbhome_1/OPatch/opatchlsinventory -detail -oh /u01/app/oracle/product/11.2.0/dbhome_1
==>檢查是否有與GI的18031740及ORACLE的18031668補丁有衝突的PSU
$ /u01/app/grid/11.2.0/OPatch/opatch prereqCheckConflictAgainstOHWithDetail -ph /tmp/psu/18139609/18031740
Oracle Interim Patch Installer version11.2.0.3.6
Copyright (c) 2013, OracleCorporation. All rights reserved.
PREREQ session
Oracle Home : /u01/app/grid/11.2.0
Central Inventory : /u01/app/oraInventory
from :/u01/app/grid/11.2.0/oraInst.loc
OPatch version : 11.2.0.3.6
OUI version : 11.2.0.4.0
Log file location :/u01/app/grid/11.2.0/cfgtoollogs/opatch/opatch2014-05-21_13-00-32PM_1.log
Invoking prereq"checkconflictagainstohwithdetail"
Prereq"checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.
$/u01/app/oracle/product/11.2.0/dbhome_1/OPatch/opatch prereqCheckConflictAgainstOHWithDetail -ph /tmp/psu/18139609/18031668
Oracle Interim Patch Installer version11.2.0.3.6
Copyright (c) 2013, OracleCorporation. All rights reserved.
PREREQ session
Oracle Home :/u01/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /u01/app/oraInventory
from :/u01/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
OPatch version : 11.2.0.3.6
OUI version : 11.2.0.4.0
Log file location :/u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2014-05-21_13-02-12PM_1.log
Invoking prereq"checkconflictagainstohwithdetail"
Prereq"checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.
==>檢查所下載的補丁能否應用到GI和ORACLE軟件的home目錄裏,如果不能pass過去就要查找原因,這裏GI就不能,一般都是沒有解鎖GIhome目錄導致
$ /u01/app/grid/11.2.0/OPatch/opatch prereqCheckApplicable -ph /tmp/psu/18139609/18031740 -oh /u01/app/grid/11.2.0
Oracle Interim Patch Installer version11.2.0.3.6
Copyright (c) 2013, OracleCorporation. All rights reserved.
PREREQ session
Oracle Home : /u01/app/grid/11.2.0
Central Inventory : /u01/app/oraInventory
from :/u01/app/grid/11.2.0/oraInst.loc
OPatch version : 11.2.0.3.6
OUI version : 11.2.0.4.0
Log file location :/u01/app/grid/11.2.0/cfgtoollogs/opatch/opatch2014-05-16_10-30-55AM_1.log
Invoking prereq "checkapplicable"
Prereq "checkApplicable" forpatch 18031740 passed.
OPatch succeeded.
$/u01/app/oracle/product/11.2.0/dbhome_1/OPatch/opatch prereq CheckApplicable-ph /tmp/psu/18139609/18031668 -oh /u01/app/oracle/product/11.2.0/dbhome_1
Oracle Interim Patch Installer version11.2.0.3.6
Copyright (c) 2013, Oracle Corporation. All rights reserved.
PREREQ session
Oracle Home :/u01/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /u01/app/oraInventory
from :/u01/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
OPatch version : 11.2.0.3.6
OUI version : 11.2.0.4.0
Log file location :/u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2014-05-21_12-55-21PM_1.log
Invoking prereq "checkapplicable"
Prereq "checkApplicable" forpatch 17478514 passed.
Prereq "checkApplicable" forpatch 18031668 passed.
OPatch succeeded.
二、打PSU補丁
1、停服務,停數據庫,停GI
oracle用戶下停服務停數據庫:
srvctl stop service -d gisdb -s gis
srvctl stop -d gisdb
root下停集羣:
/u01/app/grid/11.2.0/bin/crsctl stop has
查看一下集羣進程和數據庫及ASM實例進程是否停乾淨
$ ps -ef | grep d.b
$ ps -ef | grep pmon
2、在root用戶下解鎖GI的home目錄
$ORACLE_HOME/perl/bin/perl$ORACLE_HOME/crs/install/roothas.pl -unlock
3、打GI的PSU補丁
$ /u01/app/grid/11.2.0/OPatch/opatch napply-oh /u01/app/grid/11.2.0 -local /tmp/psu/18139609/18031740
Oracle Interim Patch Installer version11.2.0.3.6
Copyright (c) 2013, OracleCorporation. All rights reserved.
Oracle Home : /u01/app/grid/11.2.0
Central Inventory : /u01/app/oraInventory
from :/u01/app/grid/11.2.0/oraInst.loc
OPatch version : 11.2.0.3.6
OUI version : 11.2.0.4.0
Log file location :/u01/app/grid/11.2.0/cfgtoollogs/opatch/opatch2014-05-16_10-32-38AM_1.log
Verifying environment and performingprerequisite checks...
OPatch continues with these patches: 18031740
Do you want to proceed? [y|n]
y
User Responded with: Y
All checks passed.
Provide your email address to be informedof security issues, install and
initiate Oracle Configuration Manager.Easier for you if you use your My
Oracle Support Email address/User Name.
Visit http://www.oracle.com/support/policies.htmlfor details.
Email address/User Name:
You have not provided an email address fornotification of security issues.
Do you wish to remain uninformed ofsecurity issues ([Y]es, [N]o) [N]: Y
Please shutdown Oracle instances runningout of this ORACLE_HOME on the local system.
(Oracle Home = '/u01/app/grid/11.2.0')
Is the local system ready for patching?[y|n]
y
User Responded with: Y
Backing up files...
Applying interim patch '18031740' to OH'/u01/app/grid/11.2.0'
Patching component oracle.crs,11.2.0.4.0...
chmod: invalid mode
Verifying the update...
Patch 18031740 successfully applied.
Log file location:/u01/app/grid/11.2.0/cfgtoollogs/opatch/opatch2014-05-16_10-32-38AM_1.log
3、打ORACLE的PSU補丁
$/u01/app/oracle/product/11.2.0/dbhome_1/OPatch/opatch prereq CheckApplicable-ph /tmp/psu/18139609/18031668 -oh /u01/app/oracle/product/11.2.0/dbhome_1
Oracle Interim Patch Installer version11.2.0.3.6
Copyright (c) 2013, OracleCorporation. All rights reserved.
PREREQ session
Oracle Home : /u01/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /u01/app/oraInventory
from :/u01/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
OPatch version : 11.2.0.3.6
OUI version : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2014-05-16_09-28-35AM_1.log
Invoking prereq "checkapplicable"
Prereq "checkApplicable" forpatch 17478514 passed.
Prereq "checkApplicable" forpatch 18031668 passed.
OPatch succeeded.
$ id
uid=1101(oracle) gid=1000(oinstall)groups=1001(dba),1003(asmadmin),1004(asmdba)
$/u01/app/oracle/product/11.2.0/dbhome_1/OPatch/opatch napply -oh/u01/app/oracle/product/11.2.0/dbhome_1 -local /tmp/psu/18139609/18031668
Oracle Interim Patch Installer version11.2.0.3.6
Copyright (c) 2013, OracleCorporation. All rights reserved.
Oracle Home :/u01/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /u01/app/oraInventory
from :/u01/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
OPatch version : 11.2.0.3.6
OUI version : 11.2.0.4.0
Log file location :/u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2014-05-16_09-33-34AM_1.log
Verifying environment and performingprerequisite checks...
OPatch continues with these patches: 17478514 18031668
Do you want to proceed? [y|n]
y
User Responded with: Y
All checks passed.
Provide your email address to be informedof security issues, install and
initiate Oracle Configuration Manager.Easier for you if you use your My
Oracle Support Email address/User Name.
Visithttp://www.oracle.com/support/policies.html for details.
Email address/User Name:
You have not provided an email address fornotification of security issues.
Do you wish to remain uninformed ofsecurity issues ([Y]es, [N]o) [N]: Y
Please shutdown Oracle instances runningout of this ORACLE_HOME on the local system.
(Oracle Home ='/u01/app/oracle/product/11.2.0/dbhome_1')
Is the local system ready for patching?[y|n]
y
User Responded with: Y
Backing up files...
Applying sub-patch '17478514' to OH'/u01/app/oracle/product/11.2.0/dbhome_1'
Patching component oracle.rdbms,11.2.0.4.0...
Patching component oracle.rdbms.rsf,11.2.0.4.0...
Patching component oracle.sdo,11.2.0.4.0...
Patching component oracle.sysman.agent,10.2.0.4.5...
Patching component oracle.xdk,11.2.0.4.0...
Patching component oracle.rdbms.dbscripts,11.2.0.4.0...
Patching component oracle.sdo.locator,11.2.0.4.0...
Patching component oracle.nlsrtl.rsf,11.2.0.4.0...
Patching component oracle.xdk.rsf, 11.2.0.4.0...
Patching component oracle.rdbms.rman,11.2.0.4.0...
Verifying the update...
chmod: invalid mode
Applying sub-patch '18031668' to OH'/u01/app/oracle/product/11.2.0/dbhome_1'
Patching component oracle.rdbms,11.2.0.4.0...
Patching component oracle.rdbms.rsf,11.2.0.4.0...
Patching component oracle.ldap.rsf,11.2.0.4.0...
Patching component oracle.rdbms.crs,11.2.0.4.0...
Patching component oracle.precomp.common,11.2.0.4.0...
Patching component oracle.ldap.rsf.ic,11.2.0.4.0...
Patching component oracle.rdbms.deconfig,11.2.0.4.0...
Patching component oracle.rdbms.dbscripts,11.2.0.4.0...
Patching component oracle.rdbms.rman,11.2.0.4.0...
chmod: invalid mode
Verifying the update...
Composite patch 18031668 successfullyapplied.
Log file location: /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2014-05-16_09-33-34AM_1.log
OPatch succeeded.
OPatch succeeded.
5、啓動CRS
/u01/app/grid/11.2.0/bin/crsctl start has
# ./roothas.pl -patch==>說明重啓HAS後,鎖會自動上起來
Using configuration parameter file:./crsconfig_params
CRS-4123: Oracle High Availability Serviceshas been started.
6、啓動數據庫
srvctl start database -d gisdb
7、裝載修改的SQL文件到數據庫裏
cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle.sql psu apply
SQL> QUIT
8、檢查@catbundle.sql psuapply產生的日誌,是否有錯誤
# more/u01/app/oracle/cfgtoollogs/catbundle/catbundle_PSU_GISDB_APPLY_2014May16_10_55_09.log|grep errors
SQL> show errors;
No errors.
SQL> show errors;
No errors.
SQL> show errors;
No errors.
SQL> show errors
No errors.
9、截止這步,PSU已經完成,檢查打完PSU後庫的補丁,對象等情況
set line 150
set pagesize 99
col action_time for a30
col action for a30
col comments for a90
col object_name for a30
col object_type for a30
col comp_name for a50
col comp_id for a20
==>查看組件信息
select COMP_ID,COMP_NAME,VERSION,STATUSfrom DBA_REGISTRY;
==>查看所打補丁信息
select action,comments fromregistry$history;
==>查看無效對象
select count(*) from dba_objects wherestatus<>'VALID';
如果有無效對象,運行下面語句
@?/rdbms/admin/utlrp.sql
===========================
相關交流信息
QQ羣: 330218614
Email: [email protected]
Blog: http://blog.csdn.net/trsenzhang
============================