DATABASE(oracleDB 11g)/RAC

[RAC]virtual box 에서 RAC 설치_4_공유디스크 준비

SEUNGSAMI 2019. 6. 20. 15:19
 











[Win]+R => cmd


SET PATH=C:\Program Files\Oracle\VirtualBox;%PATH%
e:
mkdir E:\Image\11gRAC_OEL54\shared_storage
cd E:\Image\11gRAC_OEL54\shared_storage


# Create the disks and associate them with VirtualBox as virtual media.
VBoxManage createhd --filename asm01.vdi --size 4096 --format VDI --variant Fixed
VBoxManage createhd --filename asm02.vdi --size 4096 --format VDI --variant Fixed
VBoxManage createhd --filename asm03.vdi --size 4096 --format VDI --variant Fixed
VBoxManage createhd --filename asm04.vdi --size 4096 --format VDI --variant Fixed
VBoxManage createhd --filename asm05.vdi --size 2048 --format VDI --variant Fixed
VBoxManage createhd --filename asm06.vdi --size 2048 --format VDI --variant Fixed
VBoxManage createhd --filename asm07.vdi --size 2048 --format VDI --variant Fixed
VBoxManage createhd --filename asm08.vdi --size 2048 --format VDI --variant Fixed
VBoxManage createhd --filename asm09.vdi --size 2048 --format VDI --variant Fixed
VBoxManage createhd --filename asm10.vdi --size 2048 --format VDI --variant Fixed
VBoxManage createhd --filename raw01.vdi --size 20480 --format VDI --variant Fixed
-- 디스크를 만드는 작업


# Connect them to the VM.
VBoxManage storageattach RAC1 --storagectl "SATA" --port 2 --device 0 --type hdd --medium asm01.vdi --mtype shareable
VBoxManage storageattach RAC1 --storagectl "SATA" --port 3 --device 0 --type hdd --medium asm02.vdi --mtype shareable
VBoxManage storageattach RAC1 --storagectl "SATA" --port 4 --device 0 --type hdd --medium asm03.vdi --mtype shareable
VBoxManage storageattach RAC1 --storagectl "SATA" --port 5 --device 0 --type hdd --medium asm04.vdi --mtype shareable
VBoxManage storageattach RAC1 --storagectl "SATA" --port 6 --device 0 --type hdd --medium asm05.vdi --mtype shareable
VBoxManage storageattach RAC1 --storagectl "SATA" --port 7 --device 0 --type hdd --medium asm06.vdi --mtype shareable
VBoxManage storageattach RAC1 --storagectl "SATA" --port 8 --device 0 --type hdd --medium asm07.vdi --mtype shareable
VBoxManage storageattach RAC1 --storagectl "SATA" --port 9 --device 0 --type hdd --medium asm08.vdi --mtype shareable
VBoxManage storageattach RAC1 --storagectl "SATA" --port 10 --device 0 --type hdd --medium asm09.vdi --mtype shareable
VBoxManage storageattach RAC1 --storagectl "SATA" --port 11 --device 0 --type hdd --medium asm10.vdi --mtype shareable
VBoxManage storageattach RAC1 --storagectl "SATA" --port 12 --device 0 --type hdd --medium raw01.vdi --mtype shareable
-- 만든 디스크를 현재 사용하는 가상 이미지에 연결하는 작업
-- 어떠한 포트를 사용하는 지 확인 하여야한다.
-- 현재 포트 1번(로컬디스크)은 건너뛰었다.


$ # Make shareable.
VBoxManage modifyhd asm01.vdi --type shareable
VBoxManage modifyhd asm02.vdi --type shareable
VBoxManage modifyhd asm03.vdi --type shareable
VBoxManage modifyhd asm04.vdi --type shareable
VBoxManage modifyhd asm05.vdi --type shareable
VBoxManage modifyhd asm06.vdi --type shareable
VBoxManage modifyhd asm07.vdi --type shareable
VBoxManage modifyhd asm08.vdi --type shareable
VBoxManage modifyhd asm09.vdi --type shareable
VBoxManage modifyhd asm10.vdi --type shareable
VBoxManage modifyhd raw01.vdi --type shareable
-- 2번 노드에서도 접근해야 할 수 있게 하기 위해 다음 명령어를 실행

# booting !!




########################################################
## login as: root

# 공유 디스크 설정
fdisk -l


fdisk /dev/sdb
n,p,1,ENTER,ENTER,w


