Migrate the data from one disk to another or Add new disk and remove old disk in oracle ASM

old disk:

DATA_DISK


New disk:

DATA12_DISK


Step-1: check what disks are allocate to the diskgroup


. oraenv

+ASM1

sqlplus / as sysasm


set linesize 300

set pagesize 1000

set colsep |

col name for a15

col PATH for a44

col HEADER_STATUS for a10

col MODE_STATUS for a10

col DN for 9999

col STATE for a10

col LABEL for a25


select group_number,name from v$asm_diskgroup order by name;

select 

      a.GROUP_NUMBER gn,

      b.name,

      a.DISK_NUMBER DN,

      a.PATH,

      a.MOUNT_STATUS M_Status,

      a.HEADER_STATUS H_Status,

      a.MODE_STATUS,

      a.STATE,

      a.OS_MB,

      a.TOTAL_MB,

      a.FREE_MB

from  

      v$asm_disk A, 

      v$asm_diskgroup B 

      Where A.group_number=B.group_number(+)  

      and a.GROUP_NUMBER = &group_number 

      order by a.path;

output:


        GN|NAME           |   DN|  PATH                                      |M_STATU|H_STATUS    |MODE_STATU|STATE     |     OS_MB|  TOTAL_MB|   FREE_MB

----------|---------------|-----|--------------------------------------------|-------|------------|----------|----------|----------|----------|----------

        28|DATA_DISK      |    1|  /dev/oracleasm/disks/DATA12_DISK_VOL001     |CACHED |MEMBER      |ONLINE    |NORMAL    |    819209|    819208|    507704

        28|DATA12_DISK    |    0|  /dev/oracleasm/disks/DATA_DISK_VOL042     |CACHED |MEMBER      |ONLINE    |NORMAL    |    819209|    819208|    400844


Step-2: Add new disk to ASM diskgroup 


. oraenv

+ASM1

sqlplus / as sysasm


ALTER DISKGROUP DATA12_DISK ADD DISK '/dev/oracleasm/disks/DATA12_DISK_VOL001' REBALANCE POWER 5;



Step-3: Since we have added the new disk to the diskgroup, there would be re-balancing in progress in the background

        run the below script to monitor the re-balancing progress. make sure and wait until the re-balancing

        complete before we drop the existing disk.



. oraenv

+ASM1

sqlplus / as sysasm


SET pagesize 299

SET lines 2999

SELECT GROUP_NUMBER,

       OPERATION,

       STATE,

       POWER,

       ACTUAL,

       ACTUAL,

       EST_MINUTES

FROM gv$asm_operation;



Step-4: drop the existing diskgroup.


find the disk name:


select NAME,PATH,LABEL from v$asm_disk where GROUP_NUMBER=31;


ALTER DISKGROUP DATA12_DISK DROP DISK DATA_DISK_VOL042 REBALANCE POWER 5;


monitor rebalance operation


SET pagesize 299

SET lines 2999

SELECT GROUP_NUMBER,

       OPERATION,

       STATE,

       POWER,

       ACTUAL,

       ACTUAL,

       EST_MINUTES

FROM gv$asm_operation;


Step-4: Validate the disks status for the diskgroup 



. oraenv

+ASM1

sqlplus / as sysasm


set linesize 300

set pagesize 1000

set colsep |

col name for a15

col PATH for a44

col HEADER_STATUS for a10

col MODE_STATUS for a10

col DN for 9999

col STATE for a10

col LABEL for a25


select group_number,name from v$asm_diskgroup order by name;

select 

      a.GROUP_NUMBER gn,

      b.name,

      a.DISK_NUMBER DN,

      a.PATH,

      a.MOUNT_STATUS M_Status,

      a.HEADER_STATUS H_Status,

      a.MODE_STATUS,

      a.STATE,

      a.OS_MB,

      a.TOTAL_MB,

      a.FREE_MB

from  

      v$asm_disk A, 

      v$asm_diskgroup B 

      Where A.group_number=B.group_number(+)  

      and a.GROUP_NUMBER = &group_number 

      order by a.path;

  

  

Comments

Popular posts from this blog

Auditing in Oracle database

rs.stepDown() in MongoDB replication

Tuples in Python