프린트 하기

내맘대로긍정이 알려주는

Oracle 23ai 신기능
무료 세미나 발표자료

다운로드 trending_flat

OS환경 : Oracle Linux6.8(64bit)


DB 환경 : Oracle Database 11.2.0.4


방법 : 

#vmware 에 5gb 짜리 4개 디스크 삽입



#fdisk -l 로 추가한 디스크 확인

fdisk -l

결과

[root@oraora ~]# fdisk -l

아래로 내리면 확인가능

Disk /dev/sdb: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000



Disk /dev/sdc: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000



Disk /dev/sdd: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000



Disk /dev/sde: 5368 MB, 5368709120 bytes

255 heads, 63 sectors/track, 652 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000



#fdisk 명령으로 vg후 lv로 묶을수 있는 상태로 변경

fdisk /dev/sdb

결과

[root@oraora diskall]# fdisk /dev/sdb


WARNING: DOS-compatible mode is deprecated. It's strongly recommended to

         switch off the mode (command 'c') and change display units to

         sectors (command 'u').


Command (m for help): n

Command action

   e   extended

   p   primary partition (1-4)

p

Partition number (1-4): 1

Partition 1 is already defined.  Delete it before re-adding it.


Command (m for help): t

Selected partition 1

Hex code (type L to list codes): 8e       

Changed system type of partition 1 to 8e (Linux LVM)


Command (m for help): w

The partition table has been altered!


Calling ioctl() to re-read partition table.

Syncing disks.


순서대로 실행

n

p

1

t

8e

w


그리고 나머지 디스크들도 동일하게 작업해준다.

fdisk /dev/sdc

fdisk /dev/sdd

fdisk /dev/sde





#Volumn Group(VG)를 만든다.

vgcreate vg01 /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1

결과

[root@oraora ~]# vgcreate diskall /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1

  Volume group "vg01" successfully created

  


#Logical Volumn(LV)를 만든다.

lvcreate -L 용량 -n 만들lv명 사용할VG명

lvcreate -L 1G -n lv01 vg01

lvcreate -L 1G -n lv02 vg01

lvcreate -L 1G -n lv03 vg01

lvcreate -L 1G -n lv04 vg01

lvcreate -L 1G -n lv05 vg01

lvcreate -L 1G -n lv06 vg01

lvcreate -L 1G -n lv07 vg01

lvcreate -L 1G -n lv08 vg01

lvcreate -L 1G -n lv09 vg01

lvcreate -L 1G -n lv10 vg01


결과

[root@oraora raw]# lvcreate -L 1G -n lv01 vg01

  Logical volume "lv01" created.

[root@oraora raw]# lvcreate -L 1G -n lv02 vg01

  Logical volume "lv02" created.

[root@oraora raw]# lvcreate -L 1G -n lv03 vg01

  Logical volume "lv03" created.

[root@oraora raw]# lvcreate -L 1G -n lv04 vg01

  Logical volume "lv04" created.

[root@oraora raw]# lvcreate -L 1G -n lv05 vg01

  Logical volume "lv05" created.

[root@oraora raw]# lvcreate -L 1G -n lv06 vg01

  Logical volume "lv06" created.

[root@oraora raw]# lvcreate -L 1G -n lv07 vg01

  Logical volume "lv07" created.

[root@oraora raw]# lvcreate -L 1G -n lv08 vg01

  Logical volume "lv08" created.

[root@oraora raw]# lvcreate -L 1G -n lv09 vg01

  Logical volume "lv09" created.

[root@oraora raw]# lvcreate -L 1G -n lv10 vg01

  Logical volume "lv10" created.

  


#VG, LV 조회

vg 조회 

vgdisplay

결과

[root@oraora diskall]# vgdisplay

  --- Volume group ---

  VG Name               vg01

  System ID             

  Format                lvm2

  Metadata Areas        4

  Metadata Sequence No  11

  VG Access             read/write

  VG Status             resizable

  MAX LV                0

  Cur LV                10

  Open LV               0

  Max PV                0

  Cur PV                4

  Act PV                4

  VG Size               19.97 GiB

  PE Size               4.00 MiB

  Total PE              5112

  Alloc PE / Size       2560 / 10.00 GiB

  Free  PE / Size       2552 / 9.97 GiB

  VG UUID               tUCuFK-3G4o-udCg-IwzF-qvbt-Jn2k-h61qw3

  

lv 조회

lvdisplay

결과

[root@oraora diskall]# lvdisplay

  --- Logical volume ---

  LV Path                /dev/vg01/lv01

  LV Name                lv01

  VG Name                vg01

  LV UUID                BtVwTj-bESb-sjav-QQbj-NTdH-Mc1d-tiiCnf

  LV Write Access        read/write

  LV Creation host, time oraora, 2018-08-17 01:44:57 +0900

  LV Status              available

  # open                 0

  LV Size                1.00 GiB

  Current LE             256

  Segments               1

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     256

  Block device           251:0

   

  --- Logical volume ---

  LV Path                /dev/vg01/lv02

  LV Name                lv02

  VG Name                vg01

  LV UUID                pI42Sj-Nusg-mBLN-39ZT-CptK-8uBW-tp3O5F

  LV Write Access        read/write

  LV Creation host, time oraora, 2018-08-17 01:44:57 +0900

  LV Status              available

  # open                 0

  LV Size                1.00 GiB

  Current LE             256

  Segments               1

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     256

  Block device           251:1

   

  --- Logical volume ---

  LV Path                /dev/vg01/lv03

  LV Name                lv03

  VG Name                vg01

  LV UUID                maukz1-9BeW-Nuvp-tHt8-GlbF-Q4AS-c25xzY

  LV Write Access        read/write

  LV Creation host, time oraora, 2018-08-17 01:44:57 +0900

  LV Status              available

  # open                 0

  LV Size                1.00 GiB

  Current LE             256

  Segments               1

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     256

  Block device           251:2

   

  --- Logical volume ---

  LV Path                /dev/vg01/lv04

  LV Name                lv04

  VG Name                vg01

  LV UUID                xfdUQo-ulXM-vo2U-W9sq-8tOs-K9wS-W1hqD2

  LV Write Access        read/write

  LV Creation host, time oraora, 2018-08-17 01:44:57 +0900

  LV Status              available

  # open                 0

  LV Size                1.00 GiB

  Current LE             256

  Segments               1

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     256

  Block device           251:3

   

  --- Logical volume ---

  LV Path                /dev/vg01/lv05

  LV Name                lv05

  VG Name                vg01

  LV UUID                lZSEcC-I0dp-ukvS-GSd3-zceX-kxPK-EXaX1e

  LV Write Access        read/write

  LV Creation host, time oraora, 2018-08-17 01:44:57 +0900

  LV Status              available

  # open                 0

  LV Size                1.00 GiB

  Current LE             256

  Segments               1

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     256

  Block device           251:4

   

  --- Logical volume ---

  LV Path                /dev/vg01/lv06

  LV Name                lv06

  VG Name                vg01

  LV UUID                8oGqNd-WF3S-AWv5-WXgi-pr9i-kVCb-neTnXO

  LV Write Access        read/write

  LV Creation host, time oraora, 2018-08-17 01:44:57 +0900

  LV Status              available

  # open                 0

  LV Size                1.00 GiB

  Current LE             256

  Segments               1

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     256

  Block device           251:5

   

  --- Logical volume ---

  LV Path                /dev/vg01/lv07

  LV Name                lv07

  VG Name                vg01

  LV UUID                alRmld-m6ni-OsKI-Bi0c-8rgt-vpMH-fjT4PK

  LV Write Access        read/write

  LV Creation host, time oraora, 2018-08-17 01:44:57 +0900

  LV Status              available

  # open                 0

  LV Size                1.00 GiB

  Current LE             256

  Segments               1

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     256

  Block device           251:6

   

  --- Logical volume ---

  LV Path                /dev/vg01/lv08

  LV Name                lv08

  VG Name                vg01

  LV UUID                hJR0PZ-i5m1-A5QY-A5yZ-wS1g-G0xf-ZtkLuE

  LV Write Access        read/write

  LV Creation host, time oraora, 2018-08-17 01:44:57 +0900

  LV Status              available

  # open                 0

  LV Size                1.00 GiB

  Current LE             256

  Segments               1

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     256

  Block device           251:7

   

  --- Logical volume ---

  LV Path                /dev/vg01/lv09

  LV Name                lv09

  VG Name                vg01

  LV UUID                acCmr6-or16-C2P8-zCR2-Sglu-pbIx-sPrKky

  LV Write Access        read/write

  LV Creation host, time oraora, 2018-08-17 01:44:57 +0900

  LV Status              available

  # open                 0

  LV Size                1.00 GiB

  Current LE             256

  Segments               1

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     256

  Block device           251:8

   

  --- Logical volume ---

  LV Path                /dev/vg01/lv10

  LV Name                lv10

  VG Name                vg01

  LV UUID                istqhC-Q3yE-UkTK-ujqu-mmj5-qVIh-yVgwNd

  LV Write Access        read/write

  LV Creation host, time oraora, 2018-08-17 01:44:58 +0900

  LV Status              available

  # open                 0

  LV Size                1.00 GiB

  Current LE             256

  Segments               1

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     256

  Block device           251:9

   


#raw device 구성

raw /dev/raw/raw1 /dev/vg01/lv01

raw /dev/raw/raw2 /dev/vg01/lv02

raw /dev/raw/raw3 /dev/vg01/lv03

raw /dev/raw/raw4 /dev/vg01/lv04

raw /dev/raw/raw5 /dev/vg01/lv05

raw /dev/raw/raw6 /dev/vg01/lv06

raw /dev/raw/raw7 /dev/vg01/lv07

raw /dev/raw/raw8 /dev/vg01/lv08

raw /dev/raw/raw9 /dev/vg01/lv09

raw /dev/raw/raw10 /dev/vg01/lv10

chown oracle:dba /dev/raw/raw*

결과

[root@oraora raw]# raw /dev/raw/raw1 /dev/vg01/lv01

/dev/raw/raw1: bound to major 251, minor 0

[root@oraora raw]# raw /dev/raw/raw2 /dev/vg01/lv02

/dev/raw/raw2: bound to major 251, minor 1

[root@oraora raw]# raw /dev/raw/raw3 /dev/vg01/lv03

/dev/raw/raw3: bound to major 251, minor 2

[root@oraora raw]# raw /dev/raw/raw4 /dev/vg01/lv04

/dev/raw/raw4: bound to major 251, minor 3

[root@oraora raw]# raw /dev/raw/raw5 /dev/vg01/lv05

/dev/raw/raw5: bound to major 251, minor 4

[root@oraora raw]# raw /dev/raw/raw6 /dev/vg01/lv06

/dev/raw/raw6: bound to major 251, minor 5

[root@oraora raw]# raw /dev/raw/raw7 /dev/vg01/lv07

/dev/raw/raw7: bound to major 251, minor 6

[root@oraora raw]# raw /dev/raw/raw8 /dev/vg01/lv08

/dev/raw/raw8: bound to major 251, minor 7

[root@oraora raw]# raw /dev/raw/raw9 /dev/vg01/lv09

/dev/raw/raw9: bound to major 251, minor 8

[root@oraora raw]# raw /dev/raw/raw10 /dev/vg01/lv10

/dev/raw/raw10: bound to major 251, minor 9

[root@oraora raw]# chown oracle:dba /dev/raw/raw*



#raw device 확인

raw -qa

결과

[root@oraora raw]# raw -qa

/dev/raw/raw1: bound to major 251, minor 0

/dev/raw/raw2: bound to major 251, minor 1

/dev/raw/raw3: bound to major 251, minor 2

/dev/raw/raw4: bound to major 251, minor 3

/dev/raw/raw5: bound to major 251, minor 4

/dev/raw/raw6: bound to major 251, minor 5

/dev/raw/raw7: bound to major 251, minor 6

/dev/raw/raw8: bound to major 251, minor 7

/dev/raw/raw9: bound to major 251, minor 8

/dev/raw/raw10: bound to major 251, minor 9



#/etc/udev/rules.d/60-raw.rules에 내용 추가

vi /etc/udev/rules.d/60-raw.rules

ACTION=="add", ENV{MAJOR}="251", ENV{MINOR}="0", RUN+="raw /dev/raw/raw1 %M %m"

