프린트 하기 URL 복사

OS 환경 : Oracle Linux 9.6 (64bit)

 

DB 환경 : Oracle Database 19.28.0.0

 

방법 : 오라클 19c Restart 환경 hostname 변경 가이드

본문에서는 오라클 Restart(싱글 ASM) 환경에서 서버의 hostname을 변경하는 테스트를 진행해봄
참고로 단순히 IP 주소만 변경하는 경우에는 deconfig/reconfig 과정이 필요하지 않음
참고 : 오라클 19c RAC IP 변경 방법(IP Change) ( https://positivemh.tistory.com/742 )
하지만 Hostname을 변경하는 경우에는 Oracle Restart 구성을 해제(deconfig)하고 재구성(reconfig)하는 단계를 거쳐야 함

 

rac 환경은 아래 문서 참고
참고 : How to rename the hostname in RAC(KB149509)

 

 

현재 hostname : oel9reco, 변경예정 hostname : chg19c

 

 

테스트
현재 hostname 확인

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
$ hostname
oel9reco
 
$ cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.137.164 oel9reco
 
$ ifconfig
ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.137.164  netmask 255.255.255.0  broadcast 192.168.137.255
        ether 00:50:56:a8:9d:e3  txqueuelen 1000  (Ethernet)
        RX packets 1973484  bytes 4521892333 (4.2 GiB)
        RX errors 0  dropped 407  overruns 0  frame 0
        TX packets 615822  bytes 53326846 (50.8 MiB)
        TX errors 0  dropped 103 overruns 0  carrier 0  collisions 0
 
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 264  bytes 28483 (27.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 264  bytes 28483 (27.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

현재 hostname은 oel9reco임

 

 

현재 상태 확인

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       oel9reco                 STABLE
ora.LISTENER.lsnr
               ONLINE  OFFLINE      oel9reco                 STABLE
ora.asm
               ONLINE  ONLINE       oel9reco                 Started,STABLE
ora.ons
               OFFLINE OFFLINE      oel9reco                 STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       oel9reco                 STABLE
ora.diskmon
      1        OFFLINE OFFLINE                               STABLE
ora.evmd
      1        ONLINE  ONLINE       oel9reco                 STABLE
ora.oracle19.db
      1        ONLINE  ONLINE       oel9reco                 Open,HOME=/app/oracl
                                                             e/product/19c,STABLE
--------------------------------------------------------------------------------

정상임

 

 

db 안전하게 종료

1
$ srvctl stop database -d oracle19

 

 

OHAS 서비스 Deconfig(root 유저)

1
2
3
4
5
6
7
8
# cd $GRID_HOME/crs/install/
# sh roothas.sh -deconfig -force
Using configuration parameter file: /app/grid/product/19c/crs/install/crsconfig_params
The log of current session can be found at:
  /app/oracle/crsdata/oel9reco/crsconfig/hadeconfig.log
2026/06/14 14:09:40 CLSRSC-332: CRS resources for listeners are still configured
Redirecting to /bin/systemctl restart rsyslog.service
2026/06/14 14:10:00 CLSRSC-337: Successfully deconfigured Oracle Restart stack

 

 

OS 레벨 Hostname 변경

1
2
3
4
5
6
7
# hostnamectl set-hostname chg19c
# hostname
chg19c
# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.137.164 chg19c

hostnamectl 명령으로 변경 후 /etc/hosts 내용도 변경
정상적으로 변경됨

 

 

Cluster 재구성(root 유저)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# cd $GRID_HOME/crs/install/
# sh roothas.sh
Using configuration parameter file: /app/grid/product/19c/crs/install/crsconfig_params
The log of current session can be found at:
  /app/oracle/crsdata/chg19c/crsconfig/roothas_2026-06-14_02-12-51PM.log
2026/06/14 14:12:54 CLSRSC-363: User ignored prerequisites during installation
Redirecting to /bin/systemctl restart rsyslog.service
LOCAL ADD MODE
Creating OCR keys for user 'oracle', privgrp 'oinstall'..
Operation successful.
LOCAL ONLY MODE
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node chg19c successfully pinned.
2026/06/14 14:13:01 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.service'
 
chg19c     2026/06/14 14:13:27     /app/oracle/crsdata/chg19c/olr/backup_20260614_141327.olr     880628325
2026/06/14 14:13:27 CLSRSC-327: Successfully configured Oracle Restart for a standalone server

완료됨

 

 

CSS 서비스 Auto Start 활성화(grid 유저)
*현재 grid 유저 없이 oracle 유저만으로 구성했기때문에 oracle 유저로 접속하여 수행함

1
2
3
4
5
6
# su - oracle
$ crsctl stat res ora.cssd -p | grep -i auto_start
AUTO_START=never
$ crsctl modify resource "ora.cssd" -init -attr "AUTO_START=1" -unsupported
$ crsctl stat res ora.cssd -p | grep -i auto_start
AUTO_START=1

활성화됨(auto_start=1)

 

 

OHAS 재시작 및 상태 확인(grid 유저)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$ crsctl stop has
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'chg19c'
CRS-2673: Attempting to stop 'ora.evmd' on 'chg19c'
CRS-2677: Stop of 'ora.evmd' on 'chg19c' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'chg19c' has completed
CRS-4133: Oracle High Availability Services has been stopped.
 
$ crsctl start has
CRS-4123: Oracle High Availability Services has been started.
 
$ crsctl check has
CRS-4638: Oracle High Availability Services is online
 
$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ons
               OFFLINE OFFLINE      chg19c                   STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       chg19c                   STABLE
ora.diskmon
      1        OFFLINE OFFLINE                               STABLE
ora.evmd
      1        ONLINE  INTERMEDIATE chg19c                   STABLE
--------------------------------------------------------------------------------

이때 CSS 및 OHAS 서비스가 정상적으로 올라오지 않으면 OS 재부팅 후 다시 상태를 확인해야함

 

 

리스너 재생성 및 등록(grid 유저)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
$ srvctl add listener -l LISTENER -p TCP:1521
$ srvctl start listener -l LISTENER
$ srvctl config listener -l LISTENER
Name: LISTENER
Type: Database Listener
Home: /app/grid/product/19c
End points: TCP:1521
Listener is enabled.
 
$ lsnrctl status
 
LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 14-JUN-2026 14:21:03
 
Copyright (c) 19912025, Oracle.  All rights reserved.
 
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                14-JUN-2026 14:20:28
Uptime                    0 days 0 hr. 0 min. 34 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /app/grid/product/19c/network/admin/listener.ora
Listener Log File         /app/oracle/diag/tnslsnr/chg19c/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.137.164)(PORT=1521)))
The listener supports no services
The command completed successfully

