반응형

1. 테스트 환경 확인

cat > make_all_orainfo.sh <<'EOF'
#!/bin/bash

# 공통 정보
echo "========================================"
echo "        Oracle/Grid OS Info Summary"
echo "========================================"
echo -n "Hostname     : "; hostname
echo -n "IP Address   : "; hostname -i
echo -n "OS Name      : "; grep -i pretty_name /etc/os-release | cut -d= -f2 | tr -d '"'
echo -n "Kernel Ver   : "; uname -r
echo "========================================"

# Grid Home 정보
if [[ -n "$GRID_HOME" ]]; then
  echo "[GRID_HOME: $GRID_HOME]"
  echo -n "GRID Version : "
  $GRID_HOME/bin/sqlplus -S / as sysdba <<EOQ | head -1
SET TIMING OFF
SET PAGESIZE 0
SET FEEDBACK OFF
SET VERIFY OFF
SET HEADING OFF
SET ECHO OFF
SELECT banner FROM v\$version WHERE rownum=1;
EXIT
EOQ
  echo "<GRID Patch Info>"
  su - grid -c "$GRID_HOME/OPatch/opatch lspatches"
  echo "----------------------------------------"
else
  echo "[GRID_HOME not set, skip grid info]"
fi

# Oracle Home 정보
if [[ -n "$DB_HOME" ]]; then
  echo "[DB_HOME: $DB_HOME]"
  echo -n "DB Version   : "
  $DB_HOME/bin/sqlplus -S / as sysdba <<EOQ | head -1
SET TIMING OFF
SET PAGESIZE 0
SET FEEDBACK OFF
SET VERIFY OFF
SET HEADING OFF
SET ECHO OFF
SELECT banner FROM v\$version WHERE rownum=1;
EXIT
EOQ
  echo "<DB Patch Info>"
  su - oracle -c "$DB_HOME/OPatch/opatch lspatches"
  echo "----------------------------------------"
else
  echo "[DB_HOME not set, skip DB info]"
fi

echo "========================================"
EOF

 

[CDB1:oracle@tdb02t][/home/oracle]$ sh make_all_orainfo.sh

 

========================================
        Oracle/Grid OS Info Summary
========================================
Hostname     : tdb02t
IP Address   : 192.168.0.61
OS Name      : Oracle Linux Server 7.9
Kernel Ver   : 5.4.17-2102.201.3.el7uek.x86_64
========================================
[GRID_HOME: /u01/app/19c/grid]
GRID Version : Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
<GRID Patch Info>
Password:
37461387;TOMCAT RELEASE UPDATE 19.0.0.0.0 (37461387)
37268031;OCW RELEASE UPDATE 19.26.0.0.0 (37268031)
37266638;ACFS RELEASE UPDATE 19.26.0.0.0 (37266638)
37260974;Database Release Update : 19.26.0.0.250121 (37260974)
36758186;DBWLM RELEASE UPDATE 19.0.0.0.0 (36758186)

OPatch succeeded.
----------------------------------------
[DB_HOME: /u01/app/oracle/product/19c/db_1]
DB Version   : Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
<DB Patch Info>
Password:
접속할 데이터베이스를 선택하세요:
1) ORCL
2) CDB1
3) CDB2
번호를 입력하세요 (1,2,3): 3
현재 ORACLE_SID: CDB2
CDB2 환경 설정 적용 중...
환경 설정 완료 : 현재 ORACLE_SID = CDB2
37268031;OCW RELEASE UPDATE 19.26.0.0.0 (37268031)
37260974;Database Release Update : 19.26.0.0.250121 (37260974)

OPatch succeeded.
----------------------------------------
========================================

 

2. 패치 다운로드 및 업로드

2-1. Grid 및 Oracle 19.3 버전 및 RU27 패치를 다운로드 및 업로드

<다운로드 url>

https://www.oracle.com/kr/database/technologies/oracle19c-linux-downloads.html



<다운로드 파일>

LINUX.X64_193000_grid_home.zip

LINUX.X64_193000_db_home.zip

 

--> grid os user로 접속한 후
LINUX.X64_193000_grid_home.zip 파일을 /home/grid 경로에 업로드

 

--> oracle os user로 접속한 후

LINUX.X64_193000_db_home.zip 파일을 /home/oracle 경로에 업로드

 

<패치 다운로드>

Assistant: Download Reference for Oracle Database/GI Update, Revision, PSU, SPU(CPU), Bundle Patches, Patchsets and Base Releases (Doc ID 2118136.2)

 

--> grid os user로 접속한 후
p37641958_190000_Linux-x86-64.zip 파일을 /tmp 경로에 업로드

[+ASM:grid@tdb02t][/tmp]$ chmod 775 /tmp/p37641958_190000_Linux-x86-64.zip

 

2-2. OPatch 최신 버전 다운로드 및 업로드

<공식문서>

How To Download And Install The Latest OPatch(6880880) Version (Doc ID 274526.1)

--> p6880880_190000_Linux-x86-64.zip 파일 다운로드

--> grid os user로 접속한 후

--> /tmp 경로에 업로드

 

3. 신규 GRID HOME 생성 및 GRID 엔진 설치 준비

 3-1. 새로운 GRID HOME 디렉토리 생성 (root os user)

[root@tdb02t][/root]$ echo $GRID_HOME
/u01/app/19c/grid

[root@tdb02t][/root]$ mkdir -p /u01/app/19cRU27/grid
[root@tdb02t][/root]$ chown -R grid:oinstall /u01/app/19cRU27/grid
[root@tdb02t][/root]$ chmod -R 775 /u01/app/19cRU27/grid

 

3-2. 새로운 GRID HOME에 대한 환경 변수 설정

[+ASM:grid@tdb02t][/home/grid]$ export OLDGRIDHOME=$GRID_HOME
[+ASM:grid@tdb02t][/home/grid]$ export NEWGRIDHOME=/u01/app/19cRU27/grid

 

 3-3. 19c의 기본 릴리즈인 19.3버전을 새로운 GRID HOME에 설치

[+ASM:grid@tdb02t][/u01/app/19cRU27/grid]$ echo $NEWGRIDHOME
/u01/app/19cRU27/grid
[+ASM:grid@tdb02t][/u01/app/19cRU27/grid]$ unzip /tmp/LINUX.X64_193000_grid_home.zip -d /u01/app/19cRU27/grid

 

 3-4. 최신 OPatch를 새로운 GRID HOME에 설치

[+ASM:grid@tdb02t][/u01/app/19cRU27/grid]$ mv /u01/app/19cRU27/grid/OPatch /u01/app/19cRU27/grid/OPatch.bak.19.3

 

[+ASM:grid@tdb02t][/u01/app/19cRU27/grid]$ echo $NEWGRIDHOME
/u01/app/19cRU27/grid

 

[+ASM:grid@tdb02t][/u01/app/19cRU27/grid]$ unzip /tmp/p6880880_190000_Linux-x86-64.zip -d /u01/app/19cRU27/grid

 

[+ASM:grid@tdb02t][/u01/app/19cRU27/grid/OPatch]$ /u01/app/19cRU27/grid/OPatch/opatch version
OPatch Version: 12.2.0.1.46

