ใช้ "root" user (สร้าง virtual disk) ->
# mkdir /u01/asmtest
# chown oracle:dba /u01/asmtest/
# su - oracle
$ dd if=/dev/zero of=/u01/asmtest/file_disk1 bs=2k count=100000
100000+0 records in
100000+0 records out
ใช้ root user (associate a loop device with a file) ->
# losetup /dev/loop1 /u01/asmtest/file_disk1
ใช้ root user (bind raw device) ->
# raw /dev/raw/raw10 /dev/loop1
/dev/raw/raw10: bound to major 7, minor 1
Check permission :
# ls -ltr /dev/raw/raw10
crw-rw---- 1 oracle dba 162, 10 Nov 4 12:04 /dev/raw/raw10
use oracle user ->
$ export ORACLE_BASE=/u01/oracle/product
$ export ORACLE_HOME=/u01/oracle/product/10.2.0/asm
$ export ORACLE_SID=+ASM
$ export PATH=$ORACLE_HOME/bin:$PATH
$ sqlplus / as sysdba
SQL> select group_number, disk_number, mount_status, header_status, state, path from v$asm_disk;
GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STA STATE PATH
------------ ----------- ------- ---------- -------- --------------------
0 1 CLOSED CANDIDATE NORMAL /dev/raw/raw10
SQL> CREATE DISKGROUP tmp_test EXTERNAL REDUNDANCY DISK '/dev/raw/raw10';
Diskgroup created.
GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATU STATE PATH
------------ ----------- ------- ------------ -------- ---------------
3 0 CACHED MEMBER NORMAL /dev/raw/raw10
SQL> select group_number, name, total_mb, free_mb, state, type from v$asm_diskgroup;
GROUP_NUMBER NAME TOTAL_MB FREE_MB STATE TYPE
------------ ------------------------------ ---------- ---------- ----------- ------
3 TMP_TEST 195 145 MOUNTED EXTERN
ตอนนี้เราก็ ได้ diskgroup จาก virtual disk แล้ว
ไม่มีความคิดเห็น:
แสดงความคิดเห็น