정상적으로 등록됨

 

 

ASM 인스턴스 기동 및 Auto Start 설정(grid 유저)

1
2
$ srvctl add asm
$ crsctl modify resource "ora.asm" -init -attr "AUTO_START=1" -unsupported

 

 

kfod를 이용한 디스크 인식 확인(grid 유저)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$ $GRID_HOME/bin/kfod asm_diskstring='/dev/disk/by-label/*' disks=all
--------------------------------------------------------------------------------
 Disk          Size Path                                     User     Group
================================================================================
   1:      30720 MB /dev/disk/by-label/DATA                  oracle   dba
   2:      10239 MB /dev/disk/by-label/DATANEW               oracle   dba
KFOD-00313: No ASM instances available. CSS group services were successfully initialized by kgxgncin.
 
#asmlib 사용중인 경우 아래처럼 사용도 가능
$ $GRID_HOME/bin/kfod asm_diskstring='ORCL:*' disks=all
--------------------------------------------------------------------------------
 Disk          Size Path                                     User     Group
================================================================================
   1:      30720 MB ORCL:DATA
   2:      10239 MB ORCL:DATANEW
KFOD-00313: No ASM instances available. CSS group services were successfully initialized by kgxgncin.

정상적으로 확인됨

 

 

asm pfile 임시 생성(grid 유저)