OPatch succeeded.

 

 

4. 새로운 GRID 엔진 설치

4-1. 새로운 GRID 설치 전 필수 구성 요소 확인

[+ASM:grid@tdb02t][/u01/app/19cRU27/grid]$ echo $NEWGRIDHOME
/u01/app/19cRU27/grid

[+ASM:grid@tdb02t][/u01/app/19cRU27/grid]$ export GRID_HOME=$NEWGRIDHOME
[+ASM:grid@tdb02t][/u01/app/19cRU27/grid]$ echo $GRID_HOME
/u01/app/19cRU27/grid



[+ASM:grid@tdb02t][/u01/app/19cRU27/grid]$ $GRID_HOME/gridSetup.sh -executePrereqs -silent



--> 아래 위치에 로그가 남음

[+ASM:grid@tdb02t][/u01/app/19cRU27/grid/cfgtoollogs/oui/GridSetupActions2025-06-29_08-46-35PM]$ ls -l /u01/app/19cRU27/grid/cfgtoollogs/oui/GridSetupActions2025-06-29_08-46-35PM
total 1820
-rw-r--r--. 1 grid oinstall       0 Jun 29 20:46 gridSetupActions2025-06-29_08-46-35PM.err
-rw-r--r--. 1 grid oinstall  156519 Jun 29 20:46 gridSetupActions2025-06-29_08-46-35PM.log
-rw-r--r--. 1 grid oinstall 1695664 Jun 29 20:46 gridSetupActions2025-06-29_08-46-35PM.out
-rw-r--r--. 1 grid oinstall     129 Jun 29 20:46 installerPatchActions_2025-06-29_08-46-35PM.log
-rw-r--r--. 1 grid oinstall      47 Jun 29 20:46 time2025-06-29_08-46-35PM.log

 

4-2. 19c RU27 패치 압축 풀기

[+ASM:grid@tdb02t][/home/grid]$ unzip /tmp/p37641958_190000_Linux-x86-64.zip -d /tmp/37641958
[+ASM:grid@tdb02t][/tmp]$ chmod -R 775 /tmp/37641958/



[+ASM:grid@tdb02t][/tmp]$ ls -al /tmp/37641958/
total 2760
drwxrwxr-x.  3 grid oinstall      45 Jun 29 22:35 .
drwxrwxrwt. 14 root root        4096 Jun 29 22:34 ..
drwxrwxr-x.  8 grid oinstall    4096 Apr 15 11:30 37641958
-rwxrwxr-x.  1 grid oinstall 2816591 Apr 17 01:26 PatchSearch.xml



--> 해당 패치 readme 파일 확인

Patch Number | Description                             | Applicable Homes
-------------|-----------------------------------------|--------------------------------------------------------------------------------------------------
37642901     | Database Release Update 19.27.0.0.250415| Only Oracle home for non-Oracle RAC setup. Both Oracle home and Grid home for Oracle RAC setup.
37654975     | OCW Release Update 19.27.0.0.250415     | Both Oracle home and Grid home.
37643161     | ACFS Release Update 19.27.0.0.250415    | Only Grid home.
37762426     | Tomcat Release Update 19.0.0.0.0        | Only Grid home.
36758186     | DBWLM Release Update 19.0.0.0.0         | Only Grid home.

 

4-3. 새로운 GRID 설치 (applyRU, applyoneoffs 적용)

--> 과거 기존 GRID 엔진을 설치했던 response file을 조회한 후 새로운 GRID 설치를 위한 response file을 생성함

[+ASM:grid@tdb02t][/home/grid]$ awk -F= 'NF && $1 !~ /^#/ && $2!=""' /home/grid/grid.rsp > /home/grid/grid_new.rsp
[+ASM:grid@tdb02t][/home/grid]$ cat /home/grid/grid_new.rsp
oracle.install.responseFileVersion=/oracle/install/rspfmt_crsinstall_response_schema_v19.0.0
INVENTORY_LOCATION=/u01/app/oraInventory
oracle.install.option=HA_CONFIG
ORACLE_BASE=/u01/app/oracle
oracle.install.asm.OSDBA=asmdba
oracle.install.asm.OSOPER=asmoper
oracle.install.asm.OSASM=asmadmin
oracle.install.crs.config.scanType=LOCAL_SCAN
oracle.install.crs.config.ClusterConfiguration=STANDALONE
oracle.install.crs.config.configureAsExtendedCluster=false
oracle.install.crs.config.gpnp.configureGNS=false
oracle.install.crs.config.autoConfigureClusterNodeVIP=false
oracle.install.crs.config.gpnp.gnsOption=CREATE_NEW_GNS
oracle.install.crs.configureGIMR=false
oracle.install.asm.configureGIMRDataDG=false
oracle.install.crs.config.sharedFileSystemStorage.ocrLocations=
oracle.install.crs.config.useIPMI=false
oracle.install.asm.diskGroup.name=DATA1
oracle.install.asm.diskGroup.redundancy=EXTERNAL
oracle.install.asm.diskGroup.AUSize=4
oracle.install.asm.diskGroup.disksWithFailureGroupNames=/dev/oracleasm/disks/DATA1_1,
oracle.install.asm.diskGroup.disks=/dev/oracleasm/disks/DATA1_1
oracle.install.asm.diskGroup.diskDiscoveryString=/dev/oracleasm/disks/
oracle.install.asm.gimrDG.AUSize=1
oracle.install.asm.configureAFD=false
oracle.install.crs.configureRHPS=false
oracle.install.crs.config.ignoreDownNodes=false
oracle.install.config.managementOption=NONE
oracle.install.config.omsPort=0
oracle.install.crs.rootconfig.executeRootScript=false
oracle.install.crs.rootconfig.configMethod=ROOT

--> oracle.install.crs.rootconfig.executeRootScript를 false로 수정 (새로운 GRID 엔진 설치 단계에서는 root.sh 실행시키지 말아야함)



[+ASM:grid@tdb02t][/home/grid]$ echo $ORACLE_BASE
/u01/app/oracle

[+ASM:grid@tdb02t][/home/grid]$ export ORA_INVENTORY=/u01/app/oraInventory
[+ASM:grid@tdb02t][/home/grid]$ echo $ORA_INVENTORY
/u01/app/oraInventory

[+ASM:grid@tdb02t][/home/grid]$ echo $GRID_HOME
/u01/app/19c/grid

[+ASM:grid@tdb02t][/home/grid]$ export NEWGRIDHOME=/u01/app/19cRU27/grid
[+ASM:grid@tdb02t][/home/grid]$ export GRID_HOME=$NEWGRIDHOME
[+ASM:grid@tdb02t][/home/grid]$ export ORACLE_HOME=$GRID_HOME

 

[+ASM:grid@tdb02t][/home/grid]$ echo $GRID_HOME
/u01/app/19cRU27/grid

[+ASM:grid@tdb02t][/home/grid]$ echo $ORACLE_HOME
/u01/app/19cRU27/grid



$ORACLE_HOME/gridSetup.sh -ignorePrereq -waitforcompletion -silent \
   -applyRU /tmp/37641958/37641958/37654975 \
   -applyOneOffs /tmp/37641958/37641958/37642901,/tmp/37641958/37641958/37643161,/tmp/37641958/37641958/37762426,/tmp/37641958/37641958/36758186 \
   -responseFile /home/grid/grid_new.rsp \
   oracle.install.option=CRS_SWONLY \
   oracle.install.crs.rootconfig.executeRootScript=false



Preparing the home to patch...
Applying the patch /tmp/37641958/37641958/37654975...
Successfully applied the patch.
Applying the patch /tmp/37641958/37641958/37642901...
Successfully applied the patch.
Applying the patch /tmp/37641958/37641958/37643161...
Successfully applied the patch.
Applying the patch /tmp/37641958/37641958/37762426...
Successfully applied the patch.
Applying the patch /tmp/37641958/37641958/36758186...
Successfully applied the patch.
  
Launching Oracle Grid Infrastructure Setup Wizard...

The response file for this session can be found at:
 /u01/app/19cRU27/grid/install/response/grid_2025-06-29_10-04-21PM.rsp

You can find the log of this install session at:
 /u01/app/oraInventory/logs/GridSetupActions2025-06-29_10-04-21PM/gridSetupActions2025-06-29_10-04-21PM.log

As a root user, execute the following script(s):
        1. /u01/app/19cRU27/grid/root.sh

Execute /u01/app/19cRU27/grid/root.sh on the following nodes:
[tdb02t]


Successfully Setup Software.
To configure Grid Infrastructure for a Cluster or Grid Infrastructure for a Stand-Alone Server execute the following command as grid user:
 /u01/app/19cRU27/grid/gridSetup.sh
This command launches the Grid Infrastructure Setup Wizard. The wizard also supports silent operation, and the parameters can be passed through the response file that is available in the installation media.

--> 이 단계에서 root.sh 를 실행하지 말아야함

 

5. 새로운 ORACLE 엔진 설치

5-1. 새로운 ORACLE Home 디렉토리 생성

[CDB1:oracle@tdb02t][/home/oracle]$ echo $ORACLE_HOME
/u01/app/oracle/product/19c/db_1
[CDB1:oracle@tdb02t][/home/oracle]$ mkdir -p /u01/app/oracle/product/19cRU27/db_1

 

5-2. 새로운 ORACLE HOME에 19.3 엔진 파일 압축해제

[CDB1:oracle@tdb02t][/home/oracle]$ export NEWORACLEHOME=/u01/app/oracle/product/19cRU27/db_1

[CDB1:oracle@tdb02t][/home/oracle]$ unzip /home/oracle/LINUX.X64_193000_db_home.zip -d $NEWORACLEHOME

 

5-3. 최신 Opatch 백업 및 설치

[CDB1:oracle@tdb02t][/home/oracle]$ mv $NEWORACLEHOME/OPatch $NEWORACLEHOME/OPatch.bak.19.3

 

[CDB1:oracle@tdb02t][/home/oracle]$ unzip /tmp/p6880880_190000_Linux-x86-64.zip -d $NEWORACLEHOME

 

[CDB1:oracle@tdb02t][/home/oracle]$ $NEWORACLEHOME/OPatch/opatch version
OPatch Version: 12.2.0.1.46

OPatch succeeded.

 

5-4. 새로운 ORACLE Home의 엔진 설치

[CDB1:oracle@tdb02t][/home/oracle]$ echo $ORACLE_BASE
/u01/app/oracle

 

[CDB1:oracle@tdb02t][/home/oracle]$ echo $ORA_INVENTORY

[CDB1:oracle@tdb02t][/home/oracle]$ export ORA_INVENTORY=/u01/app/oraInventory
[CDB1:oracle@tdb02t][/home/oracle]$ echo $ORA_INVENTORY
/u01/app/oraInventory

 

[CDB1:oracle@tdb02t][/home/oracle]$ export OLD_ORACLE_HOME=$ORACLE_HOME
[CDB1:oracle@tdb02t][/home/oracle]$ echo $ORACLE_HOME
/u01/app/oracle/product/19c/db_1

 

[CDB1:oracle@tdb02t][/home/oracle]$ echo $OLD_ORACLE_HOME
/u01/app/oracle/product/19c/db_1

 

[CDB1:oracle@tdb02t][/home/oracle]$ echo $NEWORACLEHOME
/u01/app/oracle/product/19cRU27/db_1

 

[CDB1:oracle@tdb02t][/home/oracle]$ export ORACLE_HOME=$NEWORACLEHOME
[CDB1:oracle@tdb02t][/home/oracle]$ echo $ORACLE_HOME
/u01/app/oracle/product/19cRU27/db_1

 

--> 과거에 설치했던 response file을 기준으로 새로운 reponse file 을 생성함

[CDB1:oracle@tdb02t][/home/oracle]$ awk -F= 'NF && $1 !~ /^#/ && $2!=""' /home/oracle/db.rsp > /home/oracle/db_new.rsp

 

[CDB1:oracle@tdb02t][/home/oracle]$ cat /home/oracle/db_new.rsp
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v19.0.0
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSOPER_GROUP=oper
oracle.install.db.OSBACKUPDBA_GROUP=backupdba
oracle.install.db.OSDGDBA_GROUP=dgdba
oracle.install.db.OSKMDBA_GROUP=kmdba
oracle.install.db.OSRACDBA_GROUP=racdba
oracle.install.db.rootconfig.executeRootScript=false
oracle.install.db.rootconfig.configMethod=ROOT
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.ConfigureAsContainerDB=false
oracle.install.db.config.starterdb.memoryOption=false
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.managementOption=DEFAULT
oracle.install.db.config.starterdb.omsPort=0
oracle.install.db.config.starterdb.enableRecovery=false

--> oracle.install.db.rootconfig.executeRootScript 을 false로 변경

 

$ORACLE_HOME/runInstaller -ignorePrereqFailure -waitforcompletion -silent \
     -applyRU /tmp/37641958/37641958/37642901 \
     -applyOneOffs /tmp/37641958/37641958/37654975 \
     -responseFile /home/oracle/db_new.rsp \
     oracle.install.db.rootconfig.executeRootScript=false

 

 

Preparing the home to patch...
Applying the patch /tmp/37641958/37641958/37642901...
Successfully applied the patch.
Applying the patch /tmp/37641958/37641958/37654975...
Successfully applied the patch.
The log can be found at: /u01/app/oraInventory/logs/InstallActions2025-06-29_10-58-30PM/installerPatchActions_2025-06-29_10-58-30PM.log
Launching Oracle Database Setup Wizard...

The response file for this session can be found at:
 /u01/app/oracle/product/19cRU27/db_1/install/response/db_2025-06-29_10-58-30PM.rsp

You can find the log of this install session at:
 /u01/app/oraInventory/logs/InstallActions2025-06-29_10-58-30PM/installActions2025-06-29_10-58-30PM.log

As a root user, execute the following script(s):
        1. /u01/app/oracle/product/19cRU27/db_1/root.sh

Execute /u01/app/oracle/product/19cRU27/db_1/root.sh on the following nodes:
[tdb02t]


Successfully Setup Software.

 

--> root os user로 로그인 한 후 root.sh 실행

[root@tdb02t][/root]$ /u01/app/oracle/product/19cRU27/db_1/root.sh
Check /u01/app/oracle/product/19cRU27/db_1/install/root_tdb02t_2025-06-29_23-13-21-935816983.log for the output of root script

 

[root@tdb02t][/root]$ cat /u01/app/oracle/product/19cRU27/db_1/install/root_tdb02t_2025-06-29_23-13-21-935816983.log
Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/19cRU27/db_1
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
[root@tdb02t][/root]$

 

6. 새롭게 설치한 엔진으로 설정

6-1. 기존 DB의 ORACLE Home 경로를 새로운 ORACLE Home 엔진의 경로로 변경

--> 기존의 ORACLE Home 엔진으로 설정해야함

[CDB1:oracle@tdb02t][/home/oracle]$ echo $OLD_ORACLE_HOME
/u01/app/oracle/product/19c/db_1

 

[CDB1:oracle@tdb02t][/home/oracle]$ export ORACLE_HOME=$OLD_ORACLE_HOME
[CDB1:oracle@tdb02t][/home/oracle]$ echo $ORACLE_HOME
/u01/app/oracle/product/19c/db_1

 

--> spfile 및 orapwd 파일 확인

[CDB1:oracle@tdb02t][/home/oracle]$ srvctl config database -db $ORACLE_UNQNAME | grep file
Spfile: +DATA1/CDB1/PARAMETERFILE/spfile.277.1195332755
Password file:

 

 

[CDB1:oracle@tdb02t][/u01/app/oracle/product/19c/db_1/dbs]$ cp /u01/app/oracle/product/19c/db_1/dbs/orapwCDB1 /u01/app/oracle/product/19cRU27/db_1/dbs/orapwCDB1

 

[CDB1:oracle@tdb02t][/u01/app/oracle/product/19c/db_1/network/admin]$ cp /u01/app/oracle/product/19c/db_1/network/admin/tnsnames.ora /u01/app/oracle/product/19cRU27/db_1/network/admin/tnsnames.ora

 

[CDB1:oracle@tdb02t][/u01/app/oracle/product/19c/db_1/network/admin]$ cp /u01/app/oracle/product/19c/db_1/network/admin/sqlnet.ora /u01/app/oracle/product/19cRU27/db_1/network/admin/sqlnet.ora

 

[CDB1:oracle@tdb02t][/u01/app/oracle/product/19cRU27/db_1/sqlplus/admin]$ cp /u01/app/oracle/product/19c/db_1/sqlplus/admin/glogin.sql /u01/app/oracle/product/19cRU27/db_1/sqlplus/admin/glogin.sql

 

--> 기존 ORACLE Home 디렉토리를 새로운 Oracle HOme 디렉토리로 변경함

[CDB1:oracle@tdb02t][/u01/app/oracle/product/19c/db_1/network/admin]$ srvctl modify database -d $ORACLE_UNQNAME -o $NEWORACLEHOME


6-2. 기존의 GRID 엔진을 새롭게 설치한 GRID 엔진으로 변경

[root@tdb02t][/u01/app/19cRU27/grid]$ export ORACLE_HOME=/u01/app/19cRU27/grid

[root@tdb02t][/u01/app/19cRU27/grid]$ $ORACLE_HOME/rdbms/install/rootadd_rdbms.sh
[root@tdb02t][/u01/app/19cRU27/grid]$ $ORACLE_HOME/crs/install/roothas.sh -prepatch -dstcrshome $ORACLE_HOME

Using configuration parameter file: /u01/app/19cRU27/grid/crs/install/crsconfig_params
The log of current session can be found at:
  /u01/app/oracle/crsdata/tdb02t/crsconfig/hapatch_2025-06-29_11-23-17PM.log
2025/06/29 23:23:27 CLSRSC-347: Successfully unlock /u01/app/19cRU27/grid
2025/06/29 23:23:27 CLSRSC-671: Pre-patch steps for patching GI home successfully completed.

 

--> 이 명령어 치는 순간 (아래 명령어) DB가 중지되고 다시 기동되면서 새로운 홈에서 시작하게 됨
[root@tdb02t][/u01/app/19cRU27/grid]$ $ORACLE_HOME/crs/install/roothas.sh -postpatch -dstcrshome $ORACLE_HOME
Using configuration parameter file: /u01/app/19cRU27/grid/crs/install/crsconfig_params
The log of current session can be found at:
  /u01/app/oracle/crsdata/tdb02t/crsconfig/hapatch_2025-06-29_11-25-02PM.log
2025/06/29 23:25:48 CLSRSC-329: Replacing Clusterware entries in file 'oracle-ohasd.service'
2025/06/29 23:27:23 CLSRSC-672: Post-patch steps for patching GI home successfully completed.

 

[+ASM:grid@tdb02t][/tmp]$ /u01/app/19cRU27/grid/oui/bin/runInstaller -updateNodeList ORACLE_HOME=/u01/app/19cRU27/grid CRS=TRUE
Starting Oracle Universal Installer...

Checking swap space: must be greater than 500 MB.   Actual 32010 MB    Passed
The inventory pointer is located at /etc/oraInst.loc

 

[+ASM:grid@tdb02t][/tmp]$ /u01/app/19c/grid/oui/bin/runInstaller -updateNodeList ORACLE_HOME=/u01/app/19c/grid CRS=FALSE
Starting Oracle Universal Installer...

Checking swap space: must be greater than 500 MB.   Actual 32010 MB    Passed
The inventory pointer is located at /etc/oraInst.loc

 

7. root/grid/oracle 유저의 .bash_profile 수정

7-1. root os user의 .bash_profile 수정

[root@tdb02t][/root]$ vi .bash_profile

[root@tdb02t][/root]$ cat .bash_profile
# .bash_profile

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

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
set -o vi
export PS1='[\u@\h][$PWD]$ '
stty erase ^H

export ORACLE_BASE=/u01/app/oracle
export GRID_HOME=/u01/app/19cRU27/grid
export DB_HOME=$ORACLE_BASE/product/19cRU27/db_1
export BASE_PATH=/usr/sbin:$PATH
export PATH=$GRID_HOME/bin:$BASE_PATH

alias csrt='crsctl stat res -t'

 

7-2. grid os user의 .bash_profile 수정

[root@tdb02t][/root]$ vi ~grid/.bash_profile

[root@tdb02t][/root]$ cat ~grid/.bash_profile
# .bash_profile

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

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH
export TMP=/tmp
export TMPDIR=$TMP
export EDITOR=vi
export ORACLE_HOSTNAME=tdb02t
export ORACLE_UNQNAME=+ASM
export ORACLE_UNQNAME_LOWER=+asm
export ORACLE_BASE=/u01/app/oracle
export GRID_HOME=/u01/app/19cRU27/grid
export DB_HOME=$ORACLE_BASE/product/19cRU27/db_1
export ORACLE_HOME=$GRID_HOME
export ORACLE_SID=+ASM
export ORACLE_SID_LOWER=+asm
export ORACLE_USER_ORACLE_SID=CDB1
export ORACLE_USER_ORACLE_SID_LOWEWR=cdb1
export ORACLE_TERM=xterm
export BASE_PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$GRID_HOME/bin:$BASE_PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export NLS_LANG=AMERICAN_KOREA.AL32UTF8
export NLS_DATE_FORMAT='YYYY-MM-DD:HH24:MI:SS'
export PS1='[$ORACLE_SID:\u@\h][$PWD]$ '
alias ss='rlwrap sqlplus "/as sysdba"'
alias sa='rlwrap sqlplus "/as sysasm"'
alias cdt='cd $ORACLE_HOME/network/admin'
alias cdb='cd $ORACLE_BASE'
alias cdo='cd $ORACLE_HOME'
alias cdod='cd $ORACLE_HOME/dbs'
alias alog='tail -f $ORACLE_BASE/diag/asm/$ORACLE_UNQNAME_LOWER/$ORACLE_SID/trace/alert_$ORACLE_SID.log'
alias valog='vi -R $ORACLE_BASE/diag/asm/$ORACLE_UNQNAME_LOWER/$ORACLE_SID/trace/alert_$ORACLE_SID.log'
alias llog='tail -f $ORACLE_BASE/diag/tnslsnr/`hostname`/listener/trace/listener.log'
alias vllog='vi -R $ORACLE_BASE/diag/tnslsnr/`hostname`/listener/trace/listener.log'
alias crslog='tail -f $ORACLE_BASE/diag/crs/`hostname`/crs/trace/alert.log'
alias vcrslog='vi -R $ORACLE_BASE/diag/crs/`hostname`/crs/trace/alert.log'
#alias cdord='cd $ORACLE_BASE/oradata/$ORACLE_SID' #for FileSystem
alias cdoss='cd /home/grid/os_scripts'
alias csrt='crsctl stat res -t'
set -o vi
stty erase ^H
stty erase ^?

 

7-3. oracle os user의 .bash_profile 수정

[root@tdb02t][/root]$ vi ~oracle/.bash_profile

[root@tdb02t][/root]$ cat ~oracle/.bash_profile
# .bash_profile

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

# User specific environment and startup programs

stty erase $(tput kbs)
. /home/oracle/os_scripts/oenv.sh


PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH
export TMP=/tmp
export TMPDIR=$TMP
export EDITOR=vi
export ORACLE_HOSTNAME=tdb02t
export ORACLE_BASE=/u01/app/oracle
export GRID_HOME=/u01/app/19cRU27/grid
export DB_HOME=$ORACLE_BASE/product/19cRU27/db_1
export ORACLE_HOME=$DB_HOME
#export ORACLE_PDB_SID=PDB1
#export ORACLE_PDB_SID_LOWER=pdb1
export ORACLE_TERM=xterm
export BASE_PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$GRID_HOME/bin:$BASE_PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export NLS_LANG=AMERICAN_KOREA.AL32UTF8
export NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'
export PS1='[$ORACLE_SID:\u@\h][$PWD]$ '
alias ss='rlwrap sqlplus "/as sysdba"'
alias st='rlwrap sqlplus tuner/oracle'
alias ssc1p1='rlwrap sqlplus sys@CDB1_PDB1 as sysdba'
alias ssc2p1='rlwrap sqlplus sys@CDB2_PDB1 as sysdba'
alias stc1p1='rlwrap sqlplus sys/oracle@CDB1_PDB1'
alias stc2p1='rlwrap sqlplus sys/oracle@CDB2_PDB1'
alias cdt='cd $ORACLE_HOME/network/admin'
alias cdb='cd $ORACLE_BASE'
alias cdo='cd $ORACLE_HOME'
alias cdod='cd $ORACLE_HOME/dbs'
alias alog='tail -f $ORACLE_BASE/diag/rdbms/$ORACLE_UNQNAME_LOWER/$ORACLE_SID/trace/alert_$ORACLE_SID.log'
alias valog='vi -R $ORACLE_BASE/diag/rdbms/$ORACLE_UNQNAME_LOWER/$ORACLE_SID/trace/alert_$ORACLE_SID.log'
alias llog='tail -f $ORACLE_BASE/diag/tnslsnr/`hostname`/listener/trace/listener.log'
alias vllog='vi -R $ORACLE_BASE/diag/tnslsnr/`hostname`/listener/trace/listener.log'
#alias cdord='cd $ORACLE_BASE/oradata/$ORACLE_SID' #for FileSystem
alias csrt='crsctl stat res -t'
alias rt='rman target /'
alias cdrb='cd /home/oracle/rman_backup/$ORACLE_DBNAME'
alias cdrba='cd /home/oracle/rman_backup/$ORACLE_DBNAME/ADG'
alias cdrbx='cd /home/oracle/rman_backup/$ORACLE_DBNAME/XTTS'
alias cdx='cd /home/oracle/xtts'
alias cdos='cd /home/oracle/oracle_scripts'
alias cdoss='cd /home/oracle/os_scripts'
alias cdrbl='cd /home/oracle/os_scripts/rman_log'
alias glogin_bak='mv /u01/app/oracle/product/19c/db_1/sqlplus/admin/glogin.sql /u01/app/oracle/product/19c/db_1/sqlplus/admin/glogin.sql.bak'
alias glogin_set='mv /u01/app/oracle/product/19c/db_1/sqlplus/admin/glogin.sql.bak /u01/app/oracle/product/19c/db_1/sqlplus/admin/glogin.sql'
alias oenv='source /home/oracle/os_scripts/oenv.sh'


set -o vi
stty erase ^H
stty erase ^?

 

8. 새로운 ORACLE 엔진을 기준으로 DB의 datapatch 작업

8-1. datapatch 작업 전 각종 정보 확인

[CDB1:oracle@tdb02t][/home/oracle]$ echo $ORACLE_HOME

/u01/app/oracle/product/19cRU27/db_1
[CDB1:oracle@tdb02t][/home/oracle]$ srvctl config database -db cdb1
Database unique name: CDB1
Database name: CDB1
Oracle home: /u01/app/oracle/product/19cRU27/db_1
Oracle user: oracle
Spfile: +DATA1/CDB1/PARAMETERFILE/spfile.277.1195332755
Password file:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Disk Groups: DATA1,FRA1
Services:
OSDBA group:
OSOPER group:
Database instance: CDB1

 

[CDB1:oracle@tdb02t][/home/oracle]$ alias ss
alias ss='rlwrap sqlplus "/as sysdba"'

 

[CDB1:oracle@tdb02t][/home/oracle]$ ss

SQL*Plus: Release 19.0.0.0.0 - Production on Sun Jun 29 23:50:15 2025
Version 19.27.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.27.0.0.0

[2025-06-29:23:50:15][tdb02t>]<CDB1@SYS>
col host_name for a20
col INSTANCE_NAME for a20
col VERSION for a20
col VERSION_FULL for a20
col STATUS for a20
SELECT INSTANCE_NAME, HOST_NAME, VERSION, VERSION_FULL, STATUS FROM V$INSTANCE;

INSTANCE_NAME        HOST_NAME            VERSION              VERSION_FULL         STATUS
-------------------- -------------------- -------------------- -------------------- --------------------
CDB1                 tdb02t               19.0.0.0.0           19.27.0.0.0          OPEN

1 row selected.


[2025-06-29:23:50:15][tdb02t>]<CDB1@SYS>
col name for a20
col open_mode for a20
col db_unique_name for a20
SELECT NAME, OPEN_MODE, DB_UNIQUE_NAME FROM V$DATABASE;

NAME                 OPEN_MODE            DB_UNIQUE_NAME
-------------------- -------------------- --------------------
CDB1                 READ WRITE           CDB1

1 row selected.

Elapsed: 00:00:00.00


[2025-06-29:23:50:15][tdb02t>]<CDB1@SYS>

col INSTALL_ID            for 9999
col PATCH_ID              for 99999999
col ACTION                for a10
col STATUS                for a10
col ACTION_TIME           for a30
col DESCRIPTION           for a60
col SOURCE_VERSION        for a12
col TARGET_VERSION        for a12
col TARGET_BUILD_DESCRIPTION for a20

select INSTALL_ID, PATCH_ID, ACTION, STATUS, ACTION_TIME, DESCRIPTION, SOURCE_VERSION, TARGET_VERSION, TARGET_BUILD_DESCRIPTION from DBA_REGISTRY_SQLPATCH;

INSTALL_ID  PATCH_ID ACTION     STATUS     ACTION_TIME                    DESCRIPTION                                                  SOURCE_VERSI TARGET_VERSI TARGET_BUILD_DESCRIP
---------- --------- ---------- ---------- ------------------------------ ------------------------------------------------------------ ------------ ------------ --------------------
         1  37260974 APPLY      SUCCESS    25/03/09 20:29:33.609152       Database Release Update : 19.26.0.0.250121 (37260974)        19.1.0.0.0   19.26.0.0.0  Release_Update


[CDB1:oracle@tdb02t][/home/oracle]$ ps -ef | grep -i pmon | grep -i cdb1
oracle    8494     1  0 Jun29 ?        00:00:11 ora_pmon_CDB1


[2025-06-30:22:56:09][tdb02t>]<CDB1@SYS> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB1                           READ WRITE NO

--> datapatch 전 모든 PDB가 Open상태여야함

 

8-2. datapatch 작업 전 glogin.sql 을 mv 시키기

mv /u01/app/oracle/product/19cRU27/db_1/sqlplus/admin/glogin.sql /u01/app/oracle/product/19cRU27/db_1/sqlplus/admin/glogin.sql.bak

  

8-3. datapatch 작업 시작

[CDB1:oracle@tdb02t][/home/oracle]$ echo $ORACLE_HOME

/u01/app/oracle/product/19cRU27/db_1

[CDB1:oracle@tdb02t][/home/oracle]$ $ORACLE_HOME/OPatch/datapatch -verbose -db CDB1
SQL Patching tool version 19.27.0.0.0 Production on Tue Jul  1 00:08:53 2025
Copyright (c) 2012, 2025, Oracle.  All rights reserved.

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

Connecting to database...OK
Gathering database info...done

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 interim SQL patches:
  No interim patches found

Current state of release update SQL patches:
  Binary registry:
    19.27.0.0.0 Release_Update 250406131139: Installed
  PDB CDB$ROOT:
    Applied 19.26.0.0.0 Release_Update 250118124854 successfully on 25/03/09 20:29:33.609152
  PDB PDB$SEED:
    Applied 19.26.0.0.0 Release_Update 250118124854 successfully on 25/03/09 20:51:17.342526
  PDB PDB1:
    Applied 19.26.0.0.0 Release_Update 250118124854 successfully on 25/03/09 20:51:17.342526

Adding patches to installation queue and performing prereq checks...done
Installation queue:
  For the following PDBs: CDB$ROOT PDB$SEED PDB1
    No interim patches need to be rolled back
    Patch 37642901 (Database Release Update : 19.27.0.0.250415 (37642901)):
      Apply from 19.26.0.0.0 Release_Update 250118124854 to 19.27.0.0.0 Release_Update 250406131139
    No interim patches need to be applied
Installing patches...

Patch installation complete.  Total patches installed: 3

Validating logfiles...done
Patch 37642901 apply (pdb CDB$ROOT): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/37642901/27123174/37642901_apply_CDB1_CDBROOT_2025Jul01_00_22_10.log (no errors)
Patch 37642901 apply (pdb PDB$SEED): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/37642901/27123174/37642901_apply_CDB1_PDBSEED_2025Jul01_00_26_55.log (no errors)
Patch 37642901 apply (pdb PDB1): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/37642901/27123174/37642901_apply_CDB1_PDB1_2025Jul01_00_26_55.log (no errors)
SQL Patching tool complete on Tue Jul  1 00:28:30 2025

 

8-4. datapatch 작업 후 glogin.sql 원상 복구 시키기

mv /u01/app/oracle/product/19cRU27/db_1/sqlplus/admin/glogin.sql.bak /u01/app/oracle/product/19cRU27/db_1/sqlplus/admin/glogin.sql

 

8-5. datapatch 작업 결과 확인

col INSTALL_ID            for 9999

col PATCH_ID              for 99999999
col ACTION                for a10
col STATUS                for a10
col ACTION_TIME           for a30
col DESCRIPTION           for a60
col SOURCE_VERSION        for a12
col TARGET_VERSION        for a12
col TARGET_BUILD_DESCRIPTION for a20

select INSTALL_ID, PATCH_ID, ACTION, STATUS, ACTION_TIME, DESCRIPTION, SOURCE_VERSION, TARGET_VERSION, TARGET_BUILD_DESCRIPTION from DBA_REGISTRY_SQLPATCH;

INSTALL_ID  PATCH_ID ACTION     STATUS     ACTION_TIME                    DESCRIPTION                                                  SOURCE_VERSI TARGET_VERSI TARGET_BUILD_DESCRIP
---------- --------- ---------- ---------- ------------------------------ ------------------------------------------------------------ ------------ ------------ --------------------
         1  37260974 APPLY      SUCCESS    25/03/09 20:29:33.609152       Database Release Update : 19.26.0.0.250121 (37260974)        19.1.0.0.0   19.26.0.0.0  Release_Update
         2  37642901 APPLY      SUCCESS    25/07/01 00:26:34.052067       Database Release Update : 19.27.0.0.250415 (37642901)        19.26.0.0.0  19.27.0.0.0  Release_Update



[CDB1:oracle@tdb02t][/home/oracle]$ cat /etc/oratab | grep -E "(\+ASM|CDB1)"
+ASM:/u01/app/19cRU27/grid:N            # line added by Agent

CDB1:/u01/app/oracle/product/19cRU27/db_1:N             # line added by Agent
--> 이미 설정되어 있음 (oracle 홈 위치는 srvctl modify로 오라클 홈 경로 변경 시 설정해주고, grid엔진은 roothas.sh 실행 시 설정해주는 걸로 보임, 추후 확인 해 볼것)

 

9. 전체 작업 원상 복구

--> 패치 작업 후 해당 작업을 롤백해야할 때 아래와 같이 수행하면됨

 

9-1. ORACLE 엔진 원상 복구

[CDB1:oracle@tdb02t][/home/oracle]$ srvctl modify database -db CDB1 -o /u01/app/oracle/product/19c/db_1

[CDB1:oracle@tdb02t][/home/oracle]$ srvctl config database -db CDB1
Database unique name: CDB1
Database name: CDB1
Oracle home: /u01/app/oracle/product/19c/db_1
Oracle user: oracle
Spfile: +DATA1/CDB1/PARAMETERFILE/spfile.277.1195332755
Password file:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Disk Groups: DATA1,FRA1
Services:
OSDBA group:
OSOPER group:
Database instance: CDB1

 

[CDB1:oracle@tdb02t][/home/oracle]$ srvctl stop database -db CDB1
[CDB1:oracle@tdb02t][/home/oracle]$ srvctl start database -db CDB1

 

9-2. Datapatch 작업으로 DB 패치 원상 복구

--> datapatch 작업 전 glogin.sql 파일을 mv 시키기

[CDB1:oracle@tdb02t][/home/oracle]$ mv /u01/app/oracle/product/19c/db_1/sqlplus/admin/glogin.sql /u01/app/oracle/product/19c/db_1/sqlplus/admin/glogin.sql.bak


[CDB1:oracle@tdb02t][/home/oracle]$ echo $ORACLE_HOME
/u01/app/oracle/product/19cRU27/db_1

[CDB1:oracle@tdb02t][/home/oracle]$ export ORACLE_HOME=/u01/app/oracle/product/19c/db_1
[CDB1:oracle@tdb02t][/home/oracle]$ export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$GRID_HOME/bin:$BASE_PATH

[CDB1:oracle@tdb02t][/home/oracle]$ $ORACLE_HOME/OPatch/datapatch -verbose
SQL Patching tool version 19.26.0.0.0 Production on Tue Jul  1 22:46:57 2025
Copyright (c) 2012, 2025, Oracle.  All rights reserved.

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

Connecting to database...OK
Gathering database info...

--------------------여기서 응답이 없을 시 아래와 같이 archive log current 한번 해줌 시작----------------------
[CDB1:oracle@tdb02t][/home/oracle]$ export ORACLE_HOME=/u01/app/oracle/product/19c/db_1
[CDB1:oracle@tdb02t][/home/oracle]$ export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$GRID_HOME/bin:$BASE_PATH
[CDB1:oracle@tdb02t][/home/oracle]$ ss

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Jul 1 23:03:20 2025
Version 19.26.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.26.0.0.0


SQL> alter system archive log current;

System altered.
--------------------여기서 응답이 없을 시 아래와 같이 archive log current 한번 해줌 종료----------------------
--> 이 작업 해주니깐 대기가 풀리고 datapatch 작업이 진행되는데 왜 그런건지 확인해야함

done

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 interim SQL patches:
  No interim patches found

Current state of release update SQL patches:
  Binary registry:
    19.26.0.0.0 Release_Update 250118124854: Installed
  PDB CDB$ROOT:
    Applied 19.27.0.0.0 Release_Update 250406131139 successfully on 25/07/01 00:26:34.052067
  PDB PDB$SEED:
    Applied 19.27.0.0.0 Release_Update 250406131139 successfully on 25/07/01 00:28:05.628239
  PDB PDB1:
    Applied 19.27.0.0.0 Release_Update 250406131139 successfully on 25/07/01 00:28:05.614006

Adding patches to installation queue and performing prereq checks...done
Installation queue:
  For the following PDBs: CDB$ROOT PDB$SEED PDB1
    No interim patches need to be rolled back
    Patch 37642901 (Database Release Update : 19.27.0.0.250415 (37642901)):
      Rollback from 19.27.0.0.0 Release_Update 250406131139 to 19.26.0.0.0 Release_Update 250118124854
    No interim patches need to be applied

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

Validating logfiles...done
Patch 37642901 rollback (pdb CDB$ROOT): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/37642901/27123174/37642901_rollback_CDB1_CDBROOT_2025Jul01_22_51_50.log (no errors)
Patch 37642901 rollback (pdb PDB$SEED): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/37642901/27123174/37642901_rollback_CDB1_PDBSEED_2025Jul01_22_53_49.log (no errors)
Patch 37642901 rollback (pdb PDB1): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/37642901/27123174/37642901_rollback_CDB1_PDB1_2025Jul01_22_53_49.log (no errors)
SQL Patching tool complete on Tue Jul  1 22:55:31 2025

 

--> datapatch 작업 후 glogin.sql 파일 원상 복구

[CDB1:oracle@tdb02t][/home/oracle]$ mv /u01/app/oracle/product/19c/db_1/sqlplus/admin/glogin.sql.bak /u01/app/oracle/product/19c/db_1/sqlplus/admin/glogin.sql

col INSTALL_ID            for 9999
col PATCH_ID              for 99999999
col ACTION                for a10
col STATUS                for a10
col ACTION_TIME           for a30
col DESCRIPTION           for a60
col SOURCE_VERSION        for a12
col TARGET_VERSION        for a12
col TARGET_BUILD_DESCRIPTION for a20

select INSTALL_ID, PATCH_ID, ACTION, STATUS, ACTION_TIME, DESCRIPTION, SOURCE_VERSION, TARGET_VERSION, TARGET_BUILD_DESCRIPTION from DBA_REGISTRY_SQLPATCH;

INSTALL_ID  PATCH_ID ACTION     STATUS     ACTION_TIME                    DESCRIPTION                                                  SOURCE_VERSI TARGET_VERSI TARGET_BUILD_DESCRIP
---------- --------- ---------- ---------- ------------------------------ ------------------------------------------------------------ ------------ ------------ --------------------
         1  37260974 APPLY      SUCCESS    25/03/09 20:29:33.609152       Database Release Update : 19.26.0.0.250121 (37260974)        19.1.0.0.0   19.26.0.0.0  Release_Update
         2  37642901 APPLY      SUCCESS    25/07/01 00:26:34.052067       Database Release Update : 19.27.0.0.250415 (37642901)        19.26.0.0.0  19.27.0.0.0  Release_Update
         3  37642901 ROLLBACK   SUCCESS    25/07/01 22:53:36.748083       Database Release Update : 19.27.0.0.250415 (37642901)        19.27.0.0.0  19.26.0.0.0  Release_Update

3 rows selected.

Elapsed: 00:00:00.00



[CDB1:oracle@tdb02t][/home/oracle]$ export ORACLE_HOME=/u01/app/oracle/product/19c/db_1
[CDB1:oracle@tdb02t][/home/oracle]$ export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$GRID_HOME/bin:$BASE_PATH

 

9-3. root/grid/oracle os user의 .bash_profile 원상 복구

--> root os user

[root@tdb02t][/root]$ vi ~root/.bash_profile
[root@tdb02t][/root]$ cat ~root/.bash_profile
# .bash_profile

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

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
set -o vi
export PS1='[\u@\h][$PWD]$ '
stty erase ^H

export ORACLE_BASE=/u01/app/oracle
export GRID_HOME=/u01/app/19c/grid
export DB_HOME=$ORACLE_BASE/product/19c/db_1
export BASE_PATH=/usr/sbin:$PATH
export PATH=$GRID_HOME/bin:$BASE_PATH

alias csrt='crsctl stat res -t'

[root@tdb02t][/root]$

 

--> grid os user

[root@tdb02t][/root]$ vi ~grid/.bash_profile

[root@tdb02t][/root]$ cat ~grid/.bash_profile
# .bash_profile

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

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH
export TMP=/tmp
export TMPDIR=$TMP
export EDITOR=vi
export ORACLE_HOSTNAME=tdb02t
export ORACLE_UNQNAME=+ASM
export ORACLE_UNQNAME_LOWER=+asm
export ORACLE_BASE=/u01/app/oracle
export GRID_HOME=/u01/app/19c/grid
export DB_HOME=$ORACLE_BASE/product/19c/db_1
export ORACLE_HOME=$GRID_HOME
export ORACLE_SID=+ASM
export ORACLE_SID_LOWER=+asm
export ORACLE_USER_ORACLE_SID=CDB1
export ORACLE_USER_ORACLE_SID_LOWEWR=cdb1
export ORACLE_TERM=xterm
export BASE_PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$GRID_HOME/bin:$BASE_PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export NLS_LANG=AMERICAN_KOREA.AL32UTF8
export NLS_DATE_FORMAT='YYYY-MM-DD:HH24:MI:SS'
export PS1='[$ORACLE_SID:\u@\h][$PWD]$ '
alias ss='rlwrap sqlplus "/as sysdba"'
alias sa='rlwrap sqlplus "/as sysasm"'
alias cdt='cd $ORACLE_HOME/network/admin'
alias cdb='cd $ORACLE_BASE'
alias cdo='cd $ORACLE_HOME'
alias cdod='cd $ORACLE_HOME/dbs'
alias alog='tail -f $ORACLE_BASE/diag/asm/$ORACLE_UNQNAME_LOWER/$ORACLE_SID/trace/alert_$ORACLE_SID.log'
alias valog='vi -R $ORACLE_BASE/diag/asm/$ORACLE_UNQNAME_LOWER/$ORACLE_SID/trace/alert_$ORACLE_SID.log'
alias llog='tail -f $ORACLE_BASE/diag/tnslsnr/`hostname`/listener/trace/listener.log'
alias vllog='vi -R $ORACLE_BASE/diag/tnslsnr/`hostname`/listener/trace/listener.log'
alias crslog='tail -f $ORACLE_BASE/diag/crs/`hostname`/crs/trace/alert.log'
alias vcrslog='vi -R $ORACLE_BASE/diag/crs/`hostname`/crs/trace/alert.log'
#alias cdord='cd $ORACLE_BASE/oradata/$ORACLE_SID' #for FileSystem
alias cdoss='cd /home/grid/os_scripts'
alias csrt='crsctl stat res -t'
set -o vi
stty erase ^H
stty erase ^?

 

--> oracle os user

[root@tdb02t][/root]$ vi ~oracle/.bash_profile
[root@tdb02t][/root]$ cat ~oracle/.bash_profile
# .bash_profile

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

# User specific environment and startup programs

stty erase $(tput kbs)
. /home/oracle/os_scripts/oenv.sh


PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH
export TMP=/tmp
export TMPDIR=$TMP
export EDITOR=vi
export ORACLE_HOSTNAME=tdb02t
export ORACLE_BASE=/u01/app/oracle
export GRID_HOME=/u01/app/19c/grid
export DB_HOME=$ORACLE_BASE/product/19c/db_1
export ORACLE_HOME=$DB_HOME
#export ORACLE_PDB_SID=PDB1
#export ORACLE_PDB_SID_LOWER=pdb1
export ORACLE_TERM=xterm
export BASE_PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$GRID_HOME/bin:$BASE_PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export NLS_LANG=AMERICAN_KOREA.AL32UTF8
export NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'
export PS1='[$ORACLE_SID:\u@\h][$PWD]$ '
alias ss='rlwrap sqlplus "/as sysdba"'
alias st='rlwrap sqlplus tuner/oracle'
alias ssc1p1='rlwrap sqlplus sys@CDB1_PDB1 as sysdba'
alias ssc2p1='rlwrap sqlplus sys@CDB2_PDB1 as sysdba'
alias stc1p1='rlwrap sqlplus sys/oracle@CDB1_PDB1'
alias stc2p1='rlwrap sqlplus sys/oracle@CDB2_PDB1'
alias cdt='cd $ORACLE_HOME/network/admin'
alias cdb='cd $ORACLE_BASE'
alias cdo='cd $ORACLE_HOME'
alias cdod='cd $ORACLE_HOME/dbs'
alias alog='tail -f $ORACLE_BASE/diag/rdbms/$ORACLE_UNQNAME_LOWER/$ORACLE_SID/trace/alert_$ORACLE_SID.log'
alias valog='vi -R $ORACLE_BASE/diag/rdbms/$ORACLE_UNQNAME_LOWER/$ORACLE_SID/trace/alert_$ORACLE_SID.log'
alias llog='tail -f $ORACLE_BASE/diag/tnslsnr/`hostname`/listener/trace/listener.log'
alias vllog='vi -R $ORACLE_BASE/diag/tnslsnr/`hostname`/listener/trace/listener.log'
#alias cdord='cd $ORACLE_BASE/oradata/$ORACLE_SID' #for FileSystem
alias csrt='crsctl stat res -t'
alias rt='rman target /'
alias cdrb='cd /home/oracle/rman_backup/$ORACLE_DBNAME'
alias cdrba='cd /home/oracle/rman_backup/$ORACLE_DBNAME/ADG'
alias cdrbx='cd /home/oracle/rman_backup/$ORACLE_DBNAME/XTTS'
alias cdx='cd /home/oracle/xtts'
alias cdos='cd /home/oracle/oracle_scripts'
alias cdoss='cd /home/oracle/os_scripts'
alias cdrbl='cd /home/oracle/os_scripts/rman_log'
alias glogin_bak='mv /u01/app/oracle/product/19c/db_1/sqlplus/admin/glogin.sql /u01/app/oracle/product/19c/db_1/sqlplus/admin/glogin.sql.bak'
alias glogin_set='mv /u01/app/oracle/product/19c/db_1/sqlplus/admin/glogin.sql.bak /u01/app/oracle/product/19c/db_1/sqlplus/admin/glogin.sql'
alias oenv='source /home/oracle/os_scripts/oenv.sh'


set -o vi
stty erase ^H
stty erase ^?

 

--> 최종 확인

[CDB1:oracle@tdb02t][/home/oracle]$ which crsctl
/u01/app/19c/grid/bin/crsctl

[CDB1:oracle@tdb02t][/home/oracle]$ crsctl query has releasepatch
Oracle Clusterware release patch level is [117906255] and the complete list of patches [36758186 37260974 37266638 37268031 37461387 ] have been applied on the local node. The release patch string is [19.26.0.0.0].


[CDB1:oracle@tdb02t][/u01/app/oraInventory/backup/2025-07-01_11-24-58PM/ContentsXML]$ cat /etc/oratab | grep -i -E  "(\+asm|cdb1)"
CDB1:/u01/app/oracle/product/19c/db_1:N         # line added by Agent
+ASM:/u01/app/19c/grid:N                # line added by Agent

 

 

반응형

+ Recent posts