본문 바로가기
DBMS/ORACLE

AFD disk 추가/삭제

by 드바 2022. 6. 9.

추가

-- diskstring을 설정하는 여러 방법
-- asm disk에서 사용 할 디스크를 지정하는 설정
[grid@svr1 ~]$ asmcmd dsset 'AFD:*','/dev/rdsk/*'

[grid@svr1 ~]$ asmcmd dsget
parameter:AFD:*, /dev/rdsk/*
profile:AFD:*,/dev/rdsk/*

-- AFD 파일 생성
[grid@svr1 ~]$ cat /etc/oracleafd.conf
afd_diskstring='/dev/rdsk/*'
afd_filtering=enable

-- ASM DiskString 확인
[root@svr1 ~]# asmcmd dsget
Connected to an idle instance.
ASMCMD-8102: no connection to Oracle ASM; command requires Oracle ASM to run
[root@svr1 ~]# su - grid
[grid@svr1 ~]$ asmcmd dsget
parameter:AFD:*
profile:AFD:*

-- afd disk 조회
[root@svr1 ~]# asmcmd afd_lsdsk
--------------------------------------------------------------------------------
Label                     Filtering   Path
================================================================================
DATA                        ENABLED   /dev/sdb1

-- afd disk 추가(/dev/sdc1 디바이스를 DATA02로)
[root@svr1 ~]# asmcmd afd_label DATA02 /dev/sdc1

[root@svr1 ~]# su - grid
[grid@svr1 ~]$  asmcmd afd_lsdsk
--------------------------------------------------------------------------------
Label                     Filtering   Path
================================================================================
DATA                        ENABLED   /dev/sdb1
DATA02                      ENABLED   /dev/sdc1
[grid@svr1 ~]$ 

-- ASM DISK 조회(할당 가능 disk는 mount_status = 'CLOSED')
grid@svr1 ~]$ sqlplus / as sysasm
SQL> select group_number, disk_number, name, mount_status, header_status, state, path, os_mb, total_mb, cold_used_mb, free_mb
from v$asm_disk
WHERE 1=1
--AND mount_status = 'CLOSED'
order by 1,3 ;

GROUP_NUMBER DISK_NUMBER NAME		      MOUNT_STATUS	    HEADER_STATUS	 STATE			  PATH				      OS_MB   TOTAL_MB COLD_USED_MB    FREE_MB
------------ ----------- -------------------- --------------------- -------------------- ------------------------ ------------------------------ ---------- ---------- ------------ ----------
	   0	       0		      CLOSED		    PROVISIONED		 NORMAL 		  AFD:DATA02			      10239	     0		  0	     0
	   1	       0 DATA_0000	      CACHED		    MEMBER		 NORMAL 		  AFD:DATA			      10239	 10236	       2836	  7400

SQL> 

-- DATA DG에 disk 추가
SQL> alter diskgroup DATA add disk 'AFD:DATA02' ;
Diskgroup altered.

SQL> select * from v$asm_operation; 
no rows selected
SQL>

 

삭제

SQL> select group_number, disk_number, name, mount_status, header_status, state, path, os_mb, total_mb, cold_used_mb, free_mb
from v$asm_disk
WHERE 1=1
--AND mount_status = 'CLOSED'
order by 1,3 ;
GROUP_NUMBER DISK_NUMBER NAME		      MOUNT_STATUS	    HEADER_STATUS	 STATE			  PATH				      OS_MB   TOTAL_MB COLD_USED_MB    FREE_MB
------------ ----------- -------------------- --------------------- -------------------- ------------------------ ------------------------------ ---------- ---------- ------------ ----------
	   1	       1 DATA02 	      CACHED		    MEMBER		 NORMAL 		  AFD:DATA02			      10239	 10236	       1416	  8820
	   1	       0 DATA_0000	      CACHED		    MEMBER		 NORMAL 		  AFD:DATA			      10239	 10236	       1432	  8804

SQL> alter diskgroup DATA drop disk 'DATA02' ;
Diskgroup altered.

SQL> select group_number, disk_number, name, mount_status, header_status, state, path, os_mb, total_mb, cold_used_mb, free_mb
from v$asm_disk
WHERE 1=1
--AND mount_status = 'CLOSED'
order by 1,3 ;

GROUP_NUMBER DISK_NUMBER NAME		      MOUNT_STATUS	    HEADER_STATUS	 STATE			  PATH				      OS_MB   TOTAL_MB COLD_USED_MB    FREE_MB
------------ ----------- -------------------- --------------------- -------------------- ------------------------ ------------------------------ ---------- ---------- ------------ ----------
	   1	       1 DATA02 	      CACHED		    MEMBER		 DROPPING		  AFD:DATA02			      10239	 10236		556	  9680
	   1	       0 DATA_0000	      CACHED		    MEMBER		 NORMAL 		  AFD:DATA			      10239	 10236	       2292	  7944

SQL> select group_number, disk_number, name, mount_status, header_status, state, path, os_mb, total_mb, cold_used_mb, free_mb
from v$asm_disk
WHERE 1=1
--AND mount_status = 'CLOSED'
order by 1,3 ;

GROUP_NUMBER DISK_NUMBER NAME		      MOUNT_STATUS	    HEADER_STATUS	 STATE			  PATH				      OS_MB   TOTAL_MB COLD_USED_MB    FREE_MB
------------ ----------- -------------------- --------------------- -------------------- ------------------------ ------------------------------ ---------- ---------- ------------ ----------
	   0	       0		      CLOSED		    FORMER		 NORMAL 		  AFD:DATA02			      10239	     0		  0	     0
	   1	       0 DATA_0000	      CACHED		    MEMBER		 NORMAL 		  AFD:DATA			      10239	 10236	       2836	  7400

SQL> exit

[root@svr1 ~]# asmcmd afd_lsdsk
--------------------------------------------------------------------------------
Label                     Filtering   Path
================================================================================
DATA                        ENABLED   /dev/sdb1
DATA02                      ENABLED   /dev/sdc1
[root@svr1 ~]# asmcmd afd_unlabel DATA02
[root@svr1 ~]# asmcmd afd_lsdsk
--------------------------------------------------------------------------------
Label                     Filtering   Path
================================================================================
DATA                        ENABLED   /dev/sdb1
[root@svr1 ~]#

 

기타

-- 운영 상황에 제거할 경우는 거의 없지만 추가/제거를 아래처럼 한번에 진행 가능
SQL> alter diskgroup DATA add disk 'AFD:DATA02' drop disk 'DATA' ;

 

 

ASM DISK 추가/삭제 성능 테스트(신규추가, 기존삭제)

ASM DISK 추가/일시중지/재개 시 상태 변화

ASM DISK 사이즈 다른 경우 DATAFILE 추가 테스트

 

댓글