Friday, June 29, 2018

How to Add Disk in ASM Disk Group

We have raw disk /dev/sde which we are going add in existing Disk Group DATA.
 [root@stage ~]# fdisk /dev/sde
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x185ef87e.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
 Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
 WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').
 Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-8192, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-8192, default 8192):
Using default value 8192
 Command (m for help): w
The partition table has been altered!
 Calling ioctl() to re-read partition table.
Syncing disks.
 [root@stage ~]#  partprobe /dev/sde
 [root@stage ~]#  fdisk -l
Disk /dev/sdc: 1073 MB, 1073741824 bytes
34 heads, 61 sectors/track, 1011 cylinders
Units = cylinders of 2074 * 512 = 1061888 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x6dab55b0

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1        1011     1048376+  83  Linux

Disk /dev/sdd: 6442 MB, 6442450944 bytes
199 heads, 62 sectors/track, 1019 cylinders
Units = cylinders of 12338 * 512 = 6317056 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x9904376c

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1        1019     6286180   83  Linux

Disk /dev/mapper/VolGroup00-root: 24.2 GB, 24201134080 bytes
255 heads, 63 sectors/track, 2942 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
  
Disk /dev/mapper/VolGroup00-swap: 2113 MB, 2113929216 bytes
255 heads, 63 sectors/track, 257 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
 Disk /dev/sde: 8589 MB, 8589934592 bytes
64 heads, 32 sectors/track, 8192 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x185ef87e

   Device Boot      Start         End      Blocks   Id  System
/dev/sde1               1        8192     8388592   83  Linux

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

NAME
NAME
SECTOR_SIZE
BLOCK_SIZE
ALLOCATION_UNIT_SIZE
STATE
TOTAL_MB
FREE_MB
1
DATA
512
4 096
1 048 576
MOUNTED
EXTERN
438
2
INDX
512
4 096
1 048 576
MOUNTED
EXTERN
795

[root@stage ~]# /etc/init.d/oracleasm createdisk DATA_0001 /dev/sde1
Marking disk "DATA_0001" as an ASM disk:                   [  OK  ]

[grid@stageoem1 ~]$ asmcmd -p
ASMCMD [+] > lsdsk
Path
ORCL:DATA_0000
ORCL:DATA_0001
ORCL:INDX_0000
ASMCMD [+] >
-- 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
ORCL:DATA_0000
DATA_0000
DATA_0000
INDX
ORCL:INDX_0000
INDX_0000
INDX_0000
[CANDIDATE]
ORCL:DATA_0001



[grid@stage ~]$ sqlplus / as sysasm

-- Add disk to the group DATA (you need to login as sysasm not sysdba)
SQL> ALTER DISKGROUP DATA ADD DISK 'ORCL:DATA_0001';

Diskgroup altered.

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
ORCL:DATA_0000
DATA_0000
DATA_0000
DATA
ORCL:DATA_0001
DATA_0001
DATA_0001
INDX
ORCL:INDX_0000
INDX_0000
INDX_0000

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

NAME
NAME
SECTOR_SIZE
BLOCK_SIZE
ALLOCATION_UNIT_SIZE
STATE
TOTAL_MB
FREE_MB
1
DATA
512
4 096
1 048 576
MOUNTED
EXTERN
8627
2
INDX
512
4 096
1 048 576
MOUNTED
EXTERN
795

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

MOUNT_STATUS
HEADER_STATUS
MODE_STATUS
STATE
TOTAL_MB
FREE_MB
NAME
PATH
LABEL
CACHED
MEMBER
ONLINE
NORMAL
2 046
1 720
DATA_0000
ORCL:DATA_0000
DATA_0000
CACHED
MEMBER
ONLINE
NORMAL
1 023
795
INDX_0000
ORCL:INDX_0000
INDX_0000
CACHED
MEMBER
ONLINE
NORMAL
8 191
6 907
DATA_0001
ORCL:DATA_0001
DATA_0001

No comments:

Post a Comment

RMAN Block Change Tracking and “_bct_public_dba_buffer_size” Hidden Parameter

One important feature  “block change tracking” that comes with 10g, keeps log of the blocks changed since the last backup. During the next ...