버전 비교

  • 이 줄이 추가되었습니다.
  • 이 줄이 삭제되었습니다.
  • 서식이 변경되었습니다.

패치 환경 설정

코드 블럭
languagebash
titleroot 유저로 수행
linenumberstrue
export ORACLE_BASE=/u01/app/oracle
export GRID_HOME=$ORACLE_BASE/12.1.0/grid
export DB_HOME=$ORACLE_BASE/product/12.1.0/db_1
펼치기
서식 미적용
[root@oel6 ~]# export ORACLE_BASE=/u01/app/oracle
[root@oel6 ~]# export GRID_HOME=$ORACLE_BASE/12.1.0/grid
[root@oel6 ~]# export DB_HOME=$ORACLE_BASE/product/12.1.0/db_1

패치 작업은 root 유저로 진행됩니다.

수월한 작업을 위해 환경 변수를 먼저 설정합니다.

OPatch 업데이트

코드 블럭
languagebash
titleroot 유저로 수행
linenumberstrue
cd $GRID_HOME
OPatch/opatch version
mv OPatch OPatch.old
cp -r /media/sf_oracle/OPatch .
chown -R grid:oinstall OPatch
ll | grep OPatch
OPatch/opatch version
펼치기
서식 미적용
[root@oel6 ~]# cd $GRID_HOME

[root@oel6 grid]# OPatch/opatch version
OPatch Version: 12.1.0.1.3

OPatch succeeded.

[root@oel6 grid]# mv OPatch OPatch.old
 
[root@oel6 grid]# cp -r /media/sf_oracle/OPatch .

[root@oel6 grid]# chown -R grid:oinstall OPatch

[root@oel6 grid]# ll | grep OPatch
drwxr-x---. 10 grid oinstall  4096 2017-05-04 08:24 OPatch
drwxr-xr-x.  7 grid oinstall  4096 2017-05-03 22:01 OPatch.old

[root@oel6 grid]# OPatch/opatch version
OPatch Version: 12.1.0.1.10

OPatch succeeded.

먼저 OPatch 파일을 최신 버전으로 업데이트 합니다.

GI가 설치된 경로에 있는 파일을 먼저 업데이트 합니다.

코드 블럭
languagebash
titleroot 유저로 수행
linenumberstrue
cd $DB_HOME
mv OPatch OPatch.old
cp -r /media/sf_oracle/OPatch .
chown -R oracle:oinstall OPatch
OPatch/opatch version
펼치기
서식 미적용
[oracle@orcl ~]$ cd $DB_HOME

[oracle@orcl db_1]$ mv OPatch OPatch.old


[oracle@orcl db_1]$ cp -r /media/sf_oracle/OPatch .


[oracle@orcl db_1]$ chown -R oracle:oinstall OPatch


[oracle@orcl db_1]$ OPatch/opatch version
OPatch Version: 12.1.0.1.10

OPatch succeeded.

그리고 Database가 설치된 경로에 OPatch 파일도 최신 버전으로 업데이트 합니다.

반드시 GI와 Database 경로의 OPatch를 모두 업데이트 해줘야 합니다.

패치 현황 조사

코드 블럭
languagebash
titlegrid와 oracle 유저로 수행
opatch lsinventory
펼치기
서식 미적용
[grid@+ASM ~]$ opatch lsinventory

Oracle Interim 패치 설치 프로그램 버전 12.1.0.1.10
Copyright (c) 2017, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/12.1.0/grid
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/12.1.0/grid/oraInst.loc
OPatch version    : 12.1.0.1.10
OUI version       : 12.1.0.2.0
Log file location : /u01/app/oracle/12.1.0/grid/cfgtoollogs/opatch/opatch2017-05-04_08-30-24오전_1.log

Lsinventory Output file location : /u01/app/oracle/12.1.0/grid/cfgtoollogs/opatch/lsinv/lsinventory2017-05-04_08-30-24오전.txt

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

설치된 최상위 레벨 제품(1): 

