Opatch位置E:\upgrade--为何要升级OPatch,原因是oracle补丁包的readme文本里面会提示你,打该补丁opatch版本必须为多少以上,假如没达到要求,打补丁会失败
Patch 位置E:\upgrade\patch14\ 13460968
set ORACLE_SID=orcl
set ORACLE_HOME=E:\ORACLE\PRODUCT\10.2.0\DB_1
set PATH= E:\ORACLE\PRODUCT\10.2.0\DB_1\bin;E:\upgrade\OPatch;%PATH%
opatch lsinventory �Call
假如相应的进程没有停止,会导致打补丁直接失败!
--停监听、oem、isqlplus
lsnrctl status
lsnrctl stop
lsnrctl status
emctl status dbconsole
emctl stop dbconsole
emctl status dbconsole
isqlplusctl stop
--停止数据库
sqlplus / as sysdba
--查看opatch版本
opatch version
--查看已经安装的patch
opatch lsinventory -all
SQL>shutdown immdediate
-备份oracle软件与数据库(冷备)
确认没有oracle 相关进程运行
将所有oracle开头的服务都已停止以及Distributed Transaction Coordinator服务(需特别注意:否则会导致bundle无法覆盖文件,需要rollback、停掉剩余服务)
做oracle软件备份(包括%ORACLE_HOME%与C:\program files\oracle(即inventory目录))
备份windows注册表-->开始-->运行-->regedit-->导出
做数据库备份数据库冷备(包括所有数据文件,日志文件,控制文件)
升级数据库软件到10.2.0.5(ID: 8202632)
解压patch8202632之后,双击Disk1目录下的setup.exe
开启OracleServiceORCL服务
SQL>startup upgrade
SQL>@?\rdbms\admin\catupgrd.sql
SQL>@?\rdbms\admin\catalog.sql
SQL>@?\rdbms\admin\catproc.sql
SQL>@?\rdbms\admin\utlrp.sql
SQL>shutdown immediate
SQL>startup
--检查数据库是否正常(脚本)
set line 200 pagesize 9999
col comp_name for a30
col version for a15
col status for a10
col schema for a15
col object_name for a40
spool E:\upgrade\after_10205.log
select * from v$version;
select comp_name,version,status,schema from sys.dba_registry;
select owner,object_name,object_type,status from dba_objects where status='INVALID' ORDER BY 1,3,2;
select distinct status from v$datafile;
select distinct status from v$tempfile;
select * from v$recover_file;
spool off
打patch14(ID: 13460968)
确保oracle的进程服务关闭(含Distributed Transaction Coordinator服务)
1.打bundle
cd D:\upgrade\patch\13460968
opatch lsinventory
opatch apply
opatch lsinventory �Call
查看E:\ORACLE\PRODUCT\10.2.0\DB_1\cfgtoollogs\opatch目录的日志有没有报错
2.重新编译数字字典、对象
1)启动数据库
2)编译数据字典
cd %ORACLE_HOME%\Bundle\Patch14
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catcpu.sql
SQL> QUIT
3)编译无效对象
cd %ORACLE_HOME%\rdbms\admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> @utlrp.sql
4)验证无效对象
SQL> SELECT OBJECT_NAME FROM DBA_OBJECTS WHERE STATUS = 'INVALID';
oracle视频教程请关注: http://u.youku.com/user_video/id_UMzAzMjkxMjE2.html