프린트 하기 URL 복사

OS 환경 : Oracle Linux 9.6 (64bit)

 

DB 환경 : Oracle Database 19.32.0.0

 

방법 : 오라클 19c tar 명령을 이용해 db 엔진 복제시 유의사항

오라클 db 엔진을 압축(백업)하기 위해 tar 명령을 사용할수 있음
(본문에서 압축이라고 표현하지만 gzip을 쓰지 않는 이상 압축은 아니고 그냥 모으는 명령임, 하지만 본문에서는 편의상 압축이라는 표현을 사용하였음)
이때 p 옵션을 쓰면 권한이 올바르게 유지됨 하지만 오너는 별개의 문제임
본문에서는 oracle 유저로 p 옵션을 사용해서 tar로 엔진을 압축하고 다시 tar 명령으로 압축을 해제해보면서 권한을 확인해봄
압축 해제시에는 oracle 유저와 root 유저 각각 압축을 해제한 뒤 권한을 확인해봄

 

 

테스트
사전 확인
1. tar로 엔진 압축
2. tar로 엔진 압축해제(oracle 유저)
3. tar로 엔진 압축해제(root 유저)

 

 

사전 확인
오라클 엔진 경로로 이동하여 엔진 경로 확인

1
2
3
4
5
6
7
8
$ cd $ORACLE_HOME/../
$ ls -al
total 8
drwxr-xr-x.  3 oracle oinstall   17 Sep 19 14:16 .
drwxrwxr-x. 17 oracle dba      4096 Jan 30  2026 ..
drwxr-xr-x  76 oracle oinstall 4096 Aug  9 21:42 19c
$ pwd
/app/oracle/product

현재 /app/oracle/product/19c가 엔진 경로임

 

 

오라클 엔진 경로에 소유자가 root인 파일 확인

1
2
3
$ find $ORACLE_HOME -type f -user root -ls
498143880      4 -rw-r-----   1  root     oinstall     1534 Dec 22  2005 /app/oracle/product/19c/rdbms/admin/externaljob.ora
510073810    148 -rwsr-x---   1  root     oinstall   147848 Apr 17  2019 /app/oracle/product/19c/bin/oradism

2개가 존재함

 

 

1. tar로 엔진 압축

1
2
3
4
5
6
7
$ tar -cpf 19c.tar 19c/
$ ls -al
total 20076420
drwxr-xr-x.  3 oracle oinstall          32 Sep 19 14:16 .
drwxrwxr-x. 17 oracle dba             4096 Jan 30  2026 ..
drwxr-xr-x  76 oracle oinstall        4096 Aug  9 21:42 19c
-rw-r--r--   1 oracle oinstall 20558243840 Sep 19 14:19 19c.tar

압축됨
명령어 설명 :
c : create, 압축파일 생성
p : permission 보존
f : file, 바로 뒤의 19c.tar를 tar 파일명으로 사용

 

 

엔진 압축을 해제할 신규 경로 생성

1
2
$ mkdir -p oracle_user
$ mkdir -p root_user

oracle_user 폴더에는 oracle 유저가 tar를 압축 해재를 하고
root_user 폴더에는 root 유저가 tar를 압축 해재를 할 예정임

 

 

2. tar로 엔진 압축해제(oracle 유저)

1
2
3
4
5
6
7
$ cd oracle_user/
$ tar -xpf ../19c.tar
$ ls -al
total 4
drwxr-xr-x   3 oracle oinstall   17 Sep 19 14:23 .
drwxr-xr-x.  4 oracle oinstall   51 Sep 19 14:21 ..
drwxr-xr-x  76 oracle oinstall 4096 Aug  9 21:42 19c

정상적으로 압축 해제됨

 

 

파일 확인

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$ ls -al 19c
total 116
drwxr-xr-x 76 oracle oinstall  4096 Aug  9 21:42 .
drwxr-xr-x  3 oracle oinstall    17 Sep 19 14:23 ..
drwxr-xr-x  2 oracle oinstall   102 May 31  2025 addnode
drwxr-xr-x  5 oracle oinstall  4096 May 31  2025 apex
drwxr-xr-x  9 oracle oinstall    93 Apr 17  2019 assistants
drwxr-xr-x  2 oracle oinstall  8192 Sep 19 13:56 bin
drwxrwxr-x  8 oracle oinstall    95 Aug  9 21:23 cfgtoollogs
...
drwxr-xr-x  6 oracle oinstall    53 Sep 19 13:55 sqlplus
drwxr-xr-x  6 oracle oinstall    54 Apr 17  2019 srvm
drwxr-xr-x  3 oracle oinstall    20 May 31  2025 suptools
drwxr-xr-x  3 oracle oinstall    35 Apr 17  2019 ucp
drwxr-xr-x  4 oracle oinstall    31 Apr 17  2019 usm
drwxr-xr-x  2 oracle oinstall    33 Apr 17  2019 utl
drwxr-xr-x  3 oracle oinstall    19 Apr 17  2019 wwg
drwxr-x---  7 oracle oinstall    69 Apr 17  2019 xdk

이렇게만 보면 특이사항은 없어보임

 

 

root 소유자인 파일이 있는지 확인

1
$ find /app/oracle/product/oracle_user/19c -type f -user root -ls

root 소유자인 파일이 없음

 

 

수동으로 확인

1
2
3
4
$ ls -al /app/oracle/product/oracle_user/19c/rdbms/admin/externaljob.ora
-rw-r----- 1 oracle oinstall 1534 Dec 22  2005 /app/oracle/product/oracle_user/19c/rdbms/admin/externaljob.ora
$ ls -al /app/oracle/product/oracle_user/19c/bin/oradism
-rwsr-x--- 1 oracle oinstall 147848 Apr 17  2019 /app/oracle/product/oracle_user/19c/bin/oradism

권한은 기존과 동일하지만 소유자가 oracle임

 

 

3. tar로 엔진 압축해제(root 유저)

1
2
3
4
5
6
7
8
$ su - root
# cd /app/oracle/product/root_user
# tar -xpf ../19c.tar
$ ls -al
total 4
drwxr-xr-x   3 oracle oinstall   17 Sep 19 14:34 .
drwxr-xr-x.  5 oracle oinstall   68 Sep 19 14:34 ..
drwxr-xr-x  76 oracle oinstall 4096 Aug  9 21:42 19c

 

 

파일 확인

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# ls -al 19c
total 116
drwxr-xr-x 76 oracle oinstall  4096 Aug  9 21:42 .
drwxr-xr-x  3 oracle oinstall    17 Sep 19 14:40 ..
drwxr-xr-x  2 oracle oinstall   102 May 31  2025 addnode
drwxr-xr-x  5 oracle oinstall  4096 May 31  2025 apex
drwxr-xr-x  9 oracle oinstall    93 Apr 17  2019 assistants
drwxr-xr-x  2 oracle oinstall  8192 Sep 19 13:56 bin
drwxrwxr-x  8 oracle oinstall    95 Aug  9 21:23 cfgtoollogs
...
drwxr-xr-x  6 oracle oinstall    53 Sep 19 13:55 sqlplus
drwxr-xr-x  6 oracle oinstall    54 Apr 17  2019 srvm
drwxr-xr-x  3 oracle oinstall    20 May 31  2025 suptools
drwxr-xr-x  3 oracle oinstall    35 Apr 17  2019 ucp
drwxr-xr-x  4 oracle oinstall    31 Apr 17  2019 usm
drwxr-xr-x  2 oracle oinstall    33 Apr 17  2019 utl
drwxr-xr-x  3 oracle oinstall    19 Apr 17  2019 wwg
drwxr-x---  7 oracle oinstall    69 Apr 17  2019 xdk

특이사항은 없어보임

 

 

root 소유자인 파일이 있는지 확인

1
2
3
# find /app/oracle/product/root_user/19c -type f -user root -ls
549008403      4 -rw-r-----   1  root     oinstall     1534 Dec 22  2005 /app/oracle/product/root_user/19c/rdbms/admin/externaljob.ora
481339657    148 -rwsr-x---   1  root     oinstall   147848 Apr 17  2019 /app/oracle/product/root_user/19c/bin/oradism

정상적으로 root 소유자 파일도 존재함

 

 

결론 :
tar로 엔진을 압축하고 다른 서버로 옮기는 작업을 할수 있지만
이 경우 oracle 유저만 가지고 하는 경우 root 소유자인 파일들의 권한이 제대로 들어가지 않을 수 있음
싱글 db 환경에서 db는 복제안하고 엔진만 tar로 복제하여 dbca를 수행하는 경우에는 oradism의 소유자가 oracle인 경우 dbca가 특정 단계에서 진행되지 않음
이 경우 가이드로 $ORACLE_HOME/root.sh 을 수행하라고 나오는데 이때 $ORACLE_HOME/rdbms/install/rootadd_rdbms.sh가 수행되면서 root 권한이 재부여됨
하지만 rac의 경우 이작업으로 인해 다른 문제가 발생할 수 있으니 꼭 root 유저로 p 옵션을 사용하여 tar를 해제하는것을 추천함
(사실 db 엔진만 tar를 사용하는것을 추천하고 grid는 재설치하는걸 권장함)
그리고 요즘은 tar 보다는 gold image를 생성해서 옮기는걸 조금 더 권장하는 추세임
참고로 gold image를 만들어서 복제하는 경우에는 dbs 경로, network/admin 경로의 .ora 파일들은 제외됨

 

 

참조 : 

오라클 19c 골드 이미지 이용해 db 엔진 복제 ( https://positivemh.tistory.com/1149 )
오라클 19c tar 명령을 이용해 db 엔진 복제(runInstaller 미실행) ( https://positivemh.tistory.com/1151 )
오라클 19c tar 명령을 이용해 db 엔진 복제 ( https://positivemh.tistory.com/1150 )