Oracle 10g升级之--PSU升级

  1. 云栖社区>
  2. 博客>
  3. 正文

Oracle 10g升级之--PSU升级

余二五 2017-11-16 21:24:00 浏览1202
展开阅读全文

Oracle 10g升级之--PSU 升级


-----从10.2.0.4.0 升级到 10.2.0.4.4,然后再升级到10.2.0.4.11


一. 什么是PSU/CPU


CPU: Critical Patch Update

Oracle对于其产品每个季度发行一次的安全补丁包,通常是为了修复产品中的安全隐患。


PSU: Patch Set Updates

Oracle对于其产品每个季度发行一次的补丁包,包含了bug的修复。Oracle选取被用户下载数量多的,并且被验证过具有较低风险的补丁放入到每个季度的PSU中。在每个PSU中不但包含Bug的修复而


且还包含了最新的CPU。


二. 如何查找最新的PSU


每个数据库版本都有自己的PSU,PSU版本号体现在数据库版本的最后一位,比如最新的10.2.0.5的PSU是10.2.0.5.3,而11.2.0.2的最新PSU则是11.2.0.2.2。

MOS站点中Oracle Recommended Patches — Oracle Database [ID 756671.1] 文档中查到各个产品版本最新的PSU。

如果你记不住这个文档号,那么在MOS中以“PSU”为关键字搜索,通常这个文档会显示在搜索结果的最前面。


注意:必须购买了Oracle基本服务获取了CSI号以后才有权限登陆MOS站点。


三. 如何正确安装PSU


每个PSU安装包中都包含一个README.html文档,其中描述了如何安装该PSU,有些PSU是可以直接安装的,而有些PSU则必须要求安装了上一个版本的PSU之后才能继续安装。比如对于10.2.0.4版本的


数据库来说,PSU 10.2.0.4.4可以直接安装在最原始的10.2.0.4.0版本中,而最新的PSU 10.2.0.4.8则必须要求先安装10.2.0.4.4。这些信息在README.html中都可以找到,所以请仔细阅读该文档


通常安装PSU是比较简单的,步骤如下:

1) 安装PSU需要使用到opatch,在README.html中有描述该PSU需要的最低版本opatch,如果当前opatch版本过低,则需要先下载 Patch 6880880,该Patch中包含最新的opatch,只需要解压覆盖原


先的$ORACLE_HOME/OPatch目录即可。


查看当前的opatch版本,可以使用opatch version命令。


如图所示:


wKiom1RQoobQFmCBAAIS_zJECwY966.jpg

wKioL1RQot6hA1GsAAJ8hQK-sxE012.jpg

wKiom1RQooezQI5fAAGDbiXlGwk424.jpg

wKioL1RQot6Q2Yq3AAP1dKwwfvA337.jpg

1、下载PSU,通过METALINK 的账号到oracle官方支持网站下载


[oracle@RH4 ~]$ ls -l p*

1
2
3
4
-rwxr--r--1 oracle oinstall5259023 Apr 282012 p12879929_1020411_Linux-x86.zip//10.2.0.4.11 需先升级到10.2.0.4.4
-rwxr--r--1 oracle oinstall 1053748381 Mar 17 12:17 p6810189_10204_Linux-x86.zip
-rwxr--r--1 oracle oinstall16812819 Apr 282012 p9352164_1020404_Linux-x86.zip//10.2.0.4.4
-rw-r--r--1 oracle oinstall36009077 Apr 27 07:04 patch.log

2、解压安装

1
2
3
4
[oracle@RH4 ~]$ unzip p9352164_1020404_Linux-x86.zip
[oracle@RH4 ~]$ cd 9352164/
[oracle@RH4 9352164]$ ls
custometcfilespatchmd.xmlpsu_root.shREADME.htmlREADME.txt

-------查看opatch 当前版本

[oracle@RH4 OPatch]$ ./opatch version

1
2
3
Invoking OPatch 10.2.0.4.2
OPatch Version: 10.2.0.4.2
OPatch succeeded.

[oracle@RH4 OPatch]$

------ 查看opatch 安装路径

