1. 查看数据库当前版本:
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
2. 到My Oracle Support(网站查看与之对应CPU补丁包)并下载相应的补丁包
3. 解压补丁包,打开README文档 查看所需要的OPatch版本
通过如下命令查看本地主机的OPatch版本:
[oracle@localhost OPatch]$ cd /data/oracle/product/11.2.0/db_1/OPatch/
[oracle@localhost OPatch]$ ./opatch version
Invoking OPatch 11.1.0.6.6
OPatch Version: 11.1.0.6.6
OPatch succeeded.
[oracle@localhost OPatch]$ ./opatch version
Invoking OPatch 11.1.0.6.6
OPatch Version: 11.1.0.6.6
OPatch succeeded.
如果符合要求,继续进行,否则需要安装最新版本的Opatch(具体安装细节在README文档中可以找到相应的链接)
4. 将CPU补丁包拷贝到服务器并解压
5. 打包前准备工作
查看无效对象信息,方便与打包之后进行比较
col owner for a10
col object_name for a15
select owner,object_name,object_type,created,LAST_DDL_TIME,status
from dba_objects where status!='VALID'
order by owner,object_type,object_name;
/
col object_name for a15
select owner,object_name,object_type,created,LAST_DDL_TIME,status
from dba_objects where status!='VALID'
order by owner,object_type,object_name;
/
6. 关闭数据库
SQL> alter system checkpoint;
System altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
System altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
7. 开始打包
不要忘记设置环境变量:
PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin:
$ORACLE_HOME/OPatch; export PATH
[oracle@localhost 12419278]$ opatch napply -skip_subset -skip_duplicate
Invoking OPatch 11.1.0.6.6
Oracle Interim Patch Installer version 11.1.0.6.6
Copyright (c) 2009, Oracle Corporation. All rights reserved.
UTIL session
Oracle Home : /data/oracle/product/11.2.0/db_1
Central Inventory : /data/oraInventory
from : /etc/oraInst.loc
OPatch version : 11.1.0.6.6
OUI version : 11.2.0.1.0
OUI location : /data/oracle/product/11.2.0/db_1/oui
Log file location : /data/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2014-08-18_19-25-03PM.log
Patch history file: /data/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch_history.txt
Invoking utility "napply"
Invoking OPatch 11.1.0.6.6
Oracle Interim Patch Installer version 11.1.0.6.6
Copyright (c) 2009, Oracle Corporation. All rights reserved.
UTIL session
Oracle Home : /data/oracle/product/11.2.0/db_1
Central Inventory : /data/oraInventory
from : /etc/oraInst.loc
OPatch version : 11.1.0.6.6
OUI version : 11.2.0.1.0
OUI location : /data/oracle/product/11.2.0/db_1/oui
Log file location : /data/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2014-08-18_19-25-03PM.log
Patch history file: /data/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch_history.txt
Invoking utility "napply"
....
....
ke for target itnslsnr
The local system has been patched and can be restarted.
The local system has been patched and can be restarted.
8 启动数据库运行脚本 catbundle.sql, 将最新的CPU包信息注册到数据库
中
[oracle@localhost 12419278]$ cd /data/oracle/product/11.2.0/db_1/rdbms/admin/
[oracle@localhost admin]$ connme
SQL*Plus: Release 11.2.0.1.0 Production on Mon Aug 18 19:39:16 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.
Total System Global Area 849530880 bytes
Fixed Size 1339824 bytes
Variable Size 612372048 bytes
Database Buffers 230686720 bytes
Redo Buffers 5132288 bytes
Database mounted.
Database opened.
[oracle@localhost admin]$ connme
SQL*Plus: Release 11.2.0.1.0 Production on Mon Aug 18 19:39:16 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.
Total System Global Area 849530880 bytes
Fixed Size 1339824 bytes
Variable Size 612372048 bytes
Database Buffers 230686720 bytes
Redo Buffers 5132288 bytes
Database mounted.
Database opened.
SQL> select ACTION_TIME,ACTION,VERSION from dba_registry_history;
ACTION_TIME ACTION VERSION
---------------------------------------- -------------------- ------------------------------
18-AUG-14 07.42.36.020006 PM APPLY 11.2.0.1
ACTION_TIME ACTION VERSION
---------------------------------------- -------------------- ------------------------------
18-AUG-14 07.42.36.020006 PM APPLY 11.2.0.1
SQL> select ACTION,VERSION,COMMENTS from registry$history;
ACTION VERSION COMMENTS
-------------------- ------------------------------ ------------------------------------------------------------
APPLY 11.2.0.1 CPUJul2011
9 最后查看无效对象信息并与打包之前进行对比,如果有必要,重新编译新增无效对象
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/28719055/viewspace-1253722/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/28719055/viewspace-1253722/