opatch auto in windows db in 11.2.0.4

 



--prapare:

1.

确保环境变量中的PATH,jave_home.JAVA* 是正确的

确保java home 已经安装  C:\Program Files (x86)\Java\jdk1.7.**

2.
copy 192.168.63.83 D:\oracle_patch\1612 to 192.168.2.169 D:\oracle_patch\1612

cd D:\oracle_patch\1612
D:\app\Administrator\product\11.2.0\dbhome_1\OPatch\ocm\bin\emocmrsp.bat

set ORACLE_HOME=D:\app\Administrator\product\11.2.0\dbhome_1
set PATH=%ORACLE_HOME%\OPatch;%PATH%

mkdir db
mkdir ojvm
unzip p23530402_112040_MSWIN-x86-64.zip -d db
unzip p23515277_112040_MSWIN-x86-64.zip -d ojvm
unzip p6880880_112000_MSWIN-x86-64.zip -d %ORACLE_HOME%

D:\app\Administrator\product\11.2.0\dbhome_1\OPatch\ocm\bin\emocmrsp.bat
lsnrctl stop listener_testprd

sqlplus / as sysdba
shutdown immediate
exit

 

stop all oracle services

net stop msdtc

net stop winmgmt


--apply

kill process extjob.exe
kill process omtsreco.exe
kill process TNSLSNR.EXE

kill process  /vmtoolsd.exe/oravssw.exe 

kill process tree: dllhost.exe 

 

(issue windows : ddl 进程active in opatch

tasklist /m > tasks.txt

notepad tasks.txt

(check hold ddl process, and kill process following pid,根据进程号kill进程,不要kill 错了。)

)


opatch rollback -id 19799291 -ocmrf ocm.rsp
opatch rollback -id  19651773 -ocmrf ocm.rsp

opatch apply  -silent db\23530402 -ocmrf ocm.rsp
opatch apply   -silent  ojvm\23515277 -ocmrf ocm.rsp

 

sc config Winmgmt start= auto

net start msdtc

net start winmgmt

 


net start OracleServicetestPROD

set ORACLE_SID=testPROD

cd %ORACLE_HOME%\rdbms\admin
sqlplus /nolog
CONNECT / AS SYSDBA
STARTUP
@catbundle.sql PSU apply
QUIT
/


cd %ORACLE_HOME%\sqlpatch\23515277
sqlplus /nolog
CONNECT / AS SYSDBA
SHUTDOWN
STARTUP UPGRADE
@postinstall.sql
SHUTDOWN
STARTUP
QUIT
/


net start OracleOraDb11g_home1TNSListenerLISTENER_testPROD



--regress
opatch rollback -id 23530402 -ocmrf ocm.rsp
opatch rollback -id  23515277 -ocmrf ocm.rsp





--------------
windows : ddl 进程active in opatch
Workaround 2:
 -------------------
 When a specific dll is mentioned during installation:
 On Windows XP use the utility TASKLIST to list the currently opened files.
 When using TASKLIST with option /m, it will list all active processes with their opened files.

For example:
 1. tasklist /m > tasks.txt
 2. notepad tasks.txt
 3. Search for the specified dll in tasks.txt and identify the process.
 4. Stop the involved process or service. 停下oracle 进程

 


--------------
notepad
 -------------------
don't stop username=network-service  windows service .

重新启动主机需要15-20分钟。

 

 

---

notepad

opatch lsinventory -bugs_fixed|grep -i 'DATABASE PSU'
=select * from dba_registry_history;


sample 2:
rollback old and apply new


#####BEGIN
mkdir -p c:\app\software
mkdir -p c:\app\software\psu
mkdir -p c:\app\software\ojvm


xcopy \\tsclient\D\Mike\m\0509\补丁分析\11.2.0.4\* c:\app\software\ /D /E /Y /H /K

###
set ORACLE_HOME=c:\app\Administrator\product\11.2.0\dbhome_1
set PATH=%ORACLE_HOME%\OPatch;%PATH%
####
%ORACLE_HOME%\OPatch\ocm\bin\emocmrsp.bat
#####
####

cd c:\app\software\
unzip p26194138_112040_MSWIN-x86-64.zip -d .\psu
unzip p26182427_112040_MSWIN-x86-64.zip -d .\ojvm
unzip -o p6880880_112000_MSWIN-x86-64.zip -d %ORACLE_HOME%\

net stop msdtc
net stop winmgmt
net stop OracleServicetestUAT
net stop OracleServicetestDEV
net stop OracleOraDb11g_home1TNSListenerLISTENER_testuat
net stop OracleOraDb11g_home1TNSListenerLISTENER_testdev

opatch rollback -id 19799291 -silent
opatch rollback -id 19651773 -silent

--opatch rollback -id 25590979 -silent
--opatch rollback -id 25632525 -silent

opatch apply -silent psu\26194138 -ocmrf ocm.rsp
opatch apply -silent ojvm\26182425 -ocmrf ocm.rsp

 

###
net start OracleServicetestUAT
net start OracleServicetestDEV
set ORACLE_SID=testuat
###

cd %ORACLE_HOME%\rdbms\admin
sqlplus /nolog
CONNECT sys/oracle123 AS SYSDBA
STARTUP
@catbundle.sql PSU apply
QUIT
/


cd %ORACLE_HOME%\sqlpatch\26182425
sqlplus /nolog
CONNECT sys/oracle123 AS SYSDBA
SHUTDOWN
STARTUP UPGRADE
@postinstall.sql
SHUTDOWN
STARTUP
QUIT
/

 


###
set ORACLE_SID=testdev
###

cd %ORACLE_HOME%\rdbms\admin
sqlplus /nolog
CONNECT sys/oracle123 AS SYSDBA
STARTUP
@catbundle.sql PSU apply
QUIT
/


cd %ORACLE_HOME%\sqlpatch\26182425
sqlplus /nolog
CONNECT sys/oracle123 AS SYSDBA
SHUTDOWN
STARTUP UPGRADE
@postinstall.sql
SHUTDOWN
STARTUP
QUIT
/

###
start oracle service
net start OracleOraDb11g_home1TNSListenerLISTENER_testuat
net start OracleOraDb11g_home1TNSListenerLISTENER_testdev
sc config Winmgmt start= auto
net start msdtc
net start winmgmt
opatch lsinventory
####



SELECT * FROM dba_registry_history;  (11g or 10g)

select substr(action_time,1,30) action_time,substr(id,1,10) id,substr(action,1,10) action,substr(version,1,8) version,substr(BUNDLE_SERIES,1,6) bundle,substr(comments,1,20) comments from registry$history;  (11g)

set linesize 999

set pagesize 999 

SELECT patch_id,count(*),status FROM dba_registry_sqlpatch group by status,patch_id;   (12c)



posted @ 2016-12-12 17:20  feiyun8616  阅读(690)  评论(0编辑  收藏  举报