[oracle@RH4 OPatch]$ ./opatch lsinventory

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Invoking OPatch 10.2.0.4.2
Oracle Interim Patch Installer version 10.2.0.4.2
Copyright (c) 2007, Oracle Corporation.All rights reserved.
Oracle Home: /u01/app/oracle/product/10.2.0/db_1
Central Inventory : /u01/app/oracle/oraInventory
from: /etc/oraInst.loc
OPatch version: 10.2.0.4.2
OUI version: 10.2.0.4.0
OUI location: /u01/app/oracle/product/10.2.0/db_1/oui
Log file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch2012-04-27_23-46-40PM.log
Lsinventory Output file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2012-04-27_23-46-40PM.txt
--------------------------------------------------------------------------------
Installed Top-level Products (2):
Oracle Database 10g10.2.0.1.0
Oracle Database 10g Release 2 Patch Set 310.2.0.4.0
There are 2 products installed in this Oracle Home
There are no Interim patches installed in this Oracle Home
--------------------------------------------------------------------------------
OPatch succeeded.

--------安装PSU

[oracle@RH4 9352164]$ /u01/app/oracle/product/10.2.0/db_1/OPatch/opatch apply

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Invoking OPatch 10.2.0.4.2
Oracle Interim Patch Installer version 10.2.0.4.2
Copyright (c) 2007, Oracle Corporation.All rights reserved.
Oracle Home: /u01/app/oracle/product/10.2.0/db_1
Central Inventory : /u01/app/oracle/oraInventory
from: /etc/oraInst.loc
OPatch version: 10.2.0.4.2
OUI version: 10.2.0.4.0
OUI location: /u01/app/oracle/product/10.2.0/db_1/oui
Log file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch2012-04-27_23-31-39PM.log
ApplySession failed: Patch ID is null.
System intact, OPatch will not attempt to restore the system
OPatch failed with error code 73
[oracle@RH4 9352164]$ tail -20 /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch2012-04-27_23-31-39PM.log
Central Inventory : /u01/app/oracle/oraInventory
from: /etc/oraInst.loc
OPatch version: 10.2.0.4.2
OUI version: 10.2.0.4.0
OUI location: /u01/app/oracle/product/10.2.0/db_1/oui
Log file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch2012-04-27_23-31-39PM.log
INFO:Starting ApplySession at Fri Apr 27 23:31:41 CST 2012
INFO:Starting Apply Session at Fri Apr 27 23:31:41 CST 2012
SEVERE:OUI-67073:ApplySession failed: Patch ID is null.
INFO:System intact, OPatch will not attempt to restore the system
INFO:Finishing ApplySession at Fri Apr 27 23:31:41 CST 2012
INFO:Total time spent waiting for user-input is 0 seconds.Finish at Fri Apr 27 23:31:41 CST 2012
INFO:Stack Description: java.lang.RuntimeException: Patch ID is null.
INFO:StackTrace: oracle.opatch.PatchObject.getPatchID(PatchObject.java:543)
INFO:StackTrace: oracle.opatch.ApplySession.loadAndInitPatchObject(ApplySession.java:1487)
INFO:StackTrace: oracle.opatch.ApplySession.process(ApplySession.java:5191)
INFO:StackTrace: oracle.opatch.OPatchSession.main(OPatchSession.java:1544)
INFO:StackTrace: oracle.opatch.OPatch.main(OPatch.java:570)
INFO:File "/u01/app/oracle/product/10.2.0/db_1/.patch_storage/patch_unzip" cannot be deleted as it does not exist

[oracle@RH4 ~]$ /u01/app/oracle/product/10.2.0/db_1/OPatch/opatch prereq

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
CheckConflictAgainstOHWithDetail -phBaseDir ./9352164
Invoking OPatch 10.2.0.4.2
Oracle Interim Patch Installer version 10.2.0.4.2
Copyright (c) 2007, Oracle Corporation.All rights reserved.
PREREQ session
Oracle Home: /u01/app/oracle/product/10.2.0/db_1
Central Inventory : /u01/app/oracle/oraInventory
from: /etc/oraInst.loc
OPatch version: 10.2.0.4.2
OUI version: 10.2.0.4.0
OUI location: /u01/app/oracle/product/10.2.0/db_1/oui
Log file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch2012-04-28_00-22-44AM.log
Invoking prereq "checkconflictagainstohwithdetail"
The location "./9352164/README.html" is not a directory or a valid patch zip file.
Prereq "checkConflictAgainstOHWithDetail" not executed
PrereqSession failed: Invalid patch location.
OPatch failed with error code 73
[oracle@RH4 ~]$ /u01/app/oracle/product/10.2.0/db_1/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./9352164
Invoking OPatch 10.2.0.4.2
Oracle Interim Patch Installer version 10.2.0.4.2
Copyright (c) 2007, Oracle Corporation.All rights reserved.
PREREQ session
Oracle Home: /u01/app/oracle/product/10.2.0/db_1
Central Inventory : /u01/app/oracle/oraInventory
from: /etc/oraInst.loc
OPatch version: 10.2.0.4.2
OUI version: 10.2.0.4.0
OUI location: /u01/app/oracle/product/10.2.0/db_1/oui
Log file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch2012-04-28_00-25-19AM.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" not executed
Unable to create Patch Object.
Exception occured : Patch ID is null.
OPatch succeeded.