1
2
3
4
5
6
$ cd $GRID_HOME/dbs
$ vi init+ASM.ora
asm_diskgroups=DATA
asm_diskstring='ORCL:*'
instance_type='asm'
large_pool_size=12m

 

 

임시 PFILE로 ASM 기동 및 디스크 확인(grid 유저)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
$ . oraenv
ORACLE_SID = [oracle19] ? +ASM
The Oracle base remains unchanged with value /app/oracle
 
$ sqlplus / as sysasm
SQL> startup pfile=init+ASM.ora
ASM instance started
 
Total System Global Area 1976086808 bytes
Fixed Size                  8958232 bytes
Variable Size            1941962752 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted
 
SQL> 
set lines 200 pages 1000
col diskgroup for a15
col state for a10
col name for a20
col path for a40
select a.name as diskgroup, a.state, b.name, b.path
from v$asm_diskgroup a, v$asm_disk b
where a.group_number = b.group_number(+)
order by 13;
 
DISKGROUP       STATE      NAME                 PATH
--------------- ---------- -------------------- ----------------------------------------
DATA            MOUNTED    DATA                 ORCL:DATA
DATA            MOUNTED    DATANEW              ORCL:DATANEW

디스크가 정상적으로 mount 됨

 

 

SPFILE 생성 및 ASM 리소스 속성 업데이트(grid 유저)

1
2
3
4
5
SQL> create spfile from pfile;
 
File created.
 
$ srvctl modify asm -p /app/grid/product/19c/dbs/spfile+ASM.ora -l LISTENER

 

 

데이터베이스 리소스 재등록(oracle 유저)

1
2
3
4
$ srvctl add database -db oracle19 \
-oraclehome $ORACLE_HOME \
-spfile +DATA/ORACLE19/PARAMETERFILE/spfile.267.1236264377 \
-pwfile $ORACLE_HOME/dbs/orapworacle19

 

 

데이터베이스 확인

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$ srvctl config database -d oracle19
Database unique name: oracle19
Database name:
Oracle home: /app/oracle/product/19c
Oracle user: oracle
Spfile: +DATA/ORACLE19/PARAMETERFILE/spfile.267.1236264377
Password file: /app/oracle/product/19c/dbs/orapworacle19
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Disk Groups:
Services:
OSDBA group:
OSOPER group:
Database instance: oracle19

 

 

최종 재기동 테스트(grid 유저)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
$ crsctl stop has
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'chg19c'
CRS-2673: Attempting to stop 'ora.evmd' on 'chg19c'
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'chg19c'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'chg19c'
CRS-2677: Stop of 'ora.DATA.dg' on 'chg19c' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'chg19c'
CRS-2677: Stop of 'ora.evmd' on 'chg19c' succeeded
CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'chg19c' succeeded
CRS-2677: Stop of 'ora.asm' on 'chg19c' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'chg19c'
CRS-2677: Stop of 'ora.cssd' on 'chg19c' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'chg19c' has completed
CRS-4133: Oracle High Availability Services has been stopped.
 
$ crsctl start has -wait
CRS-4123: Starting Oracle High Availability Services-managed resources
CRS-6023: Starting Oracle Cluster Ready Services-managed resources
CRS-6017: Processing resource auto-start for servers: chg19c
CRS-2672: Attempting to start 'ora.cssd' on 'chg19c'
CRS-2672: Attempting to start 'ora.diskmon' on 'chg19c'
CRS-2672: Attempting to start 'ora.LISTENER.lsnr' on 'chg19c'
CRS-2672: Attempting to start 'ora.evmd' on 'chg19c'
CRS-2676: Start of 'ora.diskmon' on 'chg19c' succeeded
CRS-2676: Start of 'ora.evmd' on 'chg19c' succeeded
CRS-2676: Start of 'ora.LISTENER.lsnr' on 'chg19c' succeeded
CRS-2676: Start of 'ora.cssd' on 'chg19c' succeeded
CRS-2672: Attempting to start 'ora.asm' on 'chg19c'
CRS-2676: Start of 'ora.asm' on 'chg19c' succeeded
CRS-6016: Resource auto-start has completed for server chg19c
CRS-6024: Completed start of Oracle Cluster Ready Services-managed resources
CRS-4123: Oracle High Availability Services has been started.

 

 

