• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Migrate ASM Disk Groups to another Storage Online [When ASMLIB Devices Are Involved]

by admin

The post explains in detail the exact steps to migrate ASM diskgroups (when using ASMLIB devices) from one storage to another storage without a downtime. This procedure will also work for diskgroups hosting OCR, Vote files and ASM spfiles.

Note: These steps are applicable to External, Normal & High redundancy diskgroups.

Creating New ASM disks

If you need to migrate and to replace the current ASMLIB disks associated to your diskgroups to a new storage, then you can perform this operation without any downtime, therefore you can follow the next steps:

1. Backup all your databases and valid the backup (it is always required to protect your data).

2. Create new ASMLIB devices on the new storage physical disks using the “/etc/init.d/oracleasm createdisk” command as root OS user. For example:

# /etc/init.d/oracleasm createdisk ASMDISK_NEW_SAN_1 /dev/mapper/mpathbp1
# /etc/init.d/oracleasm createdisk ASMDISK_NEW_SAN_2 /dev/mapper/mpathcp1
How To Add New Disk to An Existing Diskgroup on RAC Cluster or Standalone ASM Configuration

3. Scan the new ASMIB disks on all the other RAC nodes as follows (as root OS user). on Standalone configurations the disks are implicitly scanned during the ASMLIB disk creation.

# /etc/init.d/oracleasm scandisks

4. Make sure the new ASMLIB disks and old ASMLIB disks are present on all the RAC Cluster nodes or Standalone configurations as follows:

# /etc/init.d/oracleasm listdisks
ASMDISK_NEW_SAN_1
ASMDISK_NEW_SAN_2

ASMDISK_OLD_SAN_1
ASMDISK_OLD_SAN_2
# /usr/sbin/oracleasm-discover 'ORCL:*'
Using ASMLib from /opt/oracle/extapi/64/asm/orcl/1/libasm.so
[ASM Library - Generic Linux, version 2.0.4 (KABI_V2)]

Discovered disk: ORCL:ASMDISK_NEW_SAN_1 [40017852 blocks (20489140224 bytes), maxio 512]
Discovered disk: ORCL:ASMDISK_NEW_SAN_2 [40017852 blocks (20489140224 bytes), maxio 512]

Discovered disk: ORCL:ASMDISK_OLD_SAN_1 [40017852 blocks (20489140224 bytes), maxio 512]
Discovered disk: ORCL:ASMDISK_OLD_SAN_2 [40017852 blocks (20489140224 bytes), maxio 512]

5. Verify the ASM discovery string (“ASM_DISKSTRING”) is correctly pointing to the ASMLIB devices (in all the ASM instances) as follows:

$ . oraenv
ORACLE_SID = [+ASM1] ? +ASM
The Oracle base remains unchanged with value /u01/app/grid
[grid@dbaasm ~]$ sqlplus "/as sysasm"

SQL*Plus: Release 11.2.0.3.0 Production on Mon Aug 18 18:39:28 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> show parameter  ASM_DISKSTRING

NAME                  TYPE        VALUE
------------------   ---------    --------------
asm_diskstring       string       ORCL:*

6. Then confirm that the new ASMLIB disks and old ASMLIB disks are being detected by ASM as follows:

SQL> select path from v$asm_disk;

PATH
--------------------------
ORCL:ASMDISK_NEW_SAN_1
ORCL:ASMDISK_NEW_SAN_2

ORCL:ASMDISK_OLD_SAN_1
ORCL:ASMDISK_OLD_SAN_2

Addign the New ASM disks

1. Add the new disks to your desired diskgroup as follows:
Syntax

SQL> alter diskgroup [diskgroup name] add disk
'[new disk 1]',
'[new disk 2]' rebalance power N;

For Example:

SQL> alter diskgroup DATA add disk
'ORCL:ASMDISK_NEW_SAN_1',
'ORCL:ASMDISK_NEW_SAN_2' rebalance power 11;

2. Then wait until the rebalance operation completes:

SQL> select * from v$asm_operation;

no rows selected
SQL> select * from gv$asm_operation;

no rows selected
How to change the ASM rebalance power of an ongoing operation

Removing old ASM Disks

1. Finally, remove the old disks:
Syntax

SQL> alter diskgroup [diskgroup name] drop disk
[disk name A],
[disk name B] rebalance power #N;

For Example:

SQL> alter diskgroup DATA drop disk
ASMDISK_OLD_SAN_1,
ASMDISK_OLD_SAN_2 rebalance power 11;

2. Then wait until the rebalance operation completes:

SQL> select * from v$asm_operation;

no rows selected
SQL> select * from gv$asm_operation;

no rows selected

After the old disks are completely expelled from the diskgroup(s), then your ASM diskgroup(s) and database(s) have been migrated to the new storage.

Executing Add and delete operations together

1. Alternatively, we can execute add disk & drop disk statements in one operation, in that way only one rebalance operation will be started as follow:
Syntax

SQL> alter diskgroup [diskgroup name]
add disk '[new disk 1>', .., '[new disk N]'
drop disk [old disk 1>,  .., '[old disk N] rebalance power N;

For Example:

SQL> alter diskgroup DATA add disk
'ORCL:ASMDISK_NEW_SAN_1',
'ORCL:ASMDISK_NEW_SAN_2'
drop disk
ASMDISK_OLD_SAN_1,
ASMDISK_OLD_SAN_2 rebalance power 11;

2. This is more efficient than separated commands (add disk & drop disk statements). Then wait until the rebalance operation completes:

SQL> select * from v$asm_operation;

no rows selected
SQL> select * from gv$asm_operation;

no rows selected

Best Practices

– As a best practice, never execute the “/etc/init.d/oracleasm deletedisk” command on active ASMLIB disks (those which are currently being used by ASM diskgroups as disks members).
– Never execute the “/etc/init.d/oracleasm createdisk” command on active ASMLIB disks (those which are currently being used by ASM diskgroups as disks members).
– Never remove/format/modify/overlap/resize (at OS level or hardware) the physical associated disk until the corresponding logical ASMLIB/ASM disk is completely dropped and expelled from the ASM diskgroup (in other words, until the rebalance operation completes).
– On 10g, a manual rebalance operation is required to restart the diskgroup rebalance and expel the disk(s) because on 10g (if something wrong happens on disk expelling, e.g. hanging) ASM will not restart the ASM rebalance automatically (this was already enhanced on 11g and 12c), therefore you will need to restart a manual rebalance operation as follows:

SQL> alter diskgroup [diskgroup name] rebalance power 11;
How to Migrate ASM Disk Groups to another Storage Online [non ASMLIB Devices]

Filed Under: ASM, oracle

Some more articles you might also be interested in …

  1. Oracle Home Relinking Interview Questions and Answers
  2. How to check which options or features are used in the Oracle database
  3. How to configure Partitioned Block Devices (Non-ASMLIB) And Assign Them To ASM
  4. Oracle 19c New Feature – SQL_DIAGNOSE_AND_REPAIR (New Automatic Diagnostics and Repair Function)
  5. Oracle Database Storage Architecture – Overview
  6. Oracle 12c Multitenant Architecture: Troubleshooting Ora-12518
  7. How To Change SYS user password for oracle database instance
  8. How to Start/Stop/Relocate SCAN listener in Oracle 11gR2 RAC
  9. What are different Oracle Database Vault Roles
  10. Oracle 12C Enhancements for Cascaded Standby Databases

You May Also Like

Primary Sidebar

Recent Posts

  • pw-cat Command Examples in Linux
  • pvs: command not found
  • pulseaudio: command not found
  • pulseaudio Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright