OS 환경 : Oracle Linux 8.4 (64bit)
DB 환경 : Oracle Database 19.24.0.0
방법 : 오라클 19c 골드 이미지 이용해 db 엔진 복제
본문에서는 19c가 설치된 A서버에서 B서버로 골드 이미지를 이용해 엔진을 복제하는 방법을 설명함
골드 이미지란?
간단하게 말해서 오라클 엔진의 복사본임
tar 명령으로도 오라클 엔진 경로를 묶어서 다른곳으로 복제, 이동할 수 있음
패치된 엔진도 가능하고, 서버 os만 같다면 다른 서버로도 옮길 수 있음
tar 방식과 골드 이미지 차이점
tar -cvf :
현재 Oracle 홈의 전체 상태를 그대로 복제하는 방식으로, 모든 파일을 포함하며(network/admin/*.ora 파일 및 dbs/*.ora 파일 등)
, 특정 환경에서의 커스텀 설정이나 로그 파일 등을 포함한 "완전한 복제"를 원할 때 유용함
골드 이미지(runInstaller -createGoldImage) :
클린한 Oracle 설치의 골드 이미지를 생성하는 방식으로, 여러 서버에 표준화된 설치 이미지를 배포할 때 적합함
관리 및 배포가 용이하지만, 커스텀 설정(network/admin/*.ora 파일 및 dbs/*.ora 파일 등)이나 로그 파일 등이 포함되지 않으므로 이러한 부분은 별도로 관리해야함
참고용
오라클 19c tar 명령을 이용해 db 엔진 복제 ( https://positivemh.tistory.com/1150 )
오라클 19c tar 명령을 이용해 db 엔진 복제 (runInstaller 미실행) ( https://positivemh.tistory.com/1151 )
사용법
기존 db 패치 사항 확인
1
2
|
$ cd $ORACLE_HOME/OPatch
$ ./opatch lsinventory
|
모든 오라클 관련 프로세스 정지
1
2
|
SQL> shutdown immediate
$ lsnrctl stop
|
골드 이미지 생성
골드 이미지 저장할 디렉토리 생성
1
|
$ mkdir -p /home/oracle/19c_img
|
골드 이미지 생성
1
2
|
$ cd $ORACLE_HOME
$ ./runInstaller -createGoldImage -destinationLocation /home/oracle/19c_img
|
생성중임
생성 중 골드 이미지가 저장될 디렉토리 확인
1
2
3
4
5
|
$ ls -al
total 1966016
drwxr-xr-x. 2 oracle oinstall 22 Aug 21 01:55 .
drwx------. 8 oracle oinstall 208 Aug 21 01:58 ..
-rw-------. 1 oracle oinstall 1907652083 Aug 21 01:59 ziMdknyU
|
어떤 파일이 만들어지고 있음
log 경로로 이동
1
2
3
4
5
6
7
8
9
10
|
$ cd /app/oraInventory/logs/InstallActions2024-08-21_01-55-26AM
$ ls -ltr
total 88
-rw-r--r--. 1 oracle oinstall 129 Aug 21 01:55 installerPatchActions_2024-08-21_01-55-26AM.log
-rw-r--r--. 1 oracle oinstall 0 Aug 21 01:55 installActions2024-08-21_01-55-26AM.log.lck
-rw-r--r--. 1 oracle oinstall 0 Aug 21 01:55 installActions2024-08-21_01-55-26AM.err
-rw-r--r--. 1 oracle oinstall 0 Aug 21 01:55 installActions2024-08-21_01-55-26AM.out.lck
-rw-r--r--. 1 oracle oinstall 29911 Aug 21 01:55 installActions2024-08-21_01-55-26AM.out
-rw-r--r--. 1 oracle oinstall 2362 Aug 21 01:55 time2024-08-21_01-55-26AM.log
-rw-r--r--. 1 oracle oinstall 48232 Aug 21 01:55 installActions2024-08-21_01-55-26AM.log
|
로그 확인
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
$ tail -300f installActions2024-08-21_01-55-26AM.log
..
INFO: [Aug 21, 2024 1:55:35 AM] -----------Job Distribution------------
INFO: [Aug 21, 2024 1:55:35 AM] Create Gold Image : 1
INFO: [Aug 21, 2024 1:55:35 AM] ---------------------------------------
INFO: [Aug 21, 2024 1:55:35 AM] Creating the Gold Image
INFO: [Aug 21, 2024 1:55:35 AM] Source files.lst exists: false
INFO: [Aug 21, 2024 1:55:35 AM] Recreate files.lst: false
INFO: [Aug 21, 2024 1:55:36 AM] Identified symlink: /app/oracle/product/19c/bin/lbuilder
INFO: [Aug 21, 2024 1:55:36 AM] Identified symlink: /app/oracle/product/19c/lib/libocci.so
INFO: [Aug 21, 2024 1:55:36 AM] Identified symlink: /app/oracle/product/19c/lib/libagtsh.so
INFO: [Aug 21, 2024 1:55:36 AM] Identified symlink: /app/oracle/product/19c/lib/libodm19.so
INFO: [Aug 21, 2024 1:55:36 AM] Identified symlink: /app/oracle/product/19c/lib/libclntsh.so
INFO: [Aug 21, 2024 1:55:36 AM] Identified symlink: /app/oracle/product/19c/lib/libjavavm19.a
INFO: [Aug 21, 2024 1:55:36 AM] Identified symlink: /app/oracle/product/19c/javavm/lib/jce.jar
INFO: [Aug 21, 2024 1:55:36 AM] Identified symlink: /app/oracle/product/19c/lib/libocci.so.18.1
INFO: [Aug 21, 2024 1:55:36 AM] Identified symlink: /app/oracle/product/19c/javavm/admin/cbp.jar
INFO: [Aug 21, 2024 1:55:36 AM] Identified symlink: /app/oracle/product/19c/lib/libclntshcore.so
INFO: [Aug 21, 2024 1:55:36 AM] Identified symlink: /app/oracle/product/19c/lib/libclntsh.so.18.1
INFO: [Aug 21, 2024 1:55:36 AM] Identified symlink: /app/oracle/product/19c/lib/libclntsh.so.10.1
INFO: [Aug 21, 2024 1:55:36 AM] Identified symlink: /app/oracle/product/19c/lib/libclntsh.so.11.1
INFO: [Aug 21, 2024 1:55:36 AM] Identified symlink: /app/oracle/product/19c/lib/libclntsh.so.12.1
INFO: [Aug 21, 2024 1:55:36 AM] Identified symlink: /app/oracle/product/19c/precomp/public/ORACA.H
INFO: [Aug 21, 2024 1:55:36 AM] Identified symlink: /app/oracle/product/19c/precomp/public/SQLDA.H
INFO: [Aug 21, 2024 1:55:36 AM] Identified symlink: /app/oracle/product/19c/precomp/public/SQLCA.H
INFO: [Aug 21, 2024 1:55:36 AM] Identified symlink: /app/oracle/product/19c/javavm/admin/libjtcjt.so
INFO: [Aug 21, 2024 1:55:36 AM] Identified symlink: /app/oracle/product/19c/precomp/public/ORACA.COB
INFO: [Aug 21, 2024 1:55:36 AM] Identified symlink: /app/oracle/product/19c/javavm/admin/classes.bin
INFO: [Aug 21, 2024 1:55:36 AM] Identified symlink: /app/oracle/product/19c/precomp/public/SQLCA.COB
INFO: [Aug 21, 2024 1:55:36 AM] Identified symlink: /app/oracle/product/19c/javavm/admin/lfclasses.bin
INFO: [Aug 21, 2024 1:55:36 AM] Identified symlink: /app/oracle/product/19c/javavm/lib/security/cacerts
INFO: [Aug 21, 2024 1:55:36 AM] Identified symlink: /app/oracle/product/19c/javavm/lib/sunjce_provider.jar
INFO: [Aug 21, 2024 1:55:36 AM] Identified symlink: /app/oracle/product/19c/javavm/lib/security/README.txt
INFO: [Aug 21, 2024 1:55:36 AM] Identified symlink: /app/oracle/product/19c/javavm/lib/security/java.security
INFO: [Aug 21, 2024 1:55:36 AM] File bin/oracle marked to be zero out.
INFO: [Aug 21, 2024 1:55:36 AM] File bin/rman marked to be zero out.
INFO: [Aug 21, 2024 1:55:36 AM] File bin/wrap marked to be zero out.
INFO: [Aug 21, 2024 1:55:36 AM] File bin/orion marked to be zero out.
INFO: [Aug 21, 2024 1:55:36 AM] File lib/clntsh.map marked to be zero out.
INFO: [Aug 21, 2024 1:55:36 AM] File /bin/chrpath does not exist.
INFO: [Aug 21, 2024 1:55:36 AM] Zero out file: bin/rman
INFO: [Aug 21, 2024 1:55:36 AM] Zero out file: bin/oracle
INFO: [Aug 21, 2024 1:55:36 AM] Zero out file: bin/wrap
INFO: [Aug 21, 2024 1:55:36 AM] Zero out file: bin/orion
INFO: [Aug 21, 2024 1:55:36 AM] Zero out file: lib/clntsh.map
INFO: [Aug 21, 2024 1:55:36 AM] Executing [/app/oracle/product/19c/bin/zip, -r, /home/oracle/19c_img/db_home_2024-08-21_01-55-26AM.zip, .]
INFO: [Aug 21, 2024 1:55:36 AM] Starting Output Reader Threads for process /app/oracle/product/19c/bin/zip
(이 부분에서 한참동안 로그가 발생하지 않음)
INFO: [Aug 21, 2024 2:02:29 AM] The process /app/oracle/product/19c/bin/zip exited with code 0
INFO: [Aug 21, 2024 2:02:29 AM] Waiting for output processor threads to exit.
INFO: [Aug 21, 2024 2:02:29 AM] Output processor threads exited.
INFO: [Aug 21, 2024 2:02:29 AM] Executing [/app/oracle/product/19c/bin/zip, -q, -y, -g, /home/oracle/19c_img/db_home_2024-08-21_01-55-26AM.zip, bin/lbuilder, lib/libocci.so, lib/libagtsh.so, lib/libodm19.so, lib/libclntsh.so, lib/libjavavm19.a, javavm/lib/jce.jar, lib/libocci.so.18.1, javavm/admin/cbp.jar, lib/libclntshcore.so, lib/libclntsh.so.18.1, lib/libclntsh.so.10.1, lib/libclntsh.so.11.1, lib/libclntsh.so.12.1, precomp/public/ORACA.H, precomp/public/SQLDA.H, precomp/public/SQLCA.H, javavm/admin/libjtcjt.so, precomp/public/ORACA.COB, javavm/admin/classes.bin, precomp/public/SQLCA.COB, javavm/admin/lfclasses.bin, javavm/lib/security/cacerts, javavm/lib/sunjce_provider.jar, javavm/lib/security/README.txt, javavm/lib/security/java.security]
INFO: [Aug 21, 2024 2:02:29 AM] Starting Output Reader Threads for process /app/oracle/product/19c/bin/zip
INFO: [Aug 21, 2024 2:02:29 AM] The process /app/oracle/product/19c/bin/zip exited with code 0
INFO: [Aug 21, 2024 2:02:29 AM] Waiting for output processor threads to exit.
INFO: [Aug 21, 2024 2:02:29 AM] Output processor threads exited.
INFO: [Aug 21, 2024 2:02:29 AM] Executing [/app/oracle/product/19c/OPatch/opatch, lspatches]
INFO: [Aug 21, 2024 2:02:29 AM] Starting Output Reader Threads for process /app/oracle/product/19c/OPatch/opatch
INFO: [Aug 21, 2024 2:02:34 AM] 36582781;Database Release Update : 19.24.0.0.240716 (36582781)
INFO: [Aug 21, 2024 2:02:34 AM] 29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399)
INFO: [Aug 21, 2024 2:02:34 AM]
INFO: [Aug 21, 2024 2:02:34 AM] OPatch succeeded.
INFO: [Aug 21, 2024 2:02:34 AM] The process /app/oracle/product/19c/OPatch/opatch exited with code 0
INFO: [Aug 21, 2024 2:02:34 AM] Waiting for output processor threads to exit.
INFO: [Aug 21, 2024 2:02:34 AM] Output processor threads exited.
INFO: [Aug 21, 2024 2:02:34 AM] Executing [/app/oracle/product/19c/bin/zip, -q, -r, -g, /home/oracle/19c_img/db_home_2024-08-21_01-55-26AM.zip, .]
INFO: [Aug 21, 2024 2:02:34 AM] Starting Output Reader Threads for process /app/oracle/product/19c/bin/zip
INFO: [Aug 21, 2024 2:02:46 AM] The process /app/oracle/product/19c/bin/zip exited with code 0
INFO: [Aug 21, 2024 2:02:46 AM] Waiting for output processor threads to exit.
INFO: [Aug 21, 2024 2:02:46 AM] Output processor threads exited.
INFO: [Aug 21, 2024 2:02:46 AM] Successfully verified the contents of the created goldimage /home/oracle/19c_img/db_home_2024-08-21_01-55-26AM.zip
INFO: [Aug 21, 2024 2:02:46 AM] Waiting for completion of background operations
INFO: [Aug 21, 2024 2:02:46 AM] Finishing all forked tasks at state setup
INFO: [Aug 21, 2024 2:02:46 AM] Waiting for completion all forked tasks at state setup
INFO: [Aug 21, 2024 2:02:46 AM] Setup completed with overall status as Succeeded
INFO: [Aug 21, 2024 2:02:46 AM] All forked task are completed at state setup
INFO: [Aug 21, 2024 2:02:46 AM] Completed background operations
INFO: [Aug 21, 2024 2:02:46 AM] Validating view at state <setup>
INFO: [Aug 21, 2024 2:02:46 AM] Completed validating view at state <setup>
INFO: [Aug 21, 2024 2:02:46 AM] Validating state <setup>
INFO: [Aug 21, 2024 2:02:46 AM] Completed validating state <setup>
INFO: [Aug 21, 2024 2:02:46 AM] Verifying route success
INFO: [Aug 21, 2024 2:02:46 AM] Get view named [FinishUI]
INFO: [Aug 21, 2024 2:02:46 AM] View for [FinishUI] is oracle.install.ivw.db.view.FinishUI@7e352e0c
INFO: [Aug 21, 2024 2:02:46 AM] Waiting for completion of background operations
INFO: [Aug 21, 2024 2:02:46 AM] Completed background operations
INFO: [Aug 21, 2024 2:02:46 AM] Initializing view <FinishUI> at state <finish>
INFO: [Aug 21, 2024 2:02:46 AM] Completed initializing view <FinishUI> at state <finish>
INFO: [Aug 21, 2024 2:02:46 AM] Displaying view <FinishUI> at state <finish>
INFO: [Aug 21, 2024 2:02:46 AM] Completed displaying view <FinishUI> at state <finish>
INFO: [Aug 21, 2024 2:02:46 AM] Loading view <FinishUI> at state <finish>
INFO: [Aug 21, 2024 2:02:46 AM] Install Succeeded: true
INFO: [Aug 21, 2024 2:02:46 AM] Config Tool Succeeded: true
INFO: [Aug 21, 2024 2:02:46 AM] Remote Install Succeeded: true
INFO: [Aug 21, 2024 2:02:46 AM] Completed loading view <FinishUI> at state <finish>
INFO: [Aug 21, 2024 2:02:46 AM] Localizing view <FinishUI> at state <finish>
INFO: [Aug 21, 2024 2:02:46 AM] Completed localizing view <FinishUI> at state <finish>
INFO: [Aug 21, 2024 2:02:46 AM] Waiting for completion of background operations
INFO: [Aug 21, 2024 2:02:46 AM] Completed background operations
INFO: [Aug 21, 2024 2:02:46 AM] Executing action at state finish
INFO: [Aug 21, 2024 2:02:46 AM] FinishAction Actions.execute called
INFO: [Aug 21, 2024 2:02:46 AM] Completed executing action at state <finish>
INFO: [Aug 21, 2024 2:02:46 AM] Waiting for completion of background operations
INFO: [Aug 21, 2024 2:02:46 AM] Completed background operations
INFO: [Aug 21, 2024 2:02:46 AM] Waiting for completion of background operations
INFO: [Aug 21, 2024 2:02:46 AM] Completed background operations
INFO: [Aug 21, 2024 2:02:46 AM] Moved to state <finish>
INFO: [Aug 21, 2024 2:03:17 AM] inventory location is/app/oraInventory
INFO: [Aug 21, 2024 2:03:17 AM] Exit Status is 0
INFO: [Aug 21, 2024 2:03:17 AM] Shutdown Oracle Database 19c Installer
INFO: [Aug 21, 2024 2:03:17 AM] Unloading Setup Driver
|
완료됨
골드 이미지 경로로 이동 후 확인
1
2
3
4
|
$ cd /home/oracle/19c_img/
$ ls -lh
total 4.4G
-rw-r--r--. 1 oracle oinstall 4.4G Aug 21 02:02 db_home_2024-08-21_01-55-26AM.zip
|
골드 이미지가 정상적으로 생성됨
골드 이미지를 B서버로 전송
1
2
3
|
$ scp db_home_2024-08-21_01-55-26AM.zip 192.168.137.50:/home/oracle/19c_img
oracle@192.168.137.50's password:
db_home_2024-08-21_01-55-26AM.zip
|
정상적으로 전송됨
B 서버에서 파일 확인
1
2
3
4
5
|
$ ls -al /home/oracle/19c_img/
total 4556752
drwxr-xr-x. 2 oracle oinstall 47 Aug 21 21:32 .
drwx------. 6 oracle oinstall 169 Aug 21 21:31 ..
-rw-r--r--. 1 oracle oinstall 4666113340 Aug 21 21:28 db_home_2024-08-21_01-55-26AM.zip
|
정상적으로 받아짐
B 서버에서 오라클 환경 설정
아래 게시글 참고
Oracle Linux 8.4에 Oracle 19c 설치 가이드 ( https://positivemh.tistory.com/1144 )
hostname을 copy1로 설정하였음
그리고 설치 경로 생성 부분에서 mkdir -p /app/oracle/product/19c를 mkdir -p /app/oracle/product/19c_1로 변경하여 생성함
1
2
3
|
# mkdir -p /app/oracle/product/19c_1
# chown -R oracle:dba /app
# chmod -R 775 /app
|
.bash_profile 의 ORACLE_HOME도 /app/oracle/product/19c에서 /app/oracle/product/19c_1 로 수정
1
2
3
4
5
|
$ vi .bash_profile
(생략)
export ORACLE_BASE=/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19c_1
(생략)
|
$ORACLE_HOME으로 이동 후 unzip(압축해제)
1
2
3
4
|
$ cd $ORACLE_HOME
$ pwd
/app/oracle/product/19c_1
$ unzip /home/oracle/19c_img/db_home_2024-08-21_01-55-26AM.zip
|
unzip(압축해제)후 network/admin/, dbs 경로 확인
1
2
3
4
5
6
7
8
9
10
11
|
$ ls -al network/admin/
total 4
drwxr-xr-x. 3 oracle oinstall 39 Aug 21 01:55 .
drwxr-xr-x. 10 oracle oinstall 106 Aug 21 01:55 ..
drwxr-xr-x. 2 oracle oinstall 64 Apr 17 2019 samples
-rw-r--r--. 1 oracle oinstall 1536 Feb 14 2018 shrept.lst
$ ls -al dbs/
total 8
drwxr-xr-x. 2 oracle oinstall 22 Aug 21 01:55 .
drwxrwxr-x. 71 oracle dba 4096 Aug 21 21:35 ..
-rw-r--r--. 1 oracle oinstall 3079 May 14 2015 init.ora
|
기존 db엔진을 가져왔지만 골드 이미지로 만들어서 가져왔기 때문에 기존 db의 설정 파일들은 존재하지 않음
db 엔진 설치
1
2
|
$ export CV_ASSUME_DISTID=OEL7.6
$ ./runInstaller
|
Oracle Linux 8.4에 Oracle 19c 설치 가이드 ( https://positivemh.tistory.com/1144 )
게시글처럼 동일하게 진행
리스너 설정
1
|
$ netca
|
Oracle Linux 8.4에 Oracle 19c 설치 가이드 ( https://positivemh.tistory.com/1144 )
게시글처럼 동일하게 진행
db 생성
1
|
$ dbca
|
Oracle Linux 8.4에 Oracle 19c 설치 가이드 ( https://positivemh.tistory.com/1144 )
게시글처럼 동일하게 진행
db 패치 적용
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
|
$ cd $ORACLE_HOME/OPatch
$ ./datapatch -verbose
SQL Patching tool version 19.24.0.0.0 Production on Wed Aug 21 22:49:59 2024
Copyright (c) 2012, 2024, Oracle. All rights reserved.
Log file for this invocation: /app/oracle/cfgtoollogs/sqlpatch/sqlpatch_51355_2024_08_21_22_49_59/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:
No interim patches found
Current state of release update SQL patches:
Binary registry:
19.24.0.0.0 Release_Update 240627235157: Installed
SQL registry:
Applied 19.24.0.0.0 Release_Update 240627235157 successfully on 21-AUG-24 10.27.28.101498 PM
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
No interim patches need to be applied
SQL Patching tool complete on Wed Aug 21 22:50:22 2024
|
패치 내역 확인
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
SQL>
set linesize 400
column action_time format a20
column action format a10
column status format a10
column description format a60
column version format a10
select to_char(action_time, 'yyyymmdd hh24:mi:ss') as action_time
,action
,status
,description
,source_version
,target_version
,patch_id
from dba_registry_sqlpatch
order by action_time
/
ACTION_TIME ACTION STATUS DESCRIPTION SOURCE_VERSION TARGET_VERSION PATCH_ID
-------------------- ---------- ---------- ------------------------------------------------------------ --------------- --------------- ----------
20240821 22:27:28 APPLY SUCCESS Database Release Update : 19.24.0.0.240716 (36582781) 19.1.0.0.0 19.24.0.0.0 36582781
|
결론 : 골드 이미지를 이용해 클린한 패치된 엔진을 쉽게 복제 할 수 있음
참조 :
Gold Image How To (Doc ID 2965269.1)
https://docs.oracle.com/en/database/oracle/oracle-database/19/ladbi/cloning-an-oracle-home.html#GUID-494E59C3-C381-4A35-8ABE-F6E5DBF29032
https://positivemh.tistory.com/669
https://positivemh.tistory.com/803
https://positivemh.tistory.com/1144
https://positivemh.tistory.com/1145
'ORACLE > Admin' 카테고리의 다른 글
오라클 19c tar 명령을 이용해 db 엔진 복제(runInstaller 미실행) (0) | 2024.09.03 |
---|---|
오라클 19c tar 명령을 이용해 db 엔진 복제 (0) | 2024.08.31 |
오라클 19c 비파티션 테이블에서 파티션 테이블 온라인 전환 방법 (0) | 2024.08.24 |
오라클 19c sys 유저도 lock이 걸릴까? (0) | 2024.08.06 |
오라클 19c varchar2 컬럼에서 clob 으로 변경 가이드 (0) | 2024.07.31 |