-
DB Oracle21 ASM + RAC 환경 구축하기(With.OS 환경 설치) 2편Programming and Database/SQL 2024. 6. 10. 01:00728x90반응형
▣ DB Oracle ASM + RAC 환경 구축하기(With.OS 환경 설치) 2편
※ ORACLE ASM + RAC 구성 실습을 위한 사전 준비 사항
01. 실습환경 : Oracle VM VirtualBox 7.0
■ Download URL : https://www.virtualbox.org/
02. 테스트용 서버 : Oracle Linux 8.7
■ Download URL : https://yum.oracle.com/oracle-linux-isos.html
03. 테스트에 사용될 IP 구성 정보
■ 리눅스서버#1(ol8rac1) vip : 192.168.0.163
■ 리눅스서버#2(ol8rac2) vip : 192.168.0.164
■ 리눅스서버#1(ol8rac1) real ip : 192.168.0.161
■ 리눅스서버#2(ol8rac2) real ip : 192.168.0.162
■ 리눅스서버#1(ol8rac1) priv ip : 192.168.56.161
■ 리눅스서버#2(ol8rac2) priv ip : 192.168.56.162
■ 리눅스서버#1(ol8rac1) , 리눅스서버#2(ol8rac2) scan ip : 192.168.0.165[root@localhost ~]# ip addr | grep -i 192 inet 192.168.0.161/24 brd 192.168.0.255 scope global noprefixroute enp0s3 inet 192.168.56.161/24 brd 192.168.56.255 scope global noprefixroute enp0s8
▶ 테스트에 사용될 IP 구성정보를 통해서 enp03 인터페이스에는 192.168.0.161 real ip를 부여하고, enp0s8 인터페이스에는 192.168.56.161 priv ip를 부여한 것을 확인할 수 있습니다.
[root@localhost ~]# dnf install oracle-database-preinstall-21c Oracle Linux 8 BaseOS Latest (x86_64) 6.4 MB/s | 74 MB 00:11 Oracle Linux 8 Application Stream (x86_64) 3.6 MB/s | 56 MB 00:15 Latest Unbreakable Enterprise Kernel Release 7 for Oracle Li 4.7 MB/s | 33 MB 00:06 Last metadata expiration check: 0:00:13 ago on Mon 13 May 2024 10:28:22 PM KST. Dependencies resolved. ============================================================================================= Package Arch Version Repository Size ============================================================================================= Installing: oracle-database-preinstall-21c x86_64 1.0-1.el8 ol8_appstream 30 k Installing dependencies: compat-openssl10 x86_64 1:1.0.2o-4.el8_6 ol8_appstream 1.1 M glibc-devel x86_64 2.28-211.0.1.el8 ol8_baseos_latest 83 k ksh x86_64 20120801-259.0.1.el8 ol8_appstream 923 k libnsl x86_64 2.28-211.0.1.el8 ol8_baseos_latest 105 k libxcrypt-devel x86_64 4.1.1-6.el8 ol8_baseos_latest 25 k lm_sensors-libs x86_64 3.4.0-23.20180522git70f7e08.el8 ol8_baseos_latest 59 k make x86_64 1:4.2.1-11.el8 ol8_baseos_latest 498 k sysstat x86_64 11.7.3-11.0.1.el8 ol8_appstream 427 k Transaction Summary ============================================================================================= Install 9 Packages Total download size: 3.2 M Installed size: 9.4 M Is this ok [y/N]: y Downloading Packages: (1/9): libxcrypt-devel-4.1.1-6.el8.x86_64.rpm 38 kB/s | 25 kB 00:00 (2/9): glibc-devel-2.28-211.0.1.el8.x86_64.rpm 118 kB/s | 83 kB 00:00 (3/9): libnsl-2.28-211.0.1.el8.x86_64.rpm 143 kB/s | 105 kB 00:00 (4/9): lm_sensors-libs-3.4.0-23.20180522git70f7e08.el8.x86_6 402 kB/s | 59 kB 00:00 (5/9): make-4.2.1-11.el8.x86_64.rpm 1.0 MB/s | 498 kB 00:00 (6/9): compat-openssl10-1.0.2o-4.el8_6.x86_64.rpm 2.5 MB/s | 1.1 MB 00:00 (7/9): oracle-database-preinstall-21c-1.0-1.el8.x86_64.rpm 289 kB/s | 30 kB 00:00 (8/9): ksh-20120801-259.0.1.el8.x86_64.rpm 1.0 MB/s | 923 kB 00:00 (9/9): sysstat-11.7.3-11.0.1.el8.x86_64.rpm 450 kB/s | 427 kB 00:00 --------------------------------------------------------------------------------------------- ...(생략) Installed: compat-openssl10-1:1.0.2o-4.el8_6.x86_64 glibc-devel-2.28-211.0.1.el8.x86_64 ksh-20120801-259.0.1.el8.x86_64 libnsl-2.28-211.0.1.el8.x86_64 libxcrypt-devel-4.1.1-6.el8.x86_64 lm_sensors-libs-3.4.0-23.20180522git70f7e08.el8.x86_64 make-1:4.2.1-11.el8.x86_64 oracle-database-preinstall-21c-1.0-1.el8.x86_64 sysstat-11.7.3-11.0.1.el8.x86_64 Complete!
▶ dnf install oracle-database-preinstall-21c 명령어를 통해서 DB 설치를 위한 패키지를 다운로드 후 설치합니다.
[root@localhost ~]# cat /etc/group | grep -i dba | head -n 1; cat /etc/group | grep -i oracle | tail -n 1 dba:x:54322: oracle:x:1000: [root@localhost ~]# id oracle uid=1000(oracle) gid=1000(oracle) groups=1000(oracle),10(wheel)
▶ 오라클리눅스 운영체제 설치시 기본 그룹으로 oracle 그룹이 생성됩니다. 일반적으로 dba 그룹을 사용하거나, 별도의 그룹을 생성하여 구성은 가능하나, 테스트 환경에서는 dba 그룹을 사용하도록 하겠습니다.
[root@localhost ~]# usermod -g dba oracle [root@localhost ~]# id oracle uid=1000(oracle) gid=54322(dba) groups=54322(dba),10(wheel)
▶ oracle 유저를 처음 설치할때 생성한 경우는 기본 그룹을 dba로 변경합니다.
[root@localhost ~]# cat /etc/group | grep -i wheel; cat /etc/group | grep -i oracle | tail -n 1 wheel:x:10:oracle oracle:x:1000: [root@localhost ~]# groupdel oracle; groupdel wheel
▶ 기본으로 생성되는 wheel 그룹과 함께 oracle 그룹은 사용하지 않기 때문에 삭제하도록 합니다.
[root@localhost ~]# id oracle uid=1000(oracle) gid=54322(dba) groups=54322(dba)
▶ oracle 계정에 대해 gid,group 모두 dba로 지정된 것을 확인할 수 있습니다
[root@localhost /]# mkdir -p /u01/app/grid [root@localhost /]# mkdir -p /u01/21.3.0/grid [root@localhost /]# chown -R oracle:dba /u01 [root@localhost /]# chmod -R 775 /u01
▶ oracle,grid 엔진설치를 위해 /u01 디렉터리를 생성 후 해당 퍼미션 및 소유자 권한을 부여합니다.
[root@localhost /]# ls -ltr | grep -i u01 drwxrwxr-x. 4 oracle dba 31 May 13 22:47 u01 [root@localhost u01]# ls -ltr drwxr-xr-x. 3 oracle dba 18 May 13 22:46 app drwxr-xr-x. 3 oracle dba 18 May 13 22:47 21.3.0
▶ 디렉토리 생성과 퍼미션, 권한이 지정한 대로 설정이 되어 있는지 확인합니다.
[root@localhost /]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 ### Public IP 192.168.0.161 ol8rac1 192.168.0.162 ol8rac2 ### Private IP 192.168.56.161 ol8rac1-priv 192.168.56.162 ol8rac2-priv ## Virtual IP 192.168.0.163 ol8rac1-vip 192.168.0.164 ol8rac2-vip ## Scan IP 192.168.0.165 ol8rac-scan
▶ /etc/hosts 파일에 테스트 환경을 위한 IP 주소를 등록합니다.
[root@localhost /]# hostnamectl set-hostname ol8rac1 [root@localhost /]# hostnamectl set-hostname ol8rac1 --pretty [root@localhost /]# hostnamectl set-hostname ol8rac1 --static [root@localhost /]# hostnamectl set-hostname ol8rac1 --transient [root@localhost /]# hostnamectl status Static hostname: ol8rac1 Icon name: computer-vm Chassis: vm Machine ID: 8ff48dc53c9f44c0bcccb0eabf6d6367 Boot ID: 01f87974ae3c4636aaf26ac1582e05d0 Virtualization: oracle Operating System: Oracle Linux Server 8.7 CPE OS Name: cpe:/o:oracle:linux:8:7:server Kernel: Linux 5.15.0-3.60.5.1.el8uek.x86_64 Architecture: x86-64 [root@ol8rac1 ~]# hostname ol8rac1
▶ localhost 이름을 변경하기 위해 hostnameclt set-hostname을 통해 ol8rac1 호스트네임으로 이름을 변경합니다.
[root@ol8rac1 ~]# grep MemTotal /proc/meminfo MemTotal: 8135084 kB [root@ol8rac1 ~]# grep SwapTotal /proc/meminfo SwapTotal: 4296700 kB
▶ 최초 테스트 환경시 메모리를 8GB로 지정하였고, SWAP 메모리의경우 일반적으로 1.5배의 사이즈로 지정을 하게 되는데 자동으로 OS 설치함으로 인해 기본 최소사양의 SWAP 설정으로 지정되어 SWAP 사이즈를 늘려주도록 하겠습니다.
[root@ol8rac1 ~]# dd if=/dev/zero of=/etc/swapfile bs=1024 count=5000000 5000000+0 records in 5000000+0 records out 5120000000 bytes (5.1 GB, 4.8 GiB) copied, 45.573 s, 112 MB/s [root@ol8rac1 ~]# mkswap /etc/swapfile mkswap: /etc/swapfile: insecure permissions 0644, 0600 suggested. Setting up swapspace version 1, size = 4.8 GiB (5119995904 bytes) no label, UUID=82617109-5580-4d53-81a7-3b3d92f4f506 [root@ol8rac1 ~]# swapon /etc/swapfile swapon: /etc/swapfile: insecure permissions 0644, 0600 suggested. [root@ol8rac1 ~]# grep SwapTotal /proc/meminfo SwapTotal: 9296696 kB -> 증설 dd if=/dev/zero of=/etc/swapfile bs=1024 count=5000000 mkswap /etc/swapfile swapon /etc/swapfile
▶ SWAP 메모리를 온라인중에 증설하기 위해서 dd 명령어를 통해서 swap 사이즈를 조정합니다.
[root@ol8rac1 ~]# vi /etc/fstab # # /etc/fstab # Created by anaconda on Thu May 9 15:01:56 2024 # # Accessible filesystems, by reference, are maintained under '/dev/disk/'. # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info. # # After editing this file, run 'systemctl daemon-reload' to update systemd # units generated from this file. # /dev/mapper/ol-root / xfs defaults 0 0 UUID=0396aca6-a3e4-4c3e-90ca-095c8e186034 /boot xfs defaults 0 0 /dev/mapper/ol-swap none swap defaults 0 0 /etc/swapfile swap swap defaults 0 0 -> 추가
▶ /etc/fstab Config 파일에 /etc/swapfile swap swap defaults 0 0 내용을 추가합니다.
[root@ol8rac1 ~]# cat /etc/security/limits.conf # /etc/security/limits.conf # #This file sets the resource limits for the users logged in via PAM. #It does not affect resource limits of the system services. # #Also note that configuration files in /etc/security/limits.d directory, #which are read in alphabetical order, override the settings in this #file in case the domain is the same or more specific. #That means for example that setting a limit for wildcard domain here #can be overriden with a wildcard setting in a config file in the #subdirectory, but a user specific setting here can be overriden only #with a user specific setting in the subdirectory. # #Each line describes a limit for a user in the form: # #<domain> <type> <item> <value> # #Where: #<domain> can be: # - a user name # - a group name, with @group syntax # - the wildcard *, for default entry # - the wildcard %, can be also used with %group syntax, # for maxlogin limit # #<type> can have the two values: # - "soft" for enforcing the soft limits # - "hard" for enforcing hard limits # #<item> can be one of the following: # - core - limits the core file size (KB) # - data - max data size (KB) # - fsize - maximum filesize (KB) # - memlock - max locked-in-memory address space (KB) # - nofile - max number of open file descriptors # - rss - max resident set size (KB) # - stack - max stack size (KB) # - cpu - max CPU time (MIN) # - nproc - max number of processes # - as - address space limit (KB) # - maxlogins - max number of logins for this user # - maxsyslogins - max number of logins on the system # - priority - the priority to run user process with # - locks - max number of file locks the user can hold # - sigpending - max number of pending signals # - msgqueue - max memory used by POSIX message queues (bytes) # - nice - max nice priority allowed to raise to values: [-20, 19] # - rtprio - max realtime priority # #<domain> <type> <item> <value> # #* soft core 0 #* hard rss 10000 #@student hard nproc 20 #@faculty soft nproc 20 #@faculty hard nproc 50 #ftp hard nproc 0 #@student - maxlogins 4 # End of file ###Add Oracle RAC Parameter oracle soft nofile 4096 -> 추가 oracle hard nofile 65536 -> 추가 oracle soft nproc 16384 -> 추가 oracle hard nproc 16384 -> 추가 oracle soft stack 10240 -> 추가 oracle hard stack 32768 -> 추가 oracle soft memlock 3145728 -> 추가 oracle hard memlock 3145728 -> 추가
▶ /etc/security/limit.conf 파일을 수정하여 Add Oracle RAC Parameter 값을 추가로 넣어줍니다.(재기동 필요)
[root@ol8rac1 ~]# systemctl enable chronyd Created symlink /etc/systemd/system/multi-user.target.wants/chronyd.service → /usr/lib/systemd/system/chronyd.service. [root@ol8rac1 ~]# systemctl start chronyd [root@ol8rac1 ~]# systemctl status chronyd | grep -i active Active: active (running) since Mon 2024-05-13 23:28:46 KST; 16s ago
▶ Grid Infrastructure 설치 시 NTP에 대한 설정 정보를 물어보기 때문에 NTP 데몬 활성화 후 설정을 하도록 합니다.
[root@ol8rac1 ~]# chronyc sources -v .-- Source mode '^' = server, '=' = peer, '#' = local clock. / .- Source state '*' = current best, '+' = combined, '-' = not combined, | / 'x' = may be in error, '~' = too variable, '?' = unusable. || .- xxxx [ yyyy ] +/- zzzz || Reachability register (octal) -. | xxxx = adjusted offset, || Log2(Polling interval) --. | | yyyy = measured offset, || \ | | zzzz = estimated error. || | | \ MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^- 121.162.54.1 3 6 17 27 +15ms[ +15ms] +/- 55ms ^* 39.118.108.234 3 6 17 27 +37us[-5604us] +/- 17ms [root@ol8rac1 ~]# timedatectl Local time: Mon 2024-05-13 23:29:52 KST Universal time: Mon 2024-05-13 14:29:52 UTC RTC time: Mon 2024-05-13 14:29:05 Time zone: Asia/Seoul (KST, +0900) System clock synchronized: yes NTP service: active RTC in local TZ: no
▶ timedatectl or chronyc sources -v 명령어를 통해서 NTP 외부 서버와 동기화가 되었는지 확인합니다.
2024.06.09 - [Programming and Database/SQL] - DB Oracle ASM + RAC 환경 구축하기(With.H/W 환경 설치) 1편
2024.06.09 - [Programming and Database/SQL] - DB Oracle ASM + RAC 환경 구축하기(With.공유스토리지 구성) 3편
2024.06.09 - [Programming and Database/SQL] - DB Oracle ASM + RAC 환경 구축하기(With. ORACLE ASM 구성) 4편
2024.06.09 - [Programming and Database/SQL] - DB Oracle ASM init 모듈 활성화 실패 해결 방법
PS. 포스팅의 내용은 제 기준으로 작성한 것이기 때문에 참고해서 보시면 감사하겠습니다.
포스팅 과정의 오류 및 오타 그리고 궁금한 점에 대해서는 댓글 남겨주세요.
해당 포스팅의 경우 유튜브 쌉DBA님의 동영상을 참고하여 작성했습니다.
728x90반응형'Programming and Database > SQL' 카테고리의 다른 글
DB Oracle21 ASM + RAC 환경 구축하기(With. ORACLE ASM 구성) 4편 (4) 2024.06.12 DB Oracle21 ASM + RAC 환경 구축하기(With.공유스토리지 구성) 3편 (0) 2024.06.11 DB Oracle21 ASM + RAC 환경 구축하기(With.H/W 환경 설치) 1편 (0) 2024.06.09 DB Oracle Where문 활용하는 방법(1) (2) 2023.02.15 DB Oracle Select문 활용하는 방법 (4) 2023.02.11