操作系统信息:Win server 2003 Enterprise Edition SP2
数据库版本:10g Enterprise Edition Release 10.2.0.4.0 - Production
CPU补丁版本:CPU July 2011
步骤如下:
1. 下载CPU补丁
可以从Oracle官方的”Critical Patch Updates and Security Alerts“ (http://www.oracle.com/technetwork/topics/security/alerts-086861.html) 页面查看2011年7月份的CPU补丁在Windows平台上对于的补丁号,再到metalink上下载。
2. 查看数据库信息
Normal
0
false
false
false
EN-US
ZH-CN
X-NONEset 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
SQL> spool precheck.log
SQL> select instance_name,status from v$instance;
SQL> select * from v$version;
SQL> select sum(bytes)/1024/1024||'M' from dba_segments;
SQL> select COMP_ID,COMP_NAME,VERSION,STATUS from DBA_REGISTRY;
SQL> select ACTION_TIME, ACTION, COMMENTS from sys.DBA_REGISTRY_HISTORY;
SQL> select count(*) from dba_objects where status<>'VALID';
SQL> select object_name,object_type,owner,status from dba_objects where status<>'VALID';
SQL> spool off
Normal
0
false
false
false
EN-US
ZH-CN
X-NONE3. 备份数据库
H:\CPUPatch>rman target /
RMAN> configure default device type to disk;
RMAN> configure controlfile autobackup on;
RMAN> configure controlfile autobackup format for device type disk to 'H:\INTEL_DB_DUMPS\O03LSE3\rman\cf_O03LSE3_%F';
RMAN> backup database format 'H:\INTEL_DB_DUMPS\O03LSE3\rman\O03LSE3_%s_%p_%T_%t.bak' tag before_CPUPatch;
4. 备份Oracle home
在备份Oracle home之前,除了确保所有和Oracle相关的服务、进程都已停止之外,还要确保服务Distributed Transaction Coordinator也已停止。
把oracle home整个目录拷贝至其它盘保存
5. 打CPU补丁(Oracle binary部分)
H:\CPUPatch>set oracle_home=G:\oracle\ora102
查看已经打过的补丁:
H:\CPUPatch>%ORACLE_HOME%\OPatch\opatch lsinventory
开始打补丁:
H:\CPUPatch>cd H:\CPUPatch\p12429519_10204_Win32\12429519
H:\CPUPatch\p12429519_10204_Win32\12429519>%ORACLE_HOME%\OPatch\opatch apply ---大概持续10分钟
补丁成功之后,再执行以下命令确认:
H:\CPUPatch>%ORACLE_HOME%\OPatch\opatch lsinventory
有可能会出现类似以下错误:
Prerequisite check "CheckActiveFilesAndExecutables" failed.
The details are:
Following files are active :
G:\oracle\ora102\bin\oraclient10.dll
G:\oracle\ora102\bin\orapls10.dll
G:\oracle\ora102\bin\oracommon10.dll
G:\oracle\ora102\bin\orageneric10.dll
G:\oracle\ora102\bin\oraplp10.dll
......................
这种错误是因为Oracle home中的某些dll还在被其它进程占用,无法被覆盖,解决方法可以参考()
我觉得最简便的方法是下载微软提供的一个小工具Process Explorer (),用这个工具查看这些dll是被哪些进程占用,然后手动杀掉这些进程即可。
6 打CPU补丁(数据库部分)
启动所有在第4步中停止的服务和进程。
cd /d %ORACLE_HOME%\BUNDLE\Patch45
sqlplus "/as sysdba"
SQL> @catcpu.sql
---大概持续30分钟至1小时
7. 重编译view
SQL> SELECT * FROM registry$history where ID = '6452863';
如果上面的语句有返回行数,则说明数据库之前已经重编译过view了,可略过此步骤。
如果没有返回,则:
Normal
0
false
false
false
EN-US
ZH-CN
X-NONESQL> SHUTDOWN IMMEDIATE
SQL> STARTUP UPGRADE
SQL> @?/cpu/view_recompile/view_recompile_jan2008cpu.sql
SQL> SHUTDOWN IMMEDIATE
8. 事后检查
重新编译无效对象:
@?/rdbms/admin/utlrp.sql
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
SQL> spool post_check.log
SQL> select instance_name,status from v$instance;
SQL> select COMP_ID,COMP_NAME,VERSION,STATUS from DBA_REGISTRY;
SQL> select ACTION_TIME, ACTION, COMMENTS from DBA_REGISTRY_HISTORY;
SQL> select owner,object_name,object_type,status from dba_objects where status<>'VALID';
SQL> select count(*) from dba_objects where status<>'VALID';
SQL> spool off
Normal
0
false
false
false
EN-US
ZH-CN
X-NONE
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26277071/viewspace-709550/,如需转载,请注明出处,否则将追究法律责任。