Oracle Grid Infrastructure 12c                                       12.1.0.2.0
이 Oracle 홈에 1개의 제품이 설치되어 있습니다.


이 Oracle 홈에 설치된 Interim 패치가 없습니다.


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

OPatch succeeded.
서식 미적용
[oracle@orcl ~]$ opatch lsinventory

Oracle Interim 패치 설치 프로그램 버전 12.1.0.1.10
Copyright (c) 2017, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/product/12.1.0/db_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/12.1.0/db_1/oraInst.loc
OPatch version    : 12.1.0.1.10
OUI version       : 12.1.0.2.0
Log file location : /u01/app/oracle/product/12.1.0/db_1/cfgtoollogs/opatch/opatch2017-05-04_08-31-16오전_1.log

Lsinventory Output file location : /u01/app/oracle/product/12.1.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2017-05-04_08-31-16오전.txt

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

설치된 최상위 레벨 제품(1): 

Oracle Database 12c                                                  12.1.0.2.0
이 Oracle 홈에 1개의 제품이 설치되어 있습니다.


이 Oracle 홈에 설치된 Interim 패치가 없습니다.


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

OPatch succeeded.

패치 현황을 조사합니다.

기본적인 소프트웨어 설치만 진행한 상태라면 아무것도 패치되지 않은 것으로 나옵니다.

Response File 생성

코드 블럭
languagebash
titlegrid 유저로 수행
linenumberstrue
cd $GRID_HOME/OPatch/ocm/bin
./emocmrsp
펼치기
서식 미적용
[grid@+ASM ~]$ cd $GRID_HOME/OPatch/ocm/bin

[grid@+ASM bin]$ ./emocmrsp
OCM Installation Response Generator 10.3.7.0.0 - Production
Copyright (c) 2005, 2012, Oracle and/or its affiliates.  All rights reserved.

Provide your email address to be informed of security issues, install and
initiate Oracle Configuration Manager. Easier for you if you use your My
Oracle Support Email address/User Name.
Visit http://www.oracle.com/support/policies.html for details.
Email address/User Name: 

You have not provided an email address for notification of security issues.
Do you wish to remain uninformed of security issues ([Y]es, [N]o) [N]:  y
The OCM configuration response file (ocm.rsp) was successfully created.

[grid@+ASM bin]$ ls
emocmrsp  ocm.rsp

패치 작업에 필요한 response file을 생성합니다.

패치 분석

코드 블럭
languagebash
titleroot 유저로 수행
$GRID_HOME/OPatch/opatchauto apply /media/sf_oracle/25434003 -analyze
펼치기
서식 미적용
[root@oel6 ~]# $GRID_HOME/OPatch/opatchauto apply /media/sf_oracle/25434003 -analyze
OPatch Automation Tool
Copyright (c)2014, Oracle Corporation. All rights reserved.

OPatchauto Version : 12.1.0.1.10
OUI Version        : 12.1.0.2.0
Running from       : /u01/app/oracle/12.1.0/grid

opatchauto log file: /u01/app/oracle/12.1.0/grid/cfgtoollogs/opatchauto/25434003/opatch_gi_2017-05-04_09-53-57_analyze.log

NOTE: opatchauto is running in ANALYZE mode. There will be no change to your system.


OCM RSP file has been ignored in analyze mode. 

Parameter Validation: Successful

Configuration Validation: Successful

Patch Location: /media/sf_oracle/25434003
Grid Infrastructure Patch(es): 21436941 25171037 25363740 25363750 
DB Patch(es): 25171037 25363740 

Patch Validation: Successful
Grid Infrastructure home:
/u01/app/oracle/12.1.0/grid
DB home(s):
/u01/app/oracle/product/12.1.0/db_1


Analyzing patch(es) on "/u01/app/oracle/product/12.1.0/db_1" ...
Patch "/media/sf_oracle/25434003/25171037" successfully analyzed on "/u01/app/oracle/product/12.1.0/db_1" for apply.
Patch "/media/sf_oracle/25434003/25363740" successfully analyzed on "/u01/app/oracle/product/12.1.0/db_1" for apply.

