반응형
1. ASM 접속
- 접속 가능 OS 사용자 : asmdba 그룹에 속하는 사용자
- 환경 변수 설정
ORACLE_HOME=<grid_home>
ORACLE_SID=asm_sid
1. sqlplus 명령어 접속 shell> id uid=2000(oracle) gid=2000(oinstall) groups=2000(oinstall),2001(dba),2002(asmdba),2003(asmoper),2004(oper),2005(asmadmin) shell> export ORACLE_HOME=/u01/app/grid shell> export ORACLE_SID=+ASM1 shell> sqlplus / as sysdba SQL> asmcmd 명령어 접속 shell> asmcmd ASMCMD> |
2. 디스크 그룹 확인
2.1 ASMCMD 명령어
ASMCMD> lsdg
2.2 sqlplus 명령어(v$asm_diskgroup 뷰)
SQL> select NAME, TOTAL_MB, FREE_MB from v$asm_diskgroup ; NAME TOTAL_MB FREE_MB ---------- ---------- ---------- DATA 40928 244 SQL> |
3. 디스크 정보 확인( v$asm_disk 뷰)
SQL> select GROUP_NUMBER, NAME ,PATH, TOTAL_MB,Free_MB,VOTING_FILE from v$asm_disk ; GROUP_NUMBER NAME PATH TOTAL_MB FREE_MB VOT ------------ ---------- ----------------------------------- -------- ---------- 1 ASM5 /dev/oracleasm/disks/ASM5 5116 36 N 1 ASM6 /dev/oracleasm/disks/ASM6 5116 32 N 1 ASM7 /dev/oracleasm/disks/ASM7 5116 32 N 1 ASM8 /dev/oracleasm/disks/ASM8 5116 16 N 1 ASM4 /dev/oracleasm/disks/ASM4 5116 0 Y => Voting Disk 1 ASM3 /dev/oracleasm/disks/ASM3 5116 20 N 1 ASM2 /dev/oracleasm/disks/ASM2 5116 44 N 1 ASM1 /dev/oracleasm/disks/ASM1 5116 64 N 8 rows selected. SQL> |
** ASM 디스크를 물리적 디스크와 매핑
shell> oracleasm querydisk -d ASM2 Disk "ASM2" is a valid ASM disk on device [8,33] => 디스크 메이저,마이너 번호 확인 shell> ls -l /dev | grep 8, | grep 33 brw-rw---- 1 root disk 8, 33 12월 12 18:17 sdc1 |
4. 디스크 그룹에 디스크 추가
4.1 물리적 디스크를 ASMLib 디스크로 변환
[root@rac1 ~]# oracleasm createdisk ASM9 /dev/sdo => 파티션이 되어있지 않을 경우 오류가 발생 Device "/dev/sdo" is not a partition [root@rac1 ~]# fdisk /dev/sdo => 디스크 파티션 생성 Welcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table Building a new DOS disklabel with disk identifier 0xdc5a747f. Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p Partition number (1-4, default 1): Enter First sector (2048-10485759, default 2048): Enter Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-10485759, default 10485759): Using default value 10485759 Partition 1 of type Linux and of size 5 GiB is set Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. [root@rac1 ~]# oracleasm createdisk ASM9 /dev/sdo1 => ASMLib 사용을 위한 디바이스 할당 Writing disk header: done Instantiating disk: done [root@rac1 ~]# [root@rac2 disks]# oracleasm scandisks => Node2 에서 변경된 ASMLib Disk 스캔 Reloading disk partitions: done Cleaning any stale ASM disks... Scanning system for ASM disks... Instantiating disk "ASM9" [root@rac2 disks]# [root@rac1 ~]# oracleasm deletedisk ASM9 => OS에 디바이스 반환(ASMLib 에서 제거) Clearing disk header: done Dropping disk: done [root@rac1 ~]# |
4.2 디스크 그룹에 디스크 추가
[oracle@rac1 ~]$ asmcmd ASMCMD> lsop => 현재 진행중인 작업 확인 Group_Name Pass State Power EST_WORK EST_RATE EST_TIME ASMCMD>exit [oracle@rac1 disks]$ export ORACLE_HOME=/u01/app/grid [oracle@rac1 disks]$ export ORACLE_SID=+ASM1 [oracle@rac1 disks]$ sqlplus / as sysdba SQL*Plus: Release 12.2.0.1.0 Production on 목 12월 12 21:50:59 2019 Copyright (c) 1982, 2016, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production SQL> SQL> select group_number, name, mount_status, path, total_mb from v$asm_disk where mount_status='CLOSED'; GROUP_NUMBER NAME MOUNT_STATUS PATH TOTAL_MB ------------ ----- --------------- ------------------------------ ---------- 0 CLOSED /dev/oracleasm/disks/ASM9 0 SQL> ALTER DISKGROUP data ADD DISK '/dev/oracleasm/disks/ASM9' REVALANCE POWER 5 ; Diskgroup altered. SQL> 모니터링 : asmcmd 에서 lsop 명령어로 진행사항 모니터링 ASMCMD> lsop => 초기 시작 Group_Name Pass State Power EST_WORK EST_RATE EST_TIME DATA COMPACT WAIT 5 0 0 0 DATA REBUILD WAIT 5 0 0 0 DATA REBALANCE WAIT 5 0 0 0 ASMCMD> lsop => 진행중 Group_Name Pass State Power EST_WORK EST_RATE EST_TIME DATA COMPACT WAIT 5 0 0 0 DATA REBUILD DONE 5 0 0 0 DATA REBALANCE RUN 5 1129 13325 0 ASMCMD> lsop => 완료 Group_Name Pass State Power EST_WORK EST_RATE EST_TIME ASMCMD> - 디스크 추가 및 REVALANCE 후 FREE_MB가 골고루 분산되어 표시됨을 알수 있다 SQL> select GROUP_NUMBER, NAME ,PATH, TOTAL_MB,Free_MB from v$asm_disk ; GROUP_NUMBER NAME PATH TOTAL_MB FREE_MB ------------ ------- ----------------------------------- ---------- ---------- 1 ASM8 /dev/oracleasm/disks/ASM8 5116 596 1 ASM7 /dev/oracleasm/disks/ASM7 5116 600 1 ASM6 /dev/oracleasm/disks/ASM6 5116 596 1 ASM5 /dev/oracleasm/disks/ASM5 5116 596 1 ASM4 /dev/oracleasm/disks/ASM4 5116 564 1 ASM3 /dev/oracleasm/disks/ASM3 5116 596 1 ASM2 /dev/oracleasm/disks/ASM2 5116 596 1 ASM1 /dev/oracleasm/disks/ASM1 5116 596 1 ASM9 /dev/oracleasm/disks/ASM9 5116 608 => 추가 디스크 9 rows selected. SQL> |
5. ASM 을 사용하는 클라이언트(인스턴스) 모니터링( v$asm_client 뷰)
SQL> select instance_name,db_name,cluster_name,status from v$asm_client ; INSTANCE_NAME DB_NAME CLUSTER_NAME STATUS --------------- ------------------------ --------------- ------------ +ASM1 +ASM rac-cluster CONNECTED -MGMTDB _mgmtdb rac-cluster CONNECTED rac1.hoya.com _OCR rac-cluster CONNECTED shell> crsctl start database -d linrac => 데이타베이스 구동 shell> sqlplus / as sysdba SQL> select instance_name,db_name,cluster_name,status from v$asm_client ; INSTANCE_NAME DB_NAME CLUSTER_NAME STATUS --------------- --------------- --------------- -------------------- +ASM1 +ASM rac-cluster CONNECTED -MGMTDB _mgmtdb rac-cluster CONNECTED linrac1 linrac rac-cluster CONNECTED rac1.hoya.com _OCR rac-cluster CONNECTED SQL> |
6. ASM 관련 뷰
- v$asm_file : ASM내부에 생성된 파일에 대한 정보
- v$asm_template : 디스크 그룹에 설정된 템플릿 정보
- v$asm_alias : 그룹의 alias 정보
- v$asm_operation : ASM 인스턴스상에서 실행되는 작업의 현황
반응형
'DBMS > ORACLE' 카테고리의 다른 글
오라클 객체 권한 조회/추가/회수 (0) | 2019.12.14 |
---|---|
RMAN 데이타파일 복구 - ASM 환경 (0) | 2019.12.13 |
RMAN-06059 오류 (0) | 2019.12.12 |
RMAN 백업 - RAC 환경 (0) | 2019.12.12 |
oracle 12c RAC 에서 Archive mode 변경 (0) | 2019.12.12 |