Skip to content

ASM Add Disk in DiskGroup

    [featured_image]
    Download
    Download is available until [expire_date]
    • Version
    • Download 0
    • File Size 10.38 KB
    • File Count 1
    • Create Date
    • Last Updated

    ASM Add Disk in DiskGroup

    Add Disk in ASM Disk Group
    ===========================
    We have raw disk /dev/sdd which we are going add in existing Disk Group DATA.

    [[email protected] ~]# ls -alrt /dev/sd*
    brw-rw---- 1 root disk 8, 0 Nov 11 19:07 /dev/sda
    brw-rw---- 1 root disk 8, 16 Nov 11 19:07 /dev/sdb
    brw-rw---- 1 root disk 8, 2 Nov 11 19:07 /dev/sda2
    brw-rw---- 1 root disk 8, 48 Nov 11 19:07 /dev/sdd
    brw-rw---- 1 root disk 8, 32 Nov 11 19:07 /dev/sdc
    brw-rw---- 1 root disk 8, 1 Nov 11 19:07 /dev/sda1
    brw-rw---- 1 oracle dba 8, 17 Nov 11 19:23 /dev/sdb1
    brw-rw---- 1 oracle dba 8, 33 Nov 11 19:23 /dev/sdc1
    [[email protected] ~]#
    [[email protected] ~]#
    [[email protected] ~]# fdisk /dev/sdd
    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 0x16132540.

    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):
    First sector (2048-20971519, default 2048):
    Using default value 2048
    Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519):
    Using default value 20971519
    Partition 1 of type Linux and of size 10 GiB is set

    Command (m for help): w
    The partition table has been altered!

    Calling ioctl() to re-read partition table.
    Syncing disks.
    [[email protected] ~]# ls -alrt /dev/sd*
    brw-rw---- 1 root disk 8, 0 Nov 11 19:07 /dev/sda
    brw-rw---- 1 root disk 8, 16 Nov 11 19:07 /dev/sdb
    brw-rw---- 1 root disk 8, 2 Nov 11 19:07 /dev/sda2
    brw-rw---- 1 root disk 8, 32 Nov 11 19:07 /dev/sdc
    brw-rw---- 1 root disk 8, 1 Nov 11 19:07 /dev/sda1
    brw-rw---- 1 root disk 8, 48 Nov 11 19:24 /dev/sdd
    brw-rw---- 1 root disk 8, 49 Nov 11 19:24 /dev/sdd1
    brw-rw---- 1 oracle dba 8, 17 Nov 11 19:24 /dev/sdb1
    brw-rw---- 1 oracle dba 8, 33 Nov 11 19:24 /dev/sdc1
    [[email protected] ~]#

    n/p/~/~/w

    brw-rw---- 1 root disk 8, 1 Nov 11 19:07 /dev/sda1

    SQL> SELECT GROUP_NUMBER,NAME,SECTOR_SIZE,BLOCK_SIZE,ALLOCATION_UNIT_SIZE,STATE,TYPE TOTAL_MB,FREE_MB FROM V$ASM_DISKGROUP;

    [[email protected] ~]# oracleasm createdisk DATA_0002 /dev/sdd1
    Device "/dev/sdd1" is already labeled for ASM disk "DATA_0002"
    [[email protected] ~]# oracleasm listdisks
    DATA_0002
    [[email protected] ~]#

     

    [[email protected] ~]$ asmcmd -p

    ASMCMD [+] > lsdsk

    -- Identify the candidate Disks

    SQL> SELECT
    NVL(a.name, '[CANDIDATE]') disk_group_name
    , b.path disk_file_path
    , b.name disk_file_name
    , b.failgroup disk_file_fail_group
    FROM
    v$asm_diskgroup a RIGHT OUTER JOIN v$asm_disk b USING (group_number)
    ORDER BY
    a.name;

    DISK_GROUP_NAME DISK_FILE_PATH DISK_FILE_NAME DISK_FILE_FAIL_GROUP
    ------------------------------ ------------------------------ ------------------------------ ------------------------------
    DATA /dev/sdc1 DATA_0001 DATA_0001
    DATA /dev/sdb1 DATA_0000 DATA_0000
    [CANDIDATE] /dev/sdd1

    SQL>

    [[email protected] ~]$ sqlplus / as sysasm

    -- Add disk to the group DATA (you need to login as sysasm not sysdba)

    SQL> ALTER DISKGROUP DATA ADD DISK
    '/dev/sdd1' NAME DATA_0002;

    Diskgroup altered.

    SQL> ALTER DISKGROUP DATA REBALANCE POWER 5 WAIT;

    SQL> SELECT
    NVL(a.name, '[CANDIDATE]') disk_group_name
    , b.path disk_file_path
    , b.name disk_file_name
    , b.failgroup disk_file_fail_group
    FROM
    v$asm_diskgroup a RIGHT OUTER JOIN v$asm_disk b USING (group_number)
    ORDER BY
    a.name;

    DISK_GROUP_NAME DISK_FILE_PATH DISK_FILE_NAME DISK_FILE_FAIL_GROUP
    ------------------------------ ------------------------------ ------------------------------ ------------------------------
    DATA /dev/sdc1 DATA_0001 DATA_0001
    DATA /dev/sdd1 DATA_0002 DATA_0002
    DATA /dev/sdb1 DATA_0000 DATA_0000

    SQL>

    SQL> SELECT GROUP_NUMBER,NAME,SECTOR_SIZE,BLOCK_SIZE,ALLOCATION_UNIT_SIZE,STATE,TYPE TOTAL_MB,FREE_MB FROM V$ASM_DISKGROUP;

    GROUP_NUMBER NAME SECTOR_SIZE BLOCK_SIZE ALLOCATION_UNIT_SIZE STATE TOTAL_ FREE_MB
    ------------ ------------------------------ ----------- ---------- -------------------- ----------- ------ ----------
    1 DATA 512 4096 4194304 MOUNTED EXTERN 1172

     

    SQL> SELECT MOUNT_STATUS,HEADER_STATUS,MODE_STATUS,STATE,TOTAL_MB,FREE_MB,NAME,PATH,LABEL FROM V$ASM_DISK;

    MOUNT_S HEADER_STATU MODE_ST STATE TOTAL_MB FREE_MB NAME PATH LABEL
    ------- ------------ ------- -------- ---------- ---------- ------------------------------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------
    CACHED MEMBER ONLINE NORMAL 20476 4568 DATA_0001 /dev/sdc1
    CACHED MEMBER ONLINE NORMAL 20476 4544 DATA_0000 /dev/sdb1
    CACHED MEMBER ONLINE NORMAL 10236 2284 DATA_0002 /dev/sdd1 DATA_0002

    [[email protected] dev]# asmcmd
    ASMCMD> lsdsk
    Path
    /dev/sdb1
    /dev/sdc1
    /dev/sdd1
    ASMCMD>
    =====================================================================================================================================================
    DROP DISK from DISKGROUP
    =========================
    When a disk is dropped, the disk group is rebalanced by moving all of the file extents from the dropped disk to other disks in the disk group. A drop disk operation might fail if not enough space is available on the other disks. The best approach is to perform both the add and drop operation with the same ALTER DISKGROUP statement. This has the benefit of rebalancing data extents only one time and ensuring that there is enough space for the rebalance operation to succeed.

    The ALTER DISKGROUP...DROP DISK SQL statement returns to SQL prompt before the drop and rebalance operations are complete. Do not reuse, remove, or disconnect the dropped disk until the HEADER_STATUS column for this disk in the V$ASM_DISK view changes to FORMER. You can query the V$ASM_OPERATION view to determine the amount of time remaining for the drop/rebalance operation to complete.

    You can also drop disks from a disk group with ASMCA. (GUI)
    ======================================================================================================================================================

    SQL> col disk_group_name for a20
    SQL> col disk_file_path for a20
    SQL> col disk_file_name for a20
    SQL> col disk_file_fail_group for a20
    SQL>
    SQL> set linesize 9999

    SQL> SELECT
    NVL(a.name, '[CANDIDATE]') disk_group_name
    , b.path disk_file_path
    , b.name disk_file_name
    , b.failgroup disk_file_fail_group
    FROM
    v$asm_diskgroup a RIGHT OUTER JOIN v$asm_disk b USING (group_number)
    ORDER BY
    a.name;

    DISK_GROUP_NAME DISK_FILE_PATH DISK_FILE_NAME DISK_FILE_FAIL_GROUP
    -------------------- -------------------- -------------------- --------------------
    DATA /dev/sdd1 DATA_0002 DATA_0002
    DATA /dev/sdb1 DATA_0000 DATA_0000
    DATA /dev/sdc1 DATA_0001 DATA_0001

    SQL>

    SQL> ALTER DISKGROUP DATA DROP DISK DATA_0002;

    SQL> SELECT
    2 NVL(a.name, '[CANDIDATE]') disk_group_name
    , b.path disk_file_path
    3 4 , b.name disk_file_name
    5 , b.failgroup disk_file_fail_group
    6 FROM
    7 v$asm_diskgroup a RIGHT OUTER JOIN v$asm_disk b USING (group_number)
    8 ORDER BY
    a.name; 9

    DISK_GROUP_NAME DISK_FILE_PATH DISK_FILE_NAME DISK_FILE_FAIL_GROUP
    -------------------- -------------------- -------------------- --------------------
    DATA /dev/sdc1 DATA_0001 DATA_0001
    DATA /dev/sdb1 DATA_0000 DATA_0000
    [CANDIDATE] /dev/sdd1

    SQL>

    SQL> select name,path from v$asm_disk;

    NAME PATH
    ---------- --------------------
    /dev/sdd1
    DATA_0001 /dev/sdc1
    DATA_0000 /dev/sdb1

    SQL>

    [[email protected] dev]# oracleasm -h
    Usage: oracleasm [--exec-path=<exec_path>] <command> [ <args> ]
    oracleasm --exec-path
    oracleasm -h
    oracleasm -V

    The basic oracleasm commands are:
    configure Configure the Oracle Linux ASMLib driver
    init Load and initialize the ASMLib driver
    exit Stop the ASMLib driver
    scandisks Scan the system for Oracle ASMLib disks
    status Display the status of the Oracle ASMLib driver
    listdisks List known Oracle ASMLib disks
    listiids List the iid files
    deleteiids Delete the unused iid files
    querydisk Determine if a disk belongs to Oracle ASMlib
    createdisk Allocate a device for Oracle ASMLib use
    deletedisk Return a device to the operating system
    renamedisk Change the label of an Oracle ASMlib disk
    update-driver Download the latest ASMLib driver
    [[email protected] dev]#
    [[email protected] dev]#
    [[email protected] dev]# oracleasm deletedisk DATA_0002
    Clearing disk header: done
    Dropping disk: done
    [[email protected] dev]#

    [[email protected] dev]# asmcmd
    ASMCMD> lsdsk
    Path
    /dev/sdb1
    /dev/sdc1
    ASMCMD>

    SQL> ALTER DISKGROUP DATA REBALANCE POWER 5 WAIT;

    Diskgroup altered.

    SQL>