Analyzing patch(es) on "/u01/app/oracle/12.1.0/grid" ...
Patch "/media/sf_oracle/25434003/21436941" successfully analyzed on "/u01/app/oracle/12.1.0/grid" for apply.
Patch "/media/sf_oracle/25434003/25171037" successfully analyzed on "/u01/app/oracle/12.1.0/grid" for apply.
Patch "/media/sf_oracle/25434003/25363740" successfully analyzed on "/u01/app/oracle/12.1.0/grid" for apply.
Patch "/media/sf_oracle/25434003/25363750" successfully analyzed on "/u01/app/oracle/12.1.0/grid" for apply.

[WARNING] The local database instance 'orcl' from '/u01/app/oracle/product/12.1.0/db_1' is not running. SQL changes, if any,  will not be analyzed. Please refer to the log file for more details.

Apply Summary:
Following patch(es) are successfully analyzed:
GI Home: /u01/app/oracle/12.1.0/grid: 21436941,25171037,25363740,25363750
DB Home: /u01/app/oracle/product/12.1.0/db_1: 25171037,25363740

opatchauto succeeded.

패치를 진행하기 전에 호환성이나 기존에 설치된 버전과 충돌되는 부분이 없는지 analyze해야 합니다.

검증이 모두 완료된 상태에서 실체 패치를 적용해야 합니다.

패치 적용

코드 블럭
languagebash
titleroot 유저로 수행
$GRID_HOME/OPatch/opatchauto apply /media/sf_oracle/25434003 -ocmrf $GRID_HOME/OPatch/ocm/bin/ocm.rsp
펼치기
서식 미적용
[root@oel6 ~]# $GRID_HOME/OPatch/opatchauto apply /media/sf_oracle/25434003 -ocmrf $GRID_HOME/OPatch/ocm/bin/ocm.rsp
OPatch Automation Tool
Copyright (c)2014, Oracle Corporation. All rights reserved.

OPatchauto Version : 12.1.0.1.10
OUI Version        : 12.1.0.2.0
Running from       : /u01/app/oracle/12.1.0/grid

opatchauto log file: /u01/app/oracle/12.1.0/grid/cfgtoollogs/opatchauto/25434003/opatch_gi_2017-05-04_09-59-21_deploy.log

Parameter Validation: Successful

Configuration Validation: Successful

Patch Location: /media/sf_oracle/25434003
Grid Infrastructure Patch(es): 21436941 25171037 25363740 25363750 
DB Patch(es): 25171037 25363740 

Patch Validation: Successful
Grid Infrastructure home:
/u01/app/oracle/12.1.0/grid
DB home(s):
/u01/app/oracle/product/12.1.0/db_1


Performing prepatch operations on SIDB Home (/u01/app/oracle/product/12.1.0/db_1) ... Successful
Following database(s) and/or service(s)  were stopped and will be restarted later during the session: orcl

Applying patch(es) to "/u01/app/oracle/product/12.1.0/db_1" ...
Patch "/media/sf_oracle/25434003/25171037" successfully applied to "/u01/app/oracle/product/12.1.0/db_1".
Patch "/media/sf_oracle/25434003/25363740" successfully applied to "/u01/app/oracle/product/12.1.0/db_1".

Performing prepatch operations on SIHA Home... Successful

Applying patch(es) to "/u01/app/oracle/12.1.0/grid" ...
Patch "/media/sf_oracle/25434003/21436941" successfully applied to "/u01/app/oracle/12.1.0/grid".
Patch "/media/sf_oracle/25434003/25171037" successfully applied to "/u01/app/oracle/12.1.0/grid".
Patch "/media/sf_oracle/25434003/25363740" successfully applied to "/u01/app/oracle/12.1.0/grid".
Patch "/media/sf_oracle/25434003/25363750" successfully applied to "/u01/app/oracle/12.1.0/grid".

