내맘대로긍정이 알려주는
Oracle 23ai 신기능
무료 세미나 발표자료
OS환경 : Oracle Linux 6.8 (64bit)
DB 환경 : Oracle Database 12.1.0.2
방법 : ASM 디스크 추가 및 삭제하기
ASM 디스크 추가하기
ASM 접속 설정
1
2
3
4
5
6
7
|
# su - oracle
$ ps -ef | grep pmon
oracle 20840 1 0 10:59 ? 00:00:00 asm_pmon_+ASM1
oracle 21281 1 0 11:00 ? 00:00:00 ora_pmon_racdb1
$ export ORACLE_SID=+ASM1
$ export ORACLE_HOME=$GRID_HOME;
$ sqlplus / as sysasm
|
ASM disk 내용 확인
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
+ASM1>
SET LINE 200
COL DISK_GROUP FOR A10
COL LABEL FOR A10
COL STATE FOR A10
SELECT A.NAME AS DISK_GROUP, D.NAME "LABEL", A.STATE
FROM V$ASM_DISK D, V$ASM_DISKGROUP A
WHERE D.GROUP_NUMBER=A.GROUP_NUMBER
ORDER BY 2;
DISK_GROUP Label STATE
---------- ---------- ----------
ORADATA ASM01 MOUNTED
ORADATA ASM02 MOUNTED
ORAFRA FRA01 MOUNTED
OCR_VOTE OCR_VOTE01 MOUNTED
OCR_VOTE OCR_VOTE02 MOUNTED
OCR_VOTE OCR_VOTE03 MOUNTED
|
ASM 인스턴스에 현재 연결되어 있는 disk group 확인하기
1
2
3
4
5
6
7
8
9
10
11
12
13
|
+ASM1>
SET LINE 200
COL GROUP_NUMBER FOR 99
COL NAME FOR A10
COL TYPE FOR A10
COL STATE FOR A10
SELECT GROUP_NUMBER, NAME, TYPE, STATE FROM V$ASM_DISKGROUP;
GROUP_NUMBER NAME TYPE STATE
------------ ---------- ---------- ----------
2 ORADATA NORMAL MOUNTED
1 OCR_VOTE NORMAL MOUNTED
3 ORAFRA EXTERN MOUNTED
|
각 디스크 그룹별 세부 상세 정보 보기
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
+ASM1>
col path for a30
col name for a14
select group_number, disk_number, name, mount_status, path, total_mb, free_mb
from v$asm_disk
order by 1,3;
GROUP_NUMBER DISK_NUMBER NAME MOUNT_STAT PATH TOTAL_MB FREE_MB
------------ ----------- -------------- ---------- -------------------- ---------- ----------
1 2 OCR_VOTE01 CACHED ORCL:OCR_VOTE01 4094 1050
1 1 OCR_VOTE02 CACHED ORCL:OCR_VOTE02 4094 1047
1 0 OCR_VOTE03 CACHED ORCL:OCR_VOTE03 4094 1049
2 0 ASM01 CACHED ORCL:ASM01 5114 1644
2 1 ASM02 CACHED ORCL:ASM02 5114 1643
3 0 FRA01 CACHED ORCL:FRA01 5114 4783
|
각 디스크 그룹 별 파일 내역
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
|
+ASM1>
SET LINE 200
SET PAGESIZE 100
COL GROUP_NUMBER FOR 99
COL FILE_NUMBER FOR 999
COL TYPE FOR A15
SELECT GROUP_NUMBER, FILE_NUMBER, ROUND((BYTES/1024/1024),1) MB, REDUNDANCY, TYPE FROM V$ASM_FILE;
GROUP_NUMBER FILE_NUMBER MB REDUND TYPE
------------ ----------- ---------- ------ ---------------
1 253 0 MIRROR ASMPARAMETERFILE
1 255 158.3 MIRROR OCRFILE
1 256 0 HIGH PASSWORD
1 257 400 MIRROR DATAFILE
1 258 500 MIRROR DATAFILE
1 259 80 MIRROR DATAFILE
1 260 17.4 HIGH CONTROLFILE
1 261 50 MIRROR ONLINELOG
1 262 50 MIRROR ONLINELOG
1 263 50 MIRROR ONLINELOG
1 264 40 MIRROR TEMPFILE
1 265 160 MIRROR DATAFILE
1 266 150 MIRROR DATAFILE
1 267 40 MIRROR TEMPFILE
1 268 0 MIRROR PARAMETERFILE
1 269 2048 MIRROR DATAFILE
1 270 160 MIRROR DATAFILE
1 271 150 MIRROR DATAFILE
1 272 100 MIRROR DATAFILE
1 273 100 MIRROR DATAFILE
1 274 5 MIRROR DATAFILE
1 275 40 MIRROR TEMPFILE
2 256 0 HIGH PASSWORD
2 257 18.1 HIGH CONTROLFILE
2 258 50 MIRROR ONLINELOG
2 259 50 MIRROR ONLINELOG
2 260 800 MIRROR DATAFILE
2 261 260 MIRROR DATAFILE
2 262 750 MIRROR DATAFILE
2 263 595 MIRROR DATAFILE
2 264 1110 MIRROR DATAFILE
2 265 77 MIRROR TEMPFILE
2 266 62 MIRROR TEMPFILE
2 267 200 MIRROR DATAFILE
2 268 8.8 MIRROR DATAFILE
2 269 50 MIRROR ONLINELOG
2 270 50 MIRROR ONLINELOG
2 271 0 MIRROR PARAMETERFILE
2 272 260 MIRROR DATAFILE
2 273 605 MIRROR DATAFILE
2 274 20 MIRROR TEMPFILE
2 275 5 MIRROR DATAFILE
3 256 18.1 UNPROT CONTROLFILE
3 257 50 UNPROT ONLINELOG
3 258 50 UNPROT ONLINELOG
3 259 50 UNPROT ONLINELOG
3 260 50 UNPROT ONLINELOG
|
물리 디스크 추가하기
vmware 사용할 경우 디스크 추가 방법
0. node1, node2 모두 완전히 종료해준뒤 작업진행
1. vmware 에서 Edit virtual machine settings 로 들어감
2. Add.. 을 눌려서 하드를 추가함
3. Hard Disk 선택 후 넘어감
4. SCSI 선택, Independent 선택 후 넘어감
5. Create a new virtual disk 선택후 넘어감
6. 5 입력후 Allocate all disk space now 선택, single file 선택 후 넘어감
7. 디스크 경로를 잡아주고 Finish
8. 추가한 디스크를 선택 후 Advanced.. 로 들어감
9. SCSI 1:6(제일 마지막꺼) 선택 후 확인
10. 2번도드도 동일하게 진행 Edit virtual~ 선택
11. Add.. 선택
12. Hard Disk 선택
13. SCSI, Independent 선택
14. Use an existing virtual disk 선택
15. node1에서 지정한 경로 디스크 지정해줌
16. Advanced.. 선택
17. node1과 동일하게 SCSI 1:6 확인
18. OK 눌려서 나가줌
19. vm 파일이 있는 경로로 가서 node1의 .vmx 파일을 텍스프로 열어줌
20. 제일 아래에 아래 내용 추가해줌
scsi1:6.deviceType = "disk"
21. node2번도 동일하게 파일 열어줌
22. 제일 아래에 아래 내용 추가해줌
scsi1:6.deviceType = "disk"
그리고 두개 vm 모두 start
기존 ASM 디스크 확인
1
2
3
4
5
6
7
|
# /etc/init.d/oracleasm listdisks
ASM01
ASM02
FRA01
OCR_VOTE01
OCR_VOTE02
OCR_VOTE03
|
새로 추가한 디스크 확인
1
2
3
4
5
6
7
8
9
10
|
# fdisk -l
.
.
.
Disk /dev/sdh: 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
|
새로 추가한 디스크 포맷
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
|
# fdisk /dev/sdh
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x441e4240.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
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
First cylinder (1-652, default 1): (엔터)
Using default value 1
Last cylinder, +cylinders or +size (1-652, default 652): (엔터)
Using default value 652
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
|
n p 1 (엔터) (엔터) w 로 진행
새로 추가한 디스크 ASM 디스크로 등록 및 스캔
1
2
3
4
|
# /etc/init.d/oracleasm createdisk asm03 /dev/sdh1
Marking disk "asm03" as an ASM disk: [ OK ]
# /etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks: [ OK ]
|
ASM 디스크 확인
1
2
3
4
5
6
7
8
|
# /etc/init.d/oracleasm listdisks
ASM01
ASM02
ASM03
FRA01
OCR_VOTE01
OCR_VOTE02
OCR_VOTE03
|
ASM03이 확인됨
새로 추가한 디스크 권한 부여
1
|
# chown -R oracle.oinstall /dev/oracleasm/
|
ASM 디스크중 사용 안하는 것 조회
1
2
3
4
5
6
7
8
9
10
11
12
|
$ sqlplus / as sysasm
+ASM1>
set line 200
col path for a15
select group_number, mount_status, path, total_mb
from v$asm_disk where mount_status='CLOSED';
GROUP_NUMBER MOUNT_S PATH TOTAL_MB
------------ ------- --------------- ----------
0 CLOSED ORCL:ASM03 0
1 row selected.
|
ORCL:ASM03 추가
1
2
3
|
+ASM1> ALTER DISKGROUP ORADATA ADD DISK 'ORCL:ASM03' REBALANCE POWER 5;
Diskgroup altered.
|
*참고
여기서 rebalance power 5의 의미는 디스크가 새로 생성될 시 리밸런싱의 속도를 정함
이 값이 0이면 rebalance를 비활성화하고 1024까지 갈 수록 리밸런스 속도가 빨라지지만
그만큼 IO 오버헤드와 더 많은 프로세스가 작업을 하게됨
rebalance power 값 확인
1
2
3
4
5
6
|
SQL> select * from v$asm_operation;
GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK EST_RATE
------------ ----- ---- ---------- ---------- ---------- ---------- ----------
2 REBAL RUN 5 5 0 407 0
|
ASM disk 내용 확인
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
+ASM1>
SET LINE 200
COL DISK_GROUP FOR A10
COL LABEL FOR A10
COL STATE FOR A10
SELECT A.NAME AS DISK_GROUP, D.NAME "LABEL", A.STATE
FROM V$ASM_DISK D, V$ASM_DISKGROUP A
WHERE D.GROUP_NUMBER=A.GROUP_NUMBER
ORDER BY 2;
DISK_GROUP LABEL STATE
---------- ---------- ----------
ORADATA ASM01 MOUNTED
ORADATA ASM02 MOUNTED
ORADATA ASM03 MOUNTED
ORAFRA FRA01 MOUNTED
OCR_VOTE OCR_VOTE01 MOUNTED
OCR_VOTE OCR_VOTE02 MOUNTED
OCR_VOTE OCR_VOTE03 MOUNTED
|
새로 추가된 ASM03을 확인 할 수 있음
각 디스크 그룹별 세부 상세 정보 보기
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
+ASM1>
col path for a30
col name for a14
select group_number, disk_number, name, mount_status, path, total_mb, free_mb
from v$asm_disk
order by 1,3;
GROUP_NUMBER DISK_NUMBER NAME MOUNT_STAT PATH TOTAL_MB FREE_MB
------------ ----------- -------------- ---------- -------------------- ---------- ----------
1 2 OCR_VOTE01 CACHED ORCL:OCR_VOTE01 4094 1050
1 1 OCR_VOTE02 CACHED ORCL:OCR_VOTE02 4094 1047
1 0 OCR_VOTE03 CACHED ORCL:OCR_VOTE03 4094 1049
2 0 ASM01 CACHED ORCL:ASM01 5114 1644
2 1 ASM02 CACHED ORCL:ASM02 5114 1643
2 2 ASM03 CACHED ORCL:ASM03 5114 1646
3 0 FRA01 CACHED ORCL:FRA01 5114 4783
|
새로 추가된 ASM03을 확인 할 수 있음
ASM 디스크 삭제하기
1
2
3
|
+ASM1> ALTER DISKGROUP ORADATA DROP DISK ASM03;
Diskgroup altered.
|
ASM disk 내용 확인
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
+ASM1>
SET LINE 200
COL DISK_GROUP FOR A10
COL LABEL FOR A10
COL STATE FOR A10
SELECT A.NAME AS DISK_GROUP, D.NAME "LABEL", A.STATE
FROM V$ASM_DISK D, V$ASM_DISKGROUP A
WHERE D.GROUP_NUMBER=A.GROUP_NUMBER
ORDER BY 2;
DISK_GROUP LABEL STATE
---------- ---------- ----------
ORADATA ASM01 MOUNTED
ORADATA ASM02 MOUNTED
ORAFRA FRA01 MOUNTED
OCR_VOTE OCR_VOTE01 MOUNTED
OCR_VOTE OCR_VOTE02 MOUNTED
OCR_VOTE OCR_VOTE03 MOUNTED
|
삭제 된걸 확인할 수 있음
참조 : http://dinggur.tistory.com/200
http://wisdom16.tistory.com/48
http://blog.naver.com/musicovery12/220274324838
www.thegeekdiary.com/how-to-change-the-asm-rebalance-power-of-an-ongoing-operation/
'ORACLE > Admin' 카테고리의 다른 글
오라클 bdump 로그 정리 방법 (0) | 2019.01.07 |
---|---|
asmca silent mode 디스크 생성, 추가, 삭제 (0) | 2018.12.27 |
오라클 reorg, hwm, shrink, move 설명 및 테스트 (6) | 2018.12.26 |
오라클 기초 정리 (4) | 2018.12.19 |
오라클 테이블 compress 정리(10g, 11g, 12c, 18c) (4) | 2018.12.17 |