fdisk /dev/sdc
n,p,1,ENTER,ENTER,w


fdisk /dev/sdd
n,p,1,ENTER,ENTER,w


fdisk /dev/sde
n,p,1,ENTER,ENTER,w


fdisk /dev/sdf
n,p,1,ENTER,ENTER,w


fdisk /dev/sdg
n,p,1,ENTER,ENTER,w


fdisk /dev/sdh
n,p,1,ENTER,ENTER,w


fdisk /dev/sdi
n,p,1,ENTER,ENTER,w


fdisk /dev/sdj
n,p,1,ENTER,ENTER,w


fdisk /dev/sdk
n,p,1,ENTER,ENTER,w


fdisk /dev/sdl
n,p,1,ENTER,ENTER,t,8e,w
-- raw device




###################################
# for ASM Device
###################################


oracleasm configure -i
#Default user to own the driver interface []: grid
#Default group to own the driver interface []: asmadmin
#Start Oracle ASM library driver on boot (y/n) [n]: y
#Scan for Oracle ASM disks on boot (y/n) [y]: y
#Writing Oracle ASM library driver configuration: done


/usr/sbin/oracleasm init
oracleasm status


oracleasm createdisk ASMDISK01 /dev/sdb1
oracleasm createdisk ASMDISK02 /dev/sdc1
oracleasm createdisk ASMDISK03 /dev/sdd1
oracleasm createdisk ASMDISK04 /dev/sde1
oracleasm createdisk ASMDISK05 /dev/sdf1
oracleasm createdisk ASMDISK06 /dev/sdg1
oracleasm createdisk ASMDISK07 /dev/sdh1
oracleasm createdisk ASMDISK08 /dev/sdi1
oracleasm createdisk ASMDISK09 /dev/sdj1
oracleasm createdisk ASMDISK10 /dev/sdk1


oracleasm scandisks
oracleasm listdisks


###################################
# for Raw Device
###################################
pvcreate /dev/sdl1

vgcreate vgraw01 /dev/sdl1

lvcreate -L 300M  -n lv300M01 vgraw01
lvcreate -L 300M  -n lv300M02 vgraw01
lvcreate -L 300M  -n lv300M03 vgraw01
lvcreate -L 300M  -n lv300M04 vgraw01
lvcreate -L 300M  -n lv300M05 vgraw01
lvcreate -L 100M  -n lv100M01 vgraw01
lvcreate -L 100M  -n lv100M02 vgraw01
lvcreate -L 100M  -n lv100M03 vgraw01
lvcreate -L 108M  -n lv100M04 vgraw01
lvcreate -L 108M  -n lv100M05 vgraw01
lvcreate -L 108M  -n lv100M06 vgraw01
lvcreate -L 108M  -n lv100M07 vgraw01
lvcreate -L 108M  -n lv100M08 vgraw01
lvcreate -L 108M  -n lv100M09 vgraw01
lvcreate -L 108M  -n lv100M10 vgraw01
lvcreate -L 108M  -n lv100M11 vgraw01
lvcreate -L 108M  -n lv100M12 vgraw01
lvcreate -L 108M  -n lv100M13 vgraw01
lvcreate -L 708M  -n lv700M01 vgraw01
lvcreate -L 708M  -n lv700M02 vgraw01
lvcreate -L 708M  -n lv700M03 vgraw01
lvcreate -L 708M  -n lv700M04 vgraw01
lvcreate -L 708M  -n lv700M05 vgraw01
lvcreate -L 708M  -n lv700M06 vgraw01
lvcreate -L 708M  -n lv700M07 vgraw01
lvcreate -L 708M  -n lv700M08 vgraw01
lvcreate -L 708M  -n lv700M09 vgraw01
lvcreate -L 708M  -n lv700M10 vgraw01
pvdisplay
vgdisplay
  
lvscan -v
lvdisplay




vi /etc/rc.local
================================================================================
su - root -c '/bin/raw /dev/raw/raw1  /dev/vgraw01/lv300M01'
su - root -c '/bin/raw /dev/raw/raw2  /dev/vgraw01/lv300M02'
su - root -c '/bin/raw /dev/raw/raw3  /dev/vgraw01/lv300M03'
su - root -c '/bin/raw /dev/raw/raw4  /dev/vgraw01/lv300M04'
su - root -c '/bin/raw /dev/raw/raw5  /dev/vgraw01/lv300M05'
su - root -c '/bin/raw /dev/raw/raw6  /dev/vgraw01/lv100M01'
su - root -c '/bin/raw /dev/raw/raw7  /dev/vgraw01/lv100M02'
su - root -c '/bin/raw /dev/raw/raw8  /dev/vgraw01/lv100M03'                              
su - root -c '/bin/raw /dev/raw/raw9  /dev/vgraw01/lv100M04'
su - root -c '/bin/raw /dev/raw/raw10 /dev/vgraw01/lv100M05'
su - root -c '/bin/raw /dev/raw/raw11 /dev/vgraw01/lv100M06'
su - root -c '/bin/raw /dev/raw/raw12 /dev/vgraw01/lv100M07'                             
su - root -c '/bin/raw /dev/raw/raw13 /dev/vgraw01/lv100M08'
su - root -c '/bin/raw /dev/raw/raw14 /dev/vgraw01/lv100M09'
su - root -c '/bin/raw /dev/raw/raw15 /dev/vgraw01/lv100M10'
su - root -c '/bin/raw /dev/raw/raw16 /dev/vgraw01/lv100M11'
su - root -c '/bin/raw /dev/raw/raw17 /dev/vgraw01/lv100M12'
su - root -c '/bin/raw /dev/raw/raw18 /dev/vgraw01/lv100M13'
su - root -c '/bin/raw /dev/raw/raw19 /dev/vgraw01/lv700M01'
su - root -c '/bin/raw /dev/raw/raw20 /dev/vgraw01/lv700M02'
su - root -c '/bin/raw /dev/raw/raw21 /dev/vgraw01/lv700M03'
su - root -c '/bin/raw /dev/raw/raw22 /dev/vgraw01/lv700M04'
su - root -c '/bin/raw /dev/raw/raw23 /dev/vgraw01/lv700M05'
su - root -c '/bin/raw /dev/raw/raw24 /dev/vgraw01/lv700M06'
su - root -c '/bin/raw /dev/raw/raw25 /dev/vgraw01/lv700M07'
su - root -c '/bin/raw /dev/raw/raw26 /dev/vgraw01/lv700M08'
su - root -c '/bin/raw /dev/raw/raw27 /dev/vgraw01/lv700M09'
su - root -c '/bin/raw /dev/raw/raw28 /dev/vgraw01/lv700M10'

su - root -c 'chown root:dba   /dev/raw/raw1'
su - root -c 'chown root:dba   /dev/raw/raw2'
su - root -c 'chown grid:dba   /dev/raw/raw3'
su - root -c 'chown grid:dba   /dev/raw/raw4'
su - root -c 'chown grid:dba   /dev/raw/raw5'
su - root -c 'chown oracle:dba /dev/raw/raw6'
su - root -c 'chown oracle:dba /dev/raw/raw7'
su - root -c 'chown oracle:dba /dev/raw/raw8'
su - root -c 'chown oracle:dba /dev/raw/raw9'
su - root -c 'chown oracle:dba /dev/raw/raw10'
su - root -c 'chown oracle:dba /dev/raw/raw11'
su - root -c 'chown oracle:dba /dev/raw/raw12'
su - root -c 'chown oracle:dba /dev/raw/raw13'
su - root -c 'chown oracle:dba /dev/raw/raw14'
su - root -c 'chown oracle:dba /dev/raw/raw15'
su - root -c 'chown oracle:dba /dev/raw/raw16'
su - root -c 'chown oracle:dba /dev/raw/raw17'
su - root -c 'chown oracle:dba /dev/raw/raw18'
su - root -c 'chown oracle:dba /dev/raw/raw19'
su - root -c 'chown oracle:dba /dev/raw/raw20'
su - root -c 'chown oracle:dba /dev/raw/raw21'
su - root -c 'chown oracle:dba /dev/raw/raw22'
su - root -c 'chown oracle:dba /dev/raw/raw23'
su - root -c 'chown oracle:dba /dev/raw/raw24'
su - root -c 'chown oracle:dba /dev/raw/raw25'
su - root -c 'chown oracle:dba /dev/raw/raw26'
su - root -c 'chown oracle:dba /dev/raw/raw27'
su - root -c 'chown oracle:dba /dev/raw/raw28'
su - root -c 'chmod 640 /dev/raw/raw1'
su - root -c 'chmod 640 /dev/raw/raw2'
su - root -c 'chmod 644 /dev/raw/raw3'
su - root -c 'chmod 644 /dev/raw/raw4'
su - root -c 'chmod 644 /dev/raw/raw5'
su - root -c 'chmod 640 /dev/raw/raw6'
su - root -c 'chmod 640 /dev/raw/raw7'
su - root -c 'chmod 640 /dev/raw/raw8'
su - root -c 'chmod 640 /dev/raw/raw9'
su - root -c 'chmod 640 /dev/raw/raw10'
su - root -c 'chmod 640 /dev/raw/raw11'
su - root -c 'chmod 640 /dev/raw/raw12'
su - root -c 'chmod 640 /dev/raw/raw13'
su - root -c 'chmod 640 /dev/raw/raw14'
su - root -c 'chmod 640 /dev/raw/raw15'
su - root -c 'chmod 640 /dev/raw/raw16'
su - root -c 'chmod 640 /dev/raw/raw17'
su - root -c 'chmod 640 /dev/raw/raw18'
su - root -c 'chmod 640 /dev/raw/raw19'
su - root -c 'chmod 640 /dev/raw/raw20'
su - root -c 'chmod 640 /dev/raw/raw21'
su - root -c 'chmod 640 /dev/raw/raw22'
su - root -c 'chmod 640 /dev/raw/raw23'
su - root -c 'chmod 640 /dev/raw/raw24'
su - root -c 'chmod 640 /dev/raw/raw25'
su - root -c 'chmod 640 /dev/raw/raw26'
su - root -c 'chmod 640 /dev/raw/raw27'
su - root -c 'chmod 640 /dev/raw/raw28'
su - root -c 'ln -s /dev/raw/raw1  /dev/vgraw01/ocr01'
su - root -c 'ln -s /dev/raw/raw2  /dev/vgraw01/ocr02'
su - root -c 'ln -s /dev/raw/raw3  /dev/vgraw01/vote01'
su - root -c 'ln -s /dev/raw/raw4  /dev/vgraw01/vote02'
su - root -c 'ln -s /dev/raw/raw5  /dev/vgraw01/vote03'
su - root -c 'ln -s /dev/raw/raw6  /dev/vgraw01/control01'
su - root -c 'ln -s /dev/raw/raw7  /dev/vgraw01/control02'
su - root -c 'ln -s /dev/raw/raw8  /dev/vgraw01/control03'
su - root -c 'ln -s /dev/raw/raw9  /dev/vgraw01/redo01'
su - root -c 'ln -s /dev/raw/raw10 /dev/vgraw01/redo02'
su - root -c 'ln -s /dev/raw/raw11 /dev/vgraw01/redo03'
su - root -c 'ln -s /dev/raw/raw12 /dev/vgraw01/redo04'
su - root -c 'ln -s /dev/raw/raw13 /dev/vgraw01/redo05'
su - root -c 'ln -s /dev/raw/raw14 /dev/vgraw01/redo06'
su - root -c 'ln -s /dev/raw/raw15 /dev/vgraw01/redo07'
su - root -c 'ln -s /dev/raw/raw16 /dev/vgraw01/redo08'
su - root -c 'ln -s /dev/raw/raw17 /dev/vgraw01/redo09'
su - root -c 'ln -s /dev/raw/raw18 /dev/vgraw01/redo10'
su - root -c 'ln -s /dev/raw/raw19 /dev/vgraw01/lvDATA01'
su - root -c 'ln -s /dev/raw/raw20 /dev/vgraw01/lvDATA02'
su - root -c 'ln -s /dev/raw/raw21 /dev/vgraw01/lvDATA03'
su - root -c 'ln -s /dev/raw/raw22 /dev/vgraw01/lvDATA04'
su - root -c 'ln -s /dev/raw/raw23 /dev/vgraw01/lvDATA05'
su - root -c 'ln -s /dev/raw/raw24 /dev/vgraw01/lvDATA06'
su - root -c 'ln -s /dev/raw/raw25 /dev/vgraw01/lvDATA07'
su - root -c 'ln -s /dev/raw/raw26 /dev/vgraw01/lvDATA08'
su - root -c 'ln -s /dev/raw/raw27 /dev/vgraw01/lvDATA09'
su - root -c 'ln -s /dev/raw/raw28 /dev/vgraw01/lvDATA10'
================================================================================
-- raw device를 설정하면 권한이 root로 바뀌므로 oracle로 권한이 바뀔수 있게 만들어주어야 한다.

chown oracle:dba /dev/vgraw01

shutdown -h now