Performing postpatch operations on SIHA Home... Successful

Performing postpatch operations on SIDB Home (/u01/app/oracle/product/12.1.0/db_1) ... Successful

[WARNING] The local database instance 'orcl' from '/u01/app/oracle/product/12.1.0/db_1' is not running. SQL changes, if any,  will not be applied. Please refer to the log file for more details.

Apply Summary:
Following patch(es) are successfully installed:
GI Home: /u01/app/oracle/12.1.0/grid: 21436941,25171037,25363740,25363750
DB Home: /u01/app/oracle/product/12.1.0/db_1: 25171037,25363740

opatchauto succeeded.

패치를 진행합니다.

기존에 생성한 response file을 사용하여 진행하며, 최신 OPatch를 사용하거나 일부 다른 OS에서는 response file 옵션이 생략되기도 합니다.

Pluggable DB 기동

코드 블럭
titleoracle 유저로 수행
linenumberstrue
sqlplus / as sysdba
select name, open_mode from v$pdbs;
alter pluggable database all open;
select name, open_mode from v$pdbs; 
펼치기
서식 미적용
[oracle@orcl ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Thu May 4 10:16:24 2017

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
and Real Application Testing options

SQL> select name, open_mode from v$pdbs;

NAME			               OPEN_MODE
------------------------------ ----------
PDB$SEED		               READ ONLY
PDB          			       MOUNTED

SQL> alter pluggable database all open;

Pluggable database altered.

SQL> select name, open_mode from v$pdbs;

NAME			               OPEN_MODE
------------------------------ ----------
PDB$SEED		               READ ONLY
PDB			                   READ WRITE

PDB가 모두 online으로 되어있지 않는 경우 datapatch 관련 WARNING이 패치 마지막 단계에 출력됩니다.

이 경우에는 수동으로 PDB를 모두 open 시켜주고, datapatch를 수동으로 적용하면 됩니다.

Datapatch 적용

코드 블럭
languagebash
titleoracle 유저로 수행
datapatch -verbose
펼치기
서식 미적용
[oracle@orcl ~]$ datapatch -verbose
SQL Patching tool version 12.1.0.2.0 Production on Thu May  4 10:21:32 2017
Copyright (c) 2012, 2016, Oracle.  All rights reserved.

Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_21583_2017_05_04_10_21_32/sqlpatch_invocation.log

Connecting to database...OK
Note:  Datapatch will only apply or rollback SQL fixes for PDBs
       that are in an open state, no patches will be applied to closed PDBs.
       Please refer to Note: Datapatch: Database 12c Post Patch SQL Automation
       (Doc ID 1585822.1)
Bootstrapping registry and package to current versions...done
Determining current state...done

Current state of SQL patches:
Bundle series PSU:
  ID 170418 in the binary registry and not installed in any PDB

Adding patches to installation queue and performing prereq checks...
Installation queue:
  For the following PDBs: CDB$ROOT PDB$SEED PDB
    Nothing to roll back
    The following patches will be applied:
      25171037 (DATABASE PATCH SET UPDATE 12.1.0.2.170418)

Installing patches...
Patch installation complete.  Total patches installed: 3

Validating logfiles...
Patch 25171037 apply (pdb CDB$ROOT): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/25171037/21099266/25171037_apply_ORCL_CDBROOT_2017May04_10_22_18.log (no errors)
Patch 25171037 apply (pdb PDB$SEED): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/25171037/21099266/25171037_apply_ORCL_PDBSEED_2017May04_10_22_47.log (no errors)
Patch 25171037 apply (pdb PDB): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/25171037/21099266/25171037_apply_ORCL_PDB_2017May04_10_22_46.log (no errors)
SQL Patching tool complete on Thu May  4 10:23:42 2017

datapatch 적용시 디버깅 목적으로 verbose 옵션을 적용하여 패치를 진행합니다.