ACTION=="add", ENV{MAJOR}="251", ENV{MINOR}="1", RUN+="raw /dev/raw/raw2 %M %m"

ACTION=="add", ENV{MAJOR}="251", ENV{MINOR}="2", RUN+="raw /dev/raw/raw3 %M %m"

ACTION=="add", ENV{MAJOR}="251", ENV{MINOR}="3", RUN+="raw /dev/raw/raw4 %M %m"

ACTION=="add", ENV{MAJOR}="251", ENV{MINOR}="4", RUN+="raw /dev/raw/raw5 %M %m"

ACTION=="add", ENV{MAJOR}="251", ENV{MINOR}="5", RUN+="raw /dev/raw/raw6 %M %m"

ACTION=="add", ENV{MAJOR}="251", ENV{MINOR}="6", RUN+="raw /dev/raw/raw7 %M %m"

ACTION=="add", ENV{MAJOR}="251", ENV{MINOR}="7", RUN+="raw /dev/raw/raw8 %M %m"

ACTION=="add", ENV{MAJOR}="251", ENV{MINOR}="8", RUN+="raw /dev/raw/raw9 %M %m"

ACTION=="add", ENV{MAJOR}="251", ENV{MINOR}="9", RUN+="raw /dev/raw/raw10 %M %m"

ACTION=="add",KERNEL=="raw*" OWNER="oracle",GROUP="dba",MODE="660"



#udev mapper 서비스 시작

start_udev

결과

[root@oraora raw]# start_udev

Starting udev:                                             [  OK  ]



#확인

raw -qa | cut -d ":" -f 1 | xargs -i{} ls -l {}

결과

[root@oraora raw]# raw -qa | cut -d ":" -f 1 | xargs -i{} ls -l {}

crw-rw---- 1 oracle dba 162, 1 Aug 16 17:06 /dev/raw/raw1

crw-rw---- 1 oracle dba 162, 2 Aug 16 17:06 /dev/raw/raw2

crw-rw---- 1 oracle dba 162, 3 Aug 16 17:06 /dev/raw/raw3

crw-rw---- 1 oracle dba 162, 4 Aug 16 17:06 /dev/raw/raw4

crw-rw---- 1 oracle dba 162, 5 Aug 16 17:06 /dev/raw/raw5

crw-rw---- 1 oracle dba 162, 6 Aug 16 17:06 /dev/raw/raw6

crw-rw---- 1 oracle dba 162, 7 Aug 16 17:06 /dev/raw/raw7

crw-rw---- 1 oracle dba 162, 8 Aug 16 17:06 /dev/raw/raw8

crw-rw---- 1 oracle dba 162, 9 Aug 16 17:06 /dev/raw/raw9

crw-rw---- 1 oracle dba 162, 10 Aug 16 17:06 /dev/raw/raw10



#vg 및 lv 삭제

vg 삭제

vgremove vg01

결과

[root@oraora raw]# vgremove vg01

Do you really want to remove volume group "vg01" containing 10 logical volumes? [y/n]: y

Do you really want to remove active logical volume lv01? [y/n]: y

  Logical volume "lv01" successfully removed

Do you really want to remove active logical volume lv02? [y/n]: y

  Logical volume "lv02" successfully removed

Do you really want to remove active logical volume lv03? [y/n]: y

  Logical volume "lv03" successfully removed

Do you really want to remove active logical volume lv04? [y/n]: y

  Logical volume "lv04" successfully removed

Do you really want to remove active logical volume lv05? [y/n]: y

  Logical volume "lv05" successfully removed

Do you really want to remove active logical volume lv06? [y/n]: y

  Logical volume "lv06" successfully removed

Do you really want to remove active logical volume lv07? [y/n]: y

  Logical volume "lv07" successfully removed

Do you really want to remove active logical volume lv08? [y/n]: y

  Logical volume "lv08" successfully removed

Do you really want to remove active logical volume lv09? [y/n]: y

  Logical volume "lv09" successfully removed

Do you really want to remove active logical volume lv10? [y/n]: y

  Logical volume "lv10" successfully removed

  Volume group "vg01" successfully removed

vg로 만들어진 lv도 같이 지울수 있다.


참조 

http://closed0402.tistory.com/103