psu升级(本实验是将10.2.0.3.12升级到10.2.0.3.15)
一、解压安装包
自定义存放路径为/home/oracle/yjb/psu/10.2.0.3.15
cd /home/oracle/yjb/psu/10.2.0.3.15
unzip p6880880_112000_04-SEP-2015_Linux-x86-64.zip
unzip p20760997_112030_15_Linux-x86-64.zip -d 1120315
二、检查psu补丁是否有冲突
/home/oracle/yjb/psu/10.2.0.3.15/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /home/oracle/yjb/psu/10.2.0.3.15/1120315
三、信息收集
--查看组件信息
set linesize 500 pagesize 600
col COMP_NAME for a30
select COMP_ID,COMP_NAME,VERSION,STATUS from DBA_REGISTRY;
--查看补丁情况
set linesize 500 pagesize 600
col ACTION_TIME for a30
col COMMENTS for a30
select ACTION_TIME, ACTION, COMMENTS from sys.DBA_REGISTRY_HISTORY;
--查看无效对象
select count(*) from dba_objects where status<>'VALID';
四、停止数据库
--停止数据库外部进程
ps -ef|grep -v grep |grep LOCAL=NO|awk '{print $2}'|xargs kill -9
--停库
alter system checkpoint
shutdown immediate
--停监听
lsnrctl stop
--查看启停日志
/home/oracle/diag/rdbms/sccp/sccp/trace/alert*.log
五、备份
使用root用户备份oracle_home (将#ORACLE_HOME上级目录整个备份)
tar -zcvpf db_20151103.tar.gz db_1
六、打PSU
su - oracle
cd /home/oracle/yjb/psu/10.2.0.3.15/1120315/20760997 ---20760997为压缩包解压出的目录(不进入该目录apply会报错)
/home/oracle/yjb/psu/10.2.0.3.15/OPatch/opatch apply
----如果补丁过程中出现以下错误
OPatch报错 Prerequisite check "CheckActiveFilesAndExecutables" failed
Following executables are active :
/opt/oracle/product/10.2.0/bin/oracle
ApplySession failed during prerequisite checks: Prerequisite check "CheckActiveFilesAndExecutables" failed.
通过以下命令找到正在占用文件的进程,然后kill进程
fuser /opt/oracle/product/10.2.0/bin/oracle
七、检查数据库
su – oracle
$ORACLE_HOME/OPatch/opatch lsinv
八、更新数据字典、编译失效对象
su - oracle
cd $ORACLE_HOME/rdbms/admin
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle.sql psu apply
SQL> @utlrp.sql
九、重启数据库
shutdown immediate
startup
十、检查数据库状态
--查看组件信息
set linesize 500 pagesize 600
col COMP_NAME for a30
select COMP_ID,COMP_NAME,VERSION,STATUS from DBA_REGISTRY;
--查看补丁情况
set linesize 500 pagesize 600
col ACTION_TIME for a30
col COMMENTS for a30
select ACTION_TIME, ACTION, COMMENTS from sys.DBA_REGISTRY_HISTORY;
--查看无效对象
select count(*) from dba_objects where status<>'VALID';
十一、启动监听
lsnrctl start
ps -ef|grep -v grep |grep LOCAL=NO|wc -l
SQL> CONNECT / AS SYSDBA
SQL>alter system register;
若监听启动失败
cd $ORACLE_HOME/network/admin
mv sqlnet.ora sqlnet.orabak
lsnrctl start
ps -ef|grep -v grep |grep LOCAL=NO|wc -l
SQL> CONNECT / AS SYSDBA
SQL>alter system regiter
SQL>exit
mv sqlnet.orabak sqlnet.ora