1. 패치 환경 설정
root 유저로 수행
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
2. OPatch 업데이트
root 유저로 수행
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.
root 유저로 수행
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.
3. 패치 현황 조사
grid와 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.
4. Response File 생성
grid 유저로 수행
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
5. 패치 분석
root 유저로 수행
$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.
6. 패치 적용
root 유저로 수행
$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.
7. Pluggable DB 기동
oracle 유저로 수행
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
8. Datapatch 적용
oracle 유저로 수행
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