자주 사용하는 오라클 ASM 명령어 (Command)


-> sqlplus를 사용하여 디스크 그룹 생성 및 삭제


bash-4.1$ . oraenv

ORACLE_SID = [TEST] ? +ASM

The Oracle base remains unchanged with value /u01/app

bash-4.1$ sqlplus / as sysasm


SQL*Plus: Release 11.2.0.3.0 Production on Mon Apr 14 14:47:25 2014


Copyright (c) 1982, 2011, Oracle.  All rights reserved.



Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

With the Automatic Storage Management option


SQL> 

-> 디스크 그룹 생성 (external)

SQL> create diskgroup ddgroup1 external    

  2  redundancy disk '/dev/rdsk/c7t4d0s6';


Diskgroup created.


-> 디스크 그룹 삭제

SQL> drop diskgroup DDGROUP1 including contents;


Diskgroup dropped.


-> disk group 생성 (normal)

SQL> create diskgroup ddgrouup1 normal redundancy 

  2  failgroup cont1 disk '/dev/rdsk/c7t4d0s6'

  3  failgroup cont2 disk '/dev/rdsk/c7t5d0s6';


Diskgroup created.


-> disk group 삭제

SQL> drop diskgroup DDGROUUP1 including contents;


Diskgroup dropped.


-> disk group 생성 (high)

SQL> create diskgroup ddgrouup1 high redundancy

  2  failgroup cont1 disk '/dev/rdsk/c7t4d0s6'

  3  failgroup cont2 disk '/dev/rdsk/c7t5d0s6'

  4  failgroup cont3 disk '/dev/rdsk/c7t6d0s6';


Diskgroup created.


-> disk 그룹 삭제

SQL> drop diskgroup ddgrouup1 including contents;


Diskgroup dropped.


-> 디스크 그룹에 디스크 추가.

SQL> alter diskgroup DATA add disk 

  2  '/dev/rdsk/c7t4d0s6' name DATA_0002;


Diskgroup altered.


-> 디스크 그룹에 디스크 삭제

SQL> alter diskgroup DATA drop disk DATA_0002;


Diskgroup altered.


-> 디스크 그룹 삭제하려고 할때 삭제가 완료되기 전 undrop하여 삭제작업 취소

SQL> alter diskgroup  DATA 

  2  drop disk DATA_0002;


Diskgroup altered.


SQL> alter diskgroup DATA undrop disks;


Diskgroup altered.



-> ASM 디스크 그룹을 만들때 속성값을 지정할 수 있다.

SQL> create diskgroup DATA2 normal redundancy

  2  disk '/dev/rdsk/c7t4d0s6','/dev/rdsk/c7t5d0s6'

  3  attribute 'compatible.asm'='11.2';


Diskgroup created.


SQL> drop diskgroup DATA2 including contents;


Diskgroup dropped.


-> sqlplus에서 메타데이터 검색 했을때쿼리

select f.type, f.redundancy, f.striped, f.modification_date,

       a.system_created, a.name

       from v$asm_alias a, v$asm_file f 

             where a.FILE_NUMBER=f.FILE_NUMBER 

             and a.GROUP_NUMBER=f.GROUP_NUMBER

             and type='DATAFILE';


-> asmcmd에서 메타데이터 검색 했을때

bash-4.1$ asmcmd

Connected to an idle instance.

 (주의 : 위에처럼 idle instance로 떨어지면 sql이던 asmcmd이건 잘못 접속 된 것이다.)

bash-4.1$ . oraenv

ORACLE_SID = [TEST] ? +ASM

The Oracle base remains unchanged with value /u01/app

bash-4.1$ asmcmd

ASMCMD> 

ASMCMD> ls -l +DATA/TEST/datafile

Type      Redund  Striped  Time             Sys  Name

DATAFILE  UNPROT  COARSE   APR 13 20:00:00  Y    EXAMPLE.265.844406343

DATAFILE  UNPROT  COARSE   APR 13 20:00:00  Y    SYSAUX.257.844406197

DATAFILE  UNPROT  COARSE   APR 13 20:00:00  Y    SYSTEM.256.844406195

DATAFILE  UNPROT  COARSE   APR 13 20:00:00  Y    UNDOTBS1.258.844406197

DATAFILE  UNPROT  COARSE   APR 13 20:00:00  Y    USERS.259.844406197


사업자 정보 표시
(주)블루원 | 김홍태 | 서울특별시 용산구 원효로 4가 135 금홍 2빌딩 | 사업자 등록번호 : 106-86-76684 | TEL : 02-3272-7200 | Mail : support_ora@blueone.co.kr | 통신판매신고번호 : 호 | 사이버몰의 이용약관 바로가기

+ Recent posts