본문 바로가기

Oracle/admin

Oracle CPU Patch for Linux

Step1.


-현재 상태 확인-
SQL> select instance_name,status from v$instance;



SQL> !lsnrctl status



SQL> !ps -ef |grep ora_



SQL> select owner,object_name,status from dba_objects where status = 'INVALID';

no rows selected




Step2.


-모든 서비스 중지 및 Oracle 폴더 백업-

SQL> shutdown immediate

SQL> !lsnrctl stop


SQL> !ps -ef|grep ora_



[oracle@localhost /]$ tar -cvf app.tar app





Step3.


-Opatch 버전확인 및 패치파일 다운-

Opatch 버전이 낮은경우 업그레이드(11.2.0.3.4 -> 11.2.3.12 로 업그레이드 함)

p6880880_112000_Linux-x86-64.zip   --> Opatch 상위버전 파일을 기존에 있던 Opatch 디렉토리를 move로 백업해두고

압축파일을 풀어 Opatch 디렉토리를 $ORACLE_HOME 경로에 옮긴다.


그후 Opatch 버전 확인 실행.


[oracle@localhost db_1]$ cd $ORACLE_HOME
[oracle@localhost db_1]$ cd OPatch/
[oracle@localhost OPatch]$ opatch version
OPatch Version: 11.2.0.3.12

OPatch succeeded.
[oracle@localhost OPatch]$ opatch lsinventory
Oracle Interim Patch Installer version 11.2.0.3.12
Copyright (c) 2016, Oracle Corporation.  All rights reserved.


Oracle Home       : /app/oracle/product/11.2.0/db_1
Central Inventory : /app/oraInventory
   from           : /app/oracle/product/11.2.0/db_1/oraInst.loc
OPatch version    : 11.2.0.3.12
OUI version       : 11.2.0.4.0
Log file location : /app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2016-05-11_17-14-33PM_1.log

Lsinventory Output file location : /app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2016-05-11_17-14-33PM.txt

--------------------------------------------------------------------------------
Local Machine Information::
Hostname: localhost
ARU platform id: 226
ARU platform description:: Linux x86-64

Installed Top-level Products (1):

Oracle Database 11g                                                  11.2.0.4.0
There are 1 products installed in this Oracle Home.


There are no Interim patches installed in this Oracle Home.


--------------------------------------------------------------------------------

OPatch succeeded.




Step4.(생략가능)


Path 추가

[oracle@localhost ~]$ vi .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs
stty erase ^H
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_BASE=/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_HOME_LISTNER=$ORACLE_HOME/bin/lsnrctl
export ORACLE_SID=ORCL
export TRACE=/app/oracle/diag/rdbms/orcl/ORCL/trace
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH




Step5.


CPU(Critical Patch Update) patch를 다운로드 후 패치실시 .


p21972320_112040_Linux-x86-64.zip



[oracle@localhost OPatch]$ unzip p21972320_112040_Linux-x86-64.zip



[oracle@localhost OPatch]$ cd 21972320/
[oracle@localhost 21972320]$ ls
17811429  18203837  19584068  20142975  21051840  21179898  22195441  22195477  22321756
17811438  18203838  19972564  20506715  21051852  21538558  22195448  22195485  patchmd.xml
17811447  19463893  19972566  20631274  21051858  21538567  22195457  22195492  README.html
18203835  19544839  19972568  21051833  21051862  21972320  22195465  22321741  README.txt


[oracle@localhost 21972320]$ opatch napply -skip_subset -skip_duplicate

.

.

.


OPatch found the word "warning" in the stderr of the make command.
Please look at this stderr. You can re-run this make command.
Stderr output:
ins_emagent.mk:113: warning: overriding commands for target `nmosudo'
ins_emagent.mk:52: warning: ignoring old commands for target `nmosudo'
/app/oracle/product/11.2.0/db_1/sysman/lib/ins_emagent.mk:113: warning: overriding commands for target `nmosudo'
/app/oracle/product/11.2.0/db_1/sysman/lib/ins_emagent.mk:52: warning: ignoring old commands for target `nmosudo'


OPatch found the word "warning" in the stderr of the make command.
Please look at this stderr. You can re-run this make command.
Stderr output:
ins_emagent.mk:113: warning: overriding commands for target `nmosudo'
ins_emagent.mk:52: warning: ignoring old commands for target `nmosudo'
/app/oracle/product/11.2.0/db_1/sysman/lib/ins_emagent.mk:113: warning: overriding commands for target `nmosudo'
/app/oracle/product/11.2.0/db_1/sysman/lib/ins_emagent.mk:52: warning: ignoring old commands for target `nmosudo'


Patches 17811429,17811438,17811447,18203835,18203837,18203838,19463893,19544839,19584068,19972564,19972566,19972568,20142975,20506715,20631274,21051833,21051840,21051852,21051858,21051862,21179898,21538558,21538567,21972320,22195441,22195448,22195457,22195465,22195477,22195485,22195492,22321741,22321756 successfully applied.
OPatch Session completed with warnings.
Log file location: /app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2016-05-11_17-26-02PM_1.log

OPatch completed with warnings.
[oracle@localhost 21972320]$


※ 경고와함께 완료되었는데 확인해보니 무시해도 되는 경고이므로 패스한다.

(참고

Step6.


패치확인

[oracle@localhost OPatch]$ opatch lsinventory



Step7.


Loading Modified SQL Files into the Database


[oracle@localhost ~]$ cd /app/oracle/product/11.2.0/db_1/rdbms/admin
[oracle@localhost admin]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Wed May 11 17:46:10 2016

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup



SQL> @catbundle.sql cpu apply

SQL> @utlrp.sql

SQL> select owner,object_name,status from dba_objects where status = 'INVALID';

no rows selected