db 기동

1
$ srvctl start database -d oracle19

 

 

db 상태 확인

1
2
3
4
5
SQL> select instance_name, status from v$instance;
 
INSTANCE_NAME    STATUS
---------------- ------------
oracle19         OPEN

 

 

전체 상태 재확인

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       chg19c                   STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       chg19c                   STABLE
ora.asm
               ONLINE  ONLINE       chg19c                   Started,STABLE
ora.ons
               OFFLINE OFFLINE      chg19c                   STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       chg19c                   STABLE
ora.diskmon
      1        OFFLINE OFFLINE                               STABLE
ora.evmd
      1        ONLINE  ONLINE       chg19c                   STABLE
ora.oracle19.db
      1        ONLINE  ONLINE       chg19c                   Open,HOME=/app/oracl
                                                             e/product/19c,STABLE
--------------------------------------------------------------------------------

모두 정상임

 

 

리스너 확인

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
$ lsnrctl status
 
LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 14-JUN-2026 14:56:09
 
Copyright (c) 19912025, Oracle.  All rights reserved.
 
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                14-JUN-2026 14:38:37
Uptime                    0 days 0 hr. 17 min. 31 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /app/grid/product/19c/network/admin/listener.ora
Listener Log File         /app/oracle/diag/tnslsnr/chg19c/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.137.164)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "+ASM_DATA" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
The command completed successfully

oracle db 서비스가 리스너에 안붙어 있음
로컬 리스너 파라미터 및 tnsnames.ora 파일도 수정이 필요함

 

 

tnsnames.ora 파일 수정

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$ cd /app/oracle/product/19c/network/admin
$ vi tnsnames.ora
#기존
ORACLE19_TNS =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = oel9reco)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = oracle19)
    )
  )
 
#변경
ORACLE19_TNS =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = chg19c)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = oracle19)
    )
  )

tnsnames.ora 파일에서 hostname 변경

 

 

로컬 리스너 재등록

1
2
3
4
5
6
7
8
9
10
11
12
13
SQL> show parameter local_listener
 
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
local_listener                       string      ORACLE19_TNS
 
SQL> alter system set local_listener = ORACLE19_TNS;
 
System altered.
 
SQL> alter system register;
 
System altered.

동일한 이름으로 재등록 및 register 수행

 

 

리스너 재확인

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$ lsnrctl status
 
LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 14-JUN-2026 15:00:18
 
Copyright (c) 19912025, Oracle.  All rights reserved.
 
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                14-JUN-2026 14:38:37
Uptime                    0 days 0 hr. 21 min. 40 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /app/grid/product/19c/network/admin/listener.ora
Listener Log File         /app/oracle/diag/tnslsnr/chg19c/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.137.164)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "+ASM_DATA" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "oracle19" has 1 instance(s).
  Instance "oracle19", status READY, has 1 handler(s) for this service...
Service "oracle19XDB" has 1 instance(s).
  Instance "oracle19", status READY, has 1 handler(s) for this service...
The command completed successfully

리스너에 db 서비스도 잘 붙음

 

 

결론 :
oracle restart 환경에서 단순 ip 변경은 재구성이 필요 없지만 hostname 변경은 ohas 전체의 초기화 및 재구성이 필요함
해당 절차를 수행할 때는 기존 asm 파라미터(디스크스트링, 디스크그룹) 정보를 사전에 백업해 둬야 디스크 인식 실패를 예방할 수 있음
그리고 hostname 변경시 부가적으로 tnsnames.ora 파일도 수정을 해줘야 리스너 서비스 및 db 링크 등을 정상적으로 사용할 수 있음

 

 

참조 : 

오라클 19c RAC IP 변경 방법(IP Change) ( https://positivemh.tistory.com/742 )
How to change Hostname / IP for a Grid Infrastructure Oracle Restart Standalone Configuration (SIHA) 11.2 and Later(KB147447)
How to rename the hostname in RAC(KB149509)
How to Modify Private Network Information in Oracle Clusterware(KB109184)