-----------以上错误,经过多方查证,是因为opatch 自身版本较低,先更新opatch ,下载p6880880

------安装opatch 新的版本

[oracle@RH4 ~]$ unzip p6880880_102000_LINUX.zip

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Archive:p6880880_102000_LINUX.zip
creating: OPatch/
creating: OPatch/ocm/
extracting: OPatch/ocm/ocm.zip
creating: OPatch/ocm/lib/
inflating: OPatch/ocm/lib/osdt_jce.jar
inflating: OPatch/ocm/lib/osdt_core3.jar
inflating: OPatch/ocm/lib/emocmclnt-14.jar
inflating: OPatch/ocm/lib/emocmutl.jar
creating: OPatch/ocm/bin/
inflating: OPatch/ocm/bin/emocmrsp
inflating: OPatch/ocm/ocm_platforms.txt
creating: OPatch/crs/
creating: OPatch/crs/log/
inflating: OPatch/crs/patch112.pl
inflating: OPatch/crs/crsdelete.pm
inflating: OPatch/crs/crspatch.pm
inflating: OPatch/crs/s_crsconfig_defs
inflating: OPatch/crs/crsconfig_lib.pm
inflating: OPatch/crs/oracss.pm
inflating: OPatch/crs/auto_patch.pl
inflating: OPatch/crs/s_crsconfig_lib.pm
inflating: OPatch/opatch
creating: OPatch/opatchprereqs/
creating: OPatch/opatchprereqs/opatch/
inflating: OPatch/opatchprereqs/opatch/runtime_prereq.xml
inflating: OPatch/opatchprereqs/opatch/opatch_prereq.xml
inflating: OPatch/opatchprereqs/opatch/rulemap.xml
inflating: OPatch/opatchprereqs/prerequisite.properties
creating: OPatch/opatchprereqs/oui/
inflating: OPatch/opatchprereqs/oui/knowledgesrc.xml
inflating: OPatch/opatch.ini
inflating: OPatch/emdpatch.pl
inflating: OPatch/opatch.pl
creating: OPatch/jlib/
inflating: OPatch/jlib/opatchprereq.jar
inflating: OPatch/jlib/opatchactions.jar
inflating: OPatch/jlib/opatchutil.jar
inflating: OPatch/jlib/opatchfmw.jar
inflating: OPatch/jlib/opatchext.jar
inflating: OPatch/jlib/opatch.jar
inflating: OPatch/opatch.bat
creating: OPatch/docs/
inflating: OPatch/docs/Prereq_Users_Guide.txt
inflating: OPatch/docs/FAQ
inflating: OPatch/docs/Users_Guide.txt
inflating: OPatch/README.txt

[oracle@RH4 ~]$ ls

1
2
3
4
5
6
7
8
10201_database_linux32.zipcr_cuug_db.sqldb01_hot_bak.sqllogmnrpatch.logsql.trc
10248636cr_db01_db.sqldbca.confOPatchREADME.htmlsql.txt
12879929cr_dict.sqlDesktopp10248636_10204_Linux-x86.ziprlwrap-0.30sunfile
1.rcvcuug_cold_bak.sqldictp12879929_1020411_Linux-x86.ziprlwrap-0.30.tar.gz
9119284cuug_hot_bak.sqlDisk1p6810189_10204_Linux-x86.ziprman.log
9352164datadrop.sqlp6880880_102000_LINUX.zipscott.txt
cold_bak_prod.sqldatabasedrop_tom.sqlp9119284_10204_Linux-x86.zipshow.rcv
cr_ctl.sqldb01_cold_bak.sqllog.bbdp9352164_1020404_Linux-x86.zipsqlnet.log

[oracle@RH4 ~]$ cd OPatch/

[oracle@RH4 OPatch]$ ls

crsdocsemdpatch.pljlibocmopatchopatch.batopatch.iniopatch.plopatchprereqsREADME.txt


----新版本的opatch


[oracle@RH4 9352164]$ /u01/app/oracle/product/10.2.0/db_1/OPatch/opatch version

