기존에 모든 db가 정상적으로 떠 있는 상태에서 추가 패치작업이 필요 할때 간단 한듯 하지만 ,
문제 없이 잘 하려고 한다면. 아래 처럼 수행을 해 보시길 바랍니다.
퍠치는 ojvm 에 한정 되어 있으나 그 외 패치 작업시에도 비슷 할듯 하네요. 반드시 패치 README 를 읽어 보신 후 진행 하시깁 바랍니다.
tar cvf oracle_eng.tar ./app
==> 전 노드 모두 백업
[oracle@db19c1(DBRAC1):/db]srvctl stop instance -h
Stops the database instance.
Usage: srvctl stop instance {-node "<node_list>" | -db <db_unique_name> {-node "<node_list>" | -instance "<inst_name_list>"}} [-stopoption <stop_options>] [-drain_timeout <timeout>] [-force] [-failover] [-verbose]
-node "<node_list>" Comma separated node names
-db <db_unique_name> Unique name for the database
-instance "<inst,...>" Comma separated instance names
-stopoption <stop_options> Options to instance shutdown command (e.g. NORMAL, "TRANSACTIONAL LOCAL", IMMEDIATE, or ABORT)
-drain_timeout <drain_timeout> Service drain timeout specified in seconds
-force Forcibly stop the instance and any running services.
-failover Allow the running services to fail over to another instance
-verbose Verbose output
-help Print usage
[oracle@db19c1(DBRAC1):/db]srvctl start instance -h
Starts the database instance.
Usage: srvctl start instance {-node "<node_list>" | -db <db_unique_name> {-node <node_name> [-instance <inst_name>] | -node "<node_list>" | -instance "<inst_name_list>"}} [-startoption <start_options>]
-db <db_unique_name> Unique name for the database
-node "<node_list>" Comma separated node names
-instance "<inst,...>" Comma separated instance names
-startoption <start_options> Options to startup command (e.g. OPEN, MOUNT, or "READ ONLY")
-help Print usage
[oracle@db19c1(DBRAC1):/db]
[oracle@db19c1(DBRAC1):/db] srvctl stop instance -node db19c1
[oracle@db19c1(DBRAC1):/db]
[oracle@db19c1(DBRAC1):/db] srvctl start instance -node db19c1
starting database instances on nodes "db19c1" ...
started resources "ora.dbrac.db" on node "db19c1"
[oracle@db19c1(DBRAC1):/db]
[oracle@db19c1(DBRAC1):/db] srvctl stop instance -db DBRAC -node db19c1
[oracle@db19c1(DBRAC1):/db]
[oracle@db19c1(DBRAC1):/db] srvctl start instance -db DBRAC -node db19c1
[oracle@db19c1(DBRAC1):/db]
## --------------------------------------------------------------------------------
[oracle@db19c1(DBRAC1):/db]srvctl stop instance -db DBRAC -node db19c1
[oracle@db19c1(DBRAC1):/db]
[oracle@db19c1(DBRAC1):/db]cd /PATCH/
[oracle@db19c1(DBRAC1):/PATCH]ls -lart
total 8
drwxr-xr-x. 4 grid oinstall 67 Dec 5 22:10 30484981
drwxr-x---. 14 root root 4096 Dec 19 00:56 OPatch
drwxr-x---. 7 grid oinstall 143 Jan 7 13:22 30501910
drwxrwxrwx. 5 grid dba 52 Apr 16 14:13 .
dr-xr-xr-x. 21 root root 4096 Apr 20 12:35 ..
[oracle@db19c1(DBRAC1):/PATCH]cd 30484981
[oracle@db19c1(DBRAC1):/PATCH/30484981]id
uid=1000(oracle) gid=1010(oinstall) groups=1010(oinstall),1011(dba),1012(asmadmin),1013(asmdba),1014(asmoper),1015(oper) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[oracle@db19c1(DBRAC1):/PATCH/30484981]ls -lart
total 84
drwxr-x---. 5 grid oinstall 49 Dec 5 22:10 files
drwxr-xr-x. 4 grid oinstall 67 Dec 5 22:10 .
drwxr-x---. 3 grid oinstall 20 Dec 5 22:10 etc
-rw-r--r--. 1 grid oinstall 11 Dec 5 22:10 README.txt
-rw-rw-r--. 1 grid oinstall 80085 Jan 13 19:28 README.html
drwxrwxrwx. 5 grid dba 52 Apr 16 14:13 ..
[oracle@db19c1(DBRAC1):/PATCH/30484981]opatch apply -local
Oracle Interim Patch Installer version 12.2.0.1.19
Copyright (c) 2020, Oracle Corporation. All rights reserved.
Oracle Home : /db/app/product/dbhome
Central Inventory : /dg/app/oraInventory
from : /db/app/product/dbhome/oraInst.loc
OPatch version : 12.2.0.1.19
OUI version : 12.2.0.7.0
Log file location : /db/app/product/dbhome/cfgtoollogs/opatch/opatch2020-04-22_12-50-19PM_1.log
Verifying environment and performing prerequisite checks...
OPatch continues with these patches: 30484981
Do you want to proceed? [y|n]
y
User Responded with: Y
All checks passed.
Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/db/app/product/dbhome')
Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Applying interim patch '30484981' to OH '/db/app/product/dbhome'
Patching component oracle.javavm.server, 19.0.0.0.0...
Patching component oracle.javavm.server.core, 19.0.0.0.0...
Patching component oracle.rdbms.dbscripts, 19.0.0.0.0...
Patching component oracle.rdbms, 19.0.0.0.0...
Patch 30484981 successfully applied.
Log file location: /db/app/product/dbhome/cfgtoollogs/opatch/opatch2020-04-22_12-50-19PM_1.log
OPatch succeeded.
[oracle@db19c1(DBRAC1):/PATCH/30484981]
[oracle@db19c1(DBRAC1):/PATCH/30484981]srvctl stop instance -db DBRAC -node db19c2
[oracle@db19c1(DBRAC1):/PATCH/30484981]
## 2번 노드
[oracle@db19c2(DBRAC2):/PATCH]cd 30484981/
[oracle@db19c2(DBRAC2):/PATCH/30484981]ls -lart
total 84
drwxr-x---. 5 grid oinstall 49 Dec 5 22:10 files
drwxr-xr-x. 4 grid oinstall 67 Dec 5 22:10 .
drwxr-x---. 3 grid oinstall 20 Dec 5 22:10 etc
-rw-r--r--. 1 grid oinstall 11 Dec 5 22:10 README.txt
-rw-rw-r--. 1 grid oinstall 80085 Jan 13 19:28 README.html
drwxrwxrwx. 5 grid dba 75 Apr 16 14:12 ..
[oracle@db19c2(DBRAC2):/PATCH/30484981]
[oracle@db19c2(DBRAC2):/PATCH/30484981]opatch apply -local
Oracle Interim Patch Installer version 12.2.0.1.19
Copyright (c) 2020, Oracle Corporation. All rights reserved.
Oracle Home : /db/app/product/dbhome
Central Inventory : /dg/app/oraInventory
from : /db/app/product/dbhome/oraInst.loc
OPatch version : 12.2.0.1.19
OUI version : 12.2.0.7.0
Log file location : /db/app/product/dbhome/cfgtoollogs/opatch/opatch2020-04-22_12-56-15PM_1.log
Verifying environment and performing prerequisite checks...
OPatch continues with these patches: 30484981
Do you want to proceed? [y|n]
y
User Responded with: Y
All checks passed.
Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/db/app/product/dbhome')
Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Applying interim patch '30484981' to OH '/db/app/product/dbhome'
Patching component oracle.javavm.server, 19.0.0.0.0...
Patching component oracle.javavm.server.core, 19.0.0.0.0...
Patching component oracle.rdbms.dbscripts, 19.0.0.0.0...
Patching component oracle.rdbms, 19.0.0.0.0...
Patch 30484981 successfully applied.
Log file location: /db/app/product/dbhome/cfgtoollogs/opatch/opatch2020-04-22_12-56-15PM_1.log
OPatch succeeded.
[oracle@db19c2(DBRAC2):/PATCH/30484981]
[grid@db19c2(+ASM2):/dg] crsctl status res -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
ONLINE ONLINE db19c1 STABLE
ONLINE ONLINE db19c2 STABLE
ora.MGMT_DG.GHCHKPT.advm
OFFLINE OFFLINE db19c1 STABLE
OFFLINE OFFLINE db19c2 STABLE
ora.chad
ONLINE ONLINE db19c1 STABLE
ONLINE ONLINE db19c2 STABLE
ora.helper
OFFLINE OFFLINE db19c1 IDLE,STABLE
OFFLINE OFFLINE db19c2 IDLE,STABLE
ora.mgmt_dg.ghchkpt.acfs
OFFLINE OFFLINE db19c1 STABLE
OFFLINE OFFLINE db19c2 STABLE
ora.net1.network
ONLINE ONLINE db19c1 STABLE
ONLINE ONLINE db19c2 STABLE
ora.ons
ONLINE ONLINE db19c1 STABLE
ONLINE ONLINE db19c2 STABLE
ora.proxy_advm
OFFLINE OFFLINE db19c1 STABLE
OFFLINE OFFLINE db19c2 STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup)
1 ONLINE ONLINE db19c1 STABLE
2 ONLINE ONLINE db19c2 STABLE
3 ONLINE OFFLINE STABLE
ora.DATA_DG.dg(ora.asmgroup)
1 ONLINE ONLINE db19c1 STABLE
2 ONLINE ONLINE db19c2 STABLE
3 OFFLINE OFFLINE STABLE
ora.FRA_DG.dg(ora.asmgroup)
1 ONLINE ONLINE db19c1 STABLE
2 ONLINE ONLINE db19c2 STABLE
3 OFFLINE OFFLINE STABLE
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE db19c1 STABLE
ora.MGMTLSNR
1 ONLINE ONLINE db19c1 169.254.23.156 10.10
.20.55,STABLE
ora.MGMT_DG.dg(ora.asmgroup)
1 ONLINE ONLINE db19c1 STABLE
2 ONLINE ONLINE db19c2 STABLE
3 OFFLINE OFFLINE STABLE
ora.OCRVOT_DG.dg(ora.asmgroup)
1 ONLINE ONLINE db19c1 STABLE
2 ONLINE ONLINE db19c2 STABLE
3 OFFLINE OFFLINE STABLE
ora.asm(ora.asmgroup)
1 ONLINE ONLINE db19c1 Started,STABLE
2 ONLINE ONLINE db19c2 Started,STABLE
3 OFFLINE OFFLINE STABLE
ora.asmnet1.asmnetwork(ora.asmgroup)
1 ONLINE ONLINE db19c1 STABLE
2 ONLINE ONLINE db19c2 STABLE
3 OFFLINE OFFLINE STABLE
ora.cvu
1 ONLINE ONLINE db19c1 STABLE
ora.db19c1.vip
1 ONLINE ONLINE db19c1 STABLE
ora.db19c2.vip
1 ONLINE ONLINE db19c2 STABLE
ora.dbrac.db
1 OFFLINE OFFLINE Instance Shutdown,ST
ABLE
2 OFFLINE OFFLINE Instance Shutdown,ST
ABLE
ora.mgmtdb
1 ONLINE ONLINE db19c1 Open,STABLE
ora.qosmserver
1 ONLINE ONLINE db19c1 STABLE
ora.rhpserver
1 OFFLINE OFFLINE STABLE
ora.scan1.vip
1 ONLINE ONLINE db19c1 STABLE
--------------------------------------------------------------------------------
[grid@db19c2(+ASM2):/dg]
[oracle@db19c1(DBRAC1):/db/app/product/dbhome/OPatch]sqlplus
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Apr 22 13:30:10 2020
Version 19.6.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Enter user-name: /as sysdba
Connected to an idle instance.
SQL>
SQL> startup upgrade
ORACLE instance started.
Total System Global Area 3221222464 bytes
Fixed Size 8901696 bytes
Variable Size 704643072 bytes
Database Buffers 2499805184 bytes
Redo Buffers 7872512 bytes
Database mounted.
ORA-00603: ORACLE server session terminated by fatal error
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-39701: database must be mounted EXCLUSIVE for UPGRADE or DOWNGRADE
Process ID: 17311
Session ID: 1 Serial number: 48630
[oracle@db19c1(DBRAC1):/db/app/product/dbhome/OPatch]sqlplus
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Apr 22 13:40:53 2020
Version 19.6.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Enter user-name: /as sysdba
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 3221222464 bytes
Fixed Size 8901696 bytes
Variable Size 704643072 bytes
Database Buffers 2499805184 bytes
Redo Buffers 7872512 bytes
Database mounted.
SQL> alter system set cluster_database=false scope=spfile;
System altered.
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup upgrade
ORACLE instance started.
Total System Global Area 3221222464 bytes
Fixed Size 8901696 bytes
Variable Size 704643072 bytes
Database Buffers 2499805184 bytes
Redo Buffers 7872512 bytes
Database mounted.
Database opened.
SQL>
[oracle@db19c1(DBRAC1):/db/app/product/dbhome/OPatch]./datapatch -verbose
SQL Patching tool version 19.6.0.0.0 Production on Wed Apr 22 13:45:55 2020
Copyright (c) 2012, 2019, Oracle. All rights reserved.
Log file for this invocation: /db/app/cfgtoollogs/sqlpatch/sqlpatch_25853_2020_04_22_13_45_55/sqlpatch_invocation.log
Connecting to database...OK
Gathering database info...done
Bootstrapping registry and package to current versions...done
Determining current state...done
Current state of interim SQL patches:
Interim patch 30484981 (OJVM RELEASE UPDATE: 19.6.0.0.200114 (30484981)):
Binary registry: Installed
SQL registry: Not installed
Current state of release update SQL patches:
Binary registry:
19.6.0.0.0 Release_Update 191217155004: Installed
SQL registry:
Applied 19.6.0.0.0 Release_Update 191217155004 successfully on 21-APR-20 11.43.14.816850 AM
Adding patches to installation queue and performing prereq checks...done
Installation queue:
No interim patches need to be rolled back
No release update patches need to be installed
The following interim patches will be applied:
30484981 (OJVM RELEASE UPDATE: 19.6.0.0.200114 (30484981))
Installing patches...
Patch installation complete. Total patches installed: 1
Validating logfiles...done
Patch 30484981 apply: SUCCESS
logfile: /db/app/cfgtoollogs/sqlpatch/30484981/23248235/30484981_apply_DBRAC_2020Apr22_13_47_14.log (no errors)
SQL Patching tool complete on Wed Apr 22 13:50:32 2020
[oracle@db19c1(DBRAC1):/db/app/product/dbhome/OPatch]
[oracle@db19c1(DBRAC1):/db/app/product/dbhome/OPatch]sqlplus
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Apr 22 13:52:28 2020
Version 19.6.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Enter user-name: /as sysdba
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.6.0.0.0
SQL> alter system set cluster_database=true scope=spfile;
System altered.
SQL> SHUTDOWN
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> quit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.6.0.0.0
[oracle@db19c1(DBRAC1):/db/app/product/dbhome/OPatch]
[oracle@db19c1(DBRAC1):/db/app/product/dbhome/OPatch] srvctl start database -db DBRAC
[oracle@db19c1(DBRAC1):/db/app/product/dbhome/OPatch]
[oracle@db19c1(DBRAC1):/db/app/product/dbhome/OPatch]sqlplus
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Apr 22 14:04:02 2020
Version 19.6.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Enter user-name: /as sysdba
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.6.0.0.0
SQL>
SQL> @?/rdbms/admin/utlrp.sql
Session altered.
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN 2020-04-22 14:07:48
DOC> The following PL/SQL block invokes UTL_RECOMP to recompile invalid
DOC> objects in the database. Recompilation time is proportional to the
DOC> number of invalid objects in the database, so this command may take
DOC> a long time to execute on a database with a large number of invalid
DOC> objects.
DOC>
DOC> Use the following queries to track recompilation progress:
DOC>
DOC> 1. Query returning the number of invalid objects remaining. This
DOC> number should decrease with time.
DOC> SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);
DOC>
DOC> 2. Query returning the number of objects compiled so far. This number
DOC> should increase with time.
DOC> SELECT COUNT(*) FROM UTL_RECOMP_COMPILED;
DOC>
DOC> This script automatically chooses serial or parallel recompilation
DOC> based on the number of CPUs available (parameter cpu_count) multiplied
DOC> by the number of threads per CPU (parameter parallel_threads_per_cpu).
DOC> On RAC, this number is added across all RAC nodes.
DOC>
DOC> UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel
DOC> recompilation. Jobs are created without instance affinity so that they
DOC> can migrate across RAC nodes. Use the following queries to verify
DOC> whether UTL_RECOMP jobs are being created and run correctly:
DOC>
DOC> 1. Query showing jobs created by UTL_RECOMP
DOC> SELECT job_name FROM dba_scheduler_jobs
DOC> WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>
DOC> 2. Query showing UTL_RECOMP jobs that are running
DOC> SELECT job_name FROM dba_scheduler_running_jobs
DOC> WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>#
PL/SQL procedure successfully completed.
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_END 2020-04-22 14:08:42
DOC> The following query reports the number of invalid objects.
DOC>
DOC> If the number is higher than expected, please examine the error
DOC> messages reported with each object (using SHOW ERRORS) to see if they
DOC> point to system misconfiguration or resource constraints that must be
DOC> fixed before attempting to recompile these objects.
DOC>#
OBJECTS WITH ERRORS
-------------------
0
DOC> The following query reports the number of exceptions caught during
DOC> recompilation. If this number is non-zero, please query the error
DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors
DOC> are due to misconfiguration or resource constraints that must be
DOC> fixed before objects can compile successfully.
DOC> Note: Typical compilation errors (due to coding errors) are not
DOC> logged into this table: they go into DBA_ERRORS instead.
DOC>#
ERRORS DURING RECOMPILATION
---------------------------
0
Function created.
PL/SQL procedure successfully completed.
Function dropped.
PL/SQL procedure successfully completed.
SQL>
SQL> !opatch lsinventory | grep Patch
Oracle Interim Patch Installer version 12.2.0.1.19
OPatch version : 12.2.0.1.19
Patch 30484981 : applied on Wed Apr 22 12:51:17 KST 2020
Unique Patch ID: 23248235
Patch description: "OJVM RELEASE UPDATE: 19.6.0.0.200114 (30484981)"
Patch 30557433 : applied on Mon Apr 20 15:14:02 KST 2020
Unique Patch ID: 23305305
Patch description: "Database Release Update : 19.6.0.0.200114 (30557433)"
Patch 30489227 : applied on Mon Apr 20 15:09:29 KST 2020
Unique Patch ID: 23305624
Patch description: "OCW RELEASE UPDATE 19.6.0.0.0 (30489227)"
OPatch succeeded.
SQL>
[oracle@db19c2(DBRAC2):/PATCH/30501910]opatch lsinventory | grep Patch
Oracle Interim Patch Installer version 12.2.0.1.19
OPatch version : 12.2.0.1.19
Patch 30484981 : applied on Wed Apr 22 12:57:05 KST 2020
Unique Patch ID: 23248235
Patch description: "OJVM RELEASE UPDATE: 19.6.0.0.200114 (30484981)"
Patch 30557433 : applied on Mon Apr 20 16:34:50 KST 2020
Unique Patch ID: 23305305
Patch description: "Database Release Update : 19.6.0.0.200114 (30557433)"
Patch 30489227 : applied on Mon Apr 20 16:23:11 KST 2020
Unique Patch ID: 23305624
Patch description: "OCW RELEASE UPDATE 19.6.0.0.0 (30489227)"
OPatch succeeded.
[oracle@db19c2(DBRAC2):/PATCH/30501910]
아래 쿼리를 각각의 노드에서 수행 후 결과 확인도 잊지 말자
SELECT INSTANCE_NUMBER, INSTANCE_NAME, HOST_NAME, VERSION, VERSION_FULL, STATUS FROM V$INSTANCE;
SELECT PATCH_ID, PATCH_UID, PATCH_TYPE, STATUS, DESCRIPTION, SOURCE_VERSION, SOURCE_BUILD_DESCRIPTION , SOURCE_BUILD_TIMESTAMP, TARGET_VERSION, TARGET_BUILD_DESCRIPTION
FROM DBA_REGISTRY_SQLPATCH;
[oracle@db19c1(DBRAC1):/db/app/product/dbhome/OPatch]srvctl config database -db DBRAC -all
Database unique name: DBRAC
Database name: DBRAC
Oracle home: /db/app/product/dbhome
Oracle user: oracle
Spfile: +DATA_DG/DBRAC/PARAMETERFILE/spfile.268.1038311291
Password file: +DATA_DG/DBRAC/PASSWORD/pwddbrac.256.1038307069
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: DATA_DG,FRA_DG
Mount point paths:
Services:
Type: RAC
Start concurrency:
Stop concurrency:
Database is enabled
Database is individually enabled on nodes:
Database is individually disabled on nodes:
OSDBA group: dba
OSOPER group: dba
Database instances: DBRAC1,DBRAC2
Configured nodes: db19c1,db19c2
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services:
Database is administrator managed
[oracle@db19c1(DBRAC1):/db/app/product/dbhome/OPatch]