1
2
3
4
Invoking OPatch 10.2.0.5.1
OPatch Version: 10.2.0.5.1
OPatch succeeded.
Visit http://www.oracle.com/support/policies.html for details.

-----通过新版本的opatch 安装PSU

[oracle@RH4 9352164]$ /home/oracle/OPatch/opatch apply

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Invoking OPatch 10.2.0.5.1
Oracle Interim Patch Installer version 10.2.0.5.1
Copyright (c) 2010, Oracle Corporation.All rights reserved.
Oracle Home: /u01/app/oracle/product/10.2.0/db_1
Central Inventory : /u01/app/oracle/oraInventory
from: /etc/oraInst.loc
OPatch version: 10.2.0.5.1
OUI version: 10.2.0.4.0
OUI location: /u01/app/oracle/product/10.2.0/db_1/oui
Log file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch2012-04-28_00-37-39AM.log
Patch history file: /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch_history.txt
ApplySession applying interim patch '9352164' to OH '/u01/app/oracle/product/10.2.0/db_1'
Running prerequisite checks...
Prerequisite check "CheckActiveFilesAndExecutables" failed.
The details are:
Following executables are active :
/u01/app/oracle/product/10.2.0/db_1/bin/oracle
ApplySession failed during prerequisite checks: Prerequisite check "CheckActiveFilesAndExecutables" failed.
System intact, OPatch will not attempt to restore the system
OPatch failed with error code 74

-------以上报错原因:因为数据库被open ,‘/u01/app/oracle/product/10.2.0/db_1/bin/oracle’被使用,将库关闭

1
2
3
4
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

----------拷贝opatch到oracle 目录下

[oracle@RH4 ~} cp -r OPatch$ORACLE_HOME/


---------安装10.2.0.4.4 的版本


[oracle@RH4 9352164]$ /u01/app/oracle/product/10.2.0/db_1/OPatch/opatch apply

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
Invoking OPatch 10.2.0.5.1
Oracle Interim Patch Installer version 10.2.0.5.1
Copyright (c) 2010, Oracle Corporation.All rights reserved.
Oracle Home: /u01/app/oracle/product/10.2.0/db_1
Central Inventory : /u01/app/oracle/oraInventory
from: /etc/oraInst.loc
OPatch version: 10.2.0.5.1
OUI version: 10.2.0.4.0
OUI location: /u01/app/oracle/product/10.2.0/db_1/oui
Log file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch2012-04-28_00-46-07AM.log
Patch history file: /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch_history.txt
ApplySession applying interim patch '9352164' to OH '/u01/app/oracle/product/10.2.0/db_1'
Running prerequisite checks...
Provide your email address to be informed of security issues, install and
initiate Oracle Configuration Manager. Easier for you if you use your My
Oracle Support Email address/User Name.
Email address/User Name:
You have not provided an email address for notification of security issues.
Do you wish to remain uninformed of security issues ([Y]es, [N]o) [N]:y
OPatch detected non-cluster Oracle Home from the inventory and will patch the local system only.
Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/u01/app/oracle/product/10.2.0/db_1')
Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files and inventory (not for auto-rollback) for the Oracle Home
Backing up files affected by the patch '9352164' for restore. This might take a while...
Execution of 'sh /home/oracle/9352164/custom/scripts/pre -apply 9352164 ':
Return Code = 0
Patching component oracle.sqlplus, 10.2.0.4.0...
Updating archive file "/u01/app/oracle/product/10.2.0/db_1/lib/libsqlplus.a"with "lib/libsqlplus.a/aficon.o"
Updating archive file "/u01/app/oracle/product/10.2.0/db_1/lib/libsqlplus.a"with "lib/libsqlplus.a/aficmx.o"
Running make for target iextjob
Running make for target iextjobo
Running make for target client_sharedlib
Running make for target idgmgrl
Running make for target ioracle
Running make for target client_sharedlib
Running make for target itnslsnr
Running make for target iwrap
Running make for target genplusso
ApplySession adding interim patch '9352164' to inventory
......
Verifying the update...
Inventory check OK: Patch ID 9352164 is registered in Oracle Home inventory with proper meta-data.
Files check OK: Files from Patch ID 9352164 are present in Oracle Home.
--------------------------------------------------------------------------------
********************************************************************************
********************************************************************************
**ATTENTION**
****
** Please note that the Patch Set Update Installation (PSU Deinstallation)**
** is not complete until all the Post Installation (Post Deinstallation)**
** instructions noted in the Readme accompanying this PSU, have been**
** successfully completed.**
****
********************************************************************************
********************************************************************************
--------------------------------------------------------------------------------
Execution of 'sh /home/oracle/9352164/custom/scripts/post -apply 9352164 ':
Return Code = 0
The local system has been patched and can be restarted.
OPatch succeeded

3、启动数据库,对数据字典升级


更新数据库,将修改过的SQL文件应用到数据库中,很多DBA在执行完上述安装命令以后就不再进行这一步,那么实际上PSU是没有完整安装的。


SQL> startup

1
2
3
4
5
6
7
8
ORACLE instance started.
Total System Global Area515899392 bytes
Fixed Size1268412 bytes
Variable Size234882372 bytes
Database Buffers276824064 bytes
Redo Buffers2924544 bytes
Database mounted.
Database opened.

SQL> @?/rdbms/admin/catbundle.sql psu apply

SQL> @?/rdbms/admin/utlrp.sql

1
2
3
4
5
6
7
8
9
10
11
12
13
14
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
 
SQL> startup upgrade
ORACLE instance started.
Total System Global Area515899392 bytes
Fixed Size1268412 bytes
Variable Size234882372 bytes
Database Buffers276824064 bytes
Redo Buffers2924544 bytes
Database mounted.
Database opened.

---重新编译CPU相关视图。该步骤在一个数据库上永远只需要执行一次,是为了完成在2008年1月份第一次发布CPU补丁时的后续工作,如果在安装以前的PSU或者CPU时执行过这个步骤那么就可以无

需再次执行,另外,即使不执行该步骤,数据库也是正常运行的,只不过意味着2008年1月份的 CPU补丁没有正常结束安装。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
sqlplus / as sysdba
SQL> @$ORACLE_HOME/cpu/view_recompile/recompile_precheck_jan2008cpu.sql
SQL> SHUTDOWN IMMEDIATE
SQL> STARTUP UPGRADE
SQL> @$ORACLE_HOME/cpu/view_recompile/view_recompile_jan2008cpu.sql
 
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
 
SQL> startup
ORACLE instance started.
Total System Global Area515899392 bytes
Fixed Size1268412 bytes
Variable Size234882372 bytes
Database Buffers276824064 bytes
Redo Buffers2924544 bytes
Database mounted.
Database opened.

4、验证PSU 版本


----验证已安装的PSU


[oracle@RH4 12879929]$ /u01/app/oracle/product/10.2.0/db_1/OPatch/opatchlsinventory -bugs_fixed | grep -i 'DATABASE PSU'

1
2
3
4
85761569352164Sat Apr 28 00:50:14 CST 2012DATABASE PSU 10.2.0.4.1 (INCLUDES CPUJUL2009)
88332809352164Sat Apr 28 00:50:14 CST 2012DATABASE PSU 10.2.0.4.2 (INCLUDES CPUOCT2009)
91192849352164Sat Apr 28 00:50:14 CST 2012DATABASE PSU 10.2.0.4.3 (INCLUDES CPUJAN2010)
93521649352164Sat Apr 28 00:50:14 CST 2012DATABASE PSU 10.2.0.4.4 (INCLUDES CPUAPR2010)


SQL> set linesize 120

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
SQL> select action,comments from registry$history
ACTIONCOMMENTS
------------------------------ --------------------------------------------------
UPGRADEUpgraded from 10.2.0.1.0
CPUview recompilation
APPLYPSU 10.2.0.4.4
3 rows selected.
 
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
 
SQL> startup
ORACLE instance started.
Total System Global Area515899392 bytes
Fixed Size1268412 bytes
Variable Size234882372 bytes
Database Buffers276824064 bytes
Redo Buffers2924544 bytes
Database mounted.
Database opened.
 
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
PL/SQL Release 10.2.0.4.0 - Production
CORE10.2.0.4.0Production
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
5 rows selected.
 
SQL> select action,comments from registry$history;
ACTIONCOMMENTS
------------------------------ --------------------------------------------------
UPGRADEUpgraded from 10.2.0.1.0
CPUview recompilation
APPLYPSU 10.2.0.4.4
3 rows selected.

------以上显示,PSU 已经升级到10.2.0.4.4










本文转自 客居天涯 51CTO博客,原文链接:http://blog.51cto.com/tiany/846725,如需转载请自行联系原作者

网友评论

登录后评论
0/500
评论
余二五
+ 关注