Pages

Thursday, January 9, 2014

Unable to remove ASM Diskgroup from the ASM Instance

SCENARIO


  • I Was not able to remove the newly added ASM diskgroup ASM_DISK1 from ASM instance.


INSTANCE - ASM

ASM GRID - ORACLE 11G

REMOVED DISKGROUP NAME - ASM_DISK1

OS LEVEL DISK NAME ASSIGNED - DATA1

OPERATING SYSTEM - OEL 6.0


WORKINGS


SQL> select name from v$asm_diskgroup;

NAME
---------------------------------
DATA_GRP1
ASM_DISK1

SQL> select name from v$asm_disk;

NAME
---------------------------------
DATA_GRP1_0000
ASM_DISK1_0000

  • While dropping the diskgroup, i got the following error and I was not able to drop it.,

SQL> alter diskgroup ASM_DISK1 drop disk ASM_DISK1_0000;
alter diskgroup ASM_DISK1 drop disk ASM_DISK1_0000
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15250: insufficient diskgroup space for rebalance completion


SQL> alter diskgroup ASM_DISK1 drop disk ASM_DISK1_0000 rebalance power 8;
alter diskgroup ASM_DISK1 drop disk ASM_DISK1_0000 rebalance power 8
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15250: insufficient diskgroup space for rebalance completion

  • Checked the Total space and Free space of the ASM Diskgroup. Since the disk was a newly added one, there was enough free space.

SQL> set lines 200 pages 1000
SQL> col name format a30
SQL> select name,total_mb,free_mb from v$asm_disk;

NAME TOTAL_MB    FREE_MB
------------------------------ ----------         ----------
DATA_GRP1_0000   21050           20998
ASM_DISK1_0000   5567        5508


  • I tried to drop it again,


SQL> drop diskgroup ASM_DISK1 including contents;
drop diskgroup ASM_DISK1 including contents
*
ERROR at line 1:
ORA-15039: diskgroup not dropped
ORA-15027: active use of diskgroup "ASM_DISK1" precludes its dismount

  • I dismounted the diskgroup and tried to drop it.

SQL> alter diskgroup ASM_DISK1 dismount force;

Diskgroup altered.

SQL> drop diskgroup ASM_DISK1 including contents;
drop diskgroup ASM_DISK1 including contents
*
ERROR at line 1:
ORA-15039: diskgroup not dropped
ORA-15001: diskgroup "ASM_DISK1" does not exist or is not mounted

  • The below was the solution which I followed to remove the ASM diskgroup from the ASM Instance.

  • Created a pfile from the spfile in a different location and restarted the database using that pfile.

SQL> show parameter spfile 


NAME  TYPE      VALUE
------------------------ -------------------  ------------------------------------------------------------------------------
spfile  string      +ASM_DISK1/asm/asmparameterfile/registry.253.836335963


SQL> create pfile='/vol2/grid/init.ora' from spfile;

File created.

SQL> shut immediate
ASM diskgroups dismounted
ASM instance shutdown
SQL> startup nomount pfile='/vol2/grid/init.ora';
ASM instance started

Total System Global Area  283930624 bytes
Fixed Size    2227664 bytes
Variable Size  256537136 bytes
ASM Cache   25165824 bytes
SQL> 

SQL> alter diskgroup ASM_DISK1 mount;

Diskgroup altered.

SQL> drop diskgroup ASM_DISK1 including contents;

Diskgroup dropped.


  • Now mount the other ASM diskgroup.

SQL> alter diskgroup DATA_GRP1 mount;

Diskgroup altered.

SQL> create spfile from pfile='/vol2/grid/init.ora';

File created.

SQL> shut immediate
ASM diskgroups dismounted
ASM instance shutdown


  • Now create a spfile from the pfile and start up the instance.

SQL> create spfile from pfile='/vol2/grid/init.ora';

File created.
SQL> shut immediate
ASM diskgroups dismounted
ASM instance shutdown
SQL> 
SQL> startup
ASM instance started

Total System Global Area  283930624 bytes
Fixed Size    2227664 bytes
Variable Size  256537136 bytes
ASM Cache   25165824 bytes
ORA-15032: not all alterations performed
ORA-15017: diskgroup "ASM_DISK1" cannot be mounted
ORA-15063: ASM discovered an insufficient number of disks for diskgroup
"ASM_DISK1"


  • Here I faced another error. Even though after successful dropping of the ASM Disk, while starting the ASM instance, it automatically referred the removed disk also.
  • So I deleted the ASM disk using the Oracleasm command,

oracleasm deletedisk DATA1

[root@primary ~]# oracleasm deletedisk DATA1
Clearing disk header: done
Dropping disk: done
[root@primary ~]# oracleasm listdisks
DATA2
[root@primary ~]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
[root@primary ~]# 


  • I also changed the value of ORACLEASM_SCANORDER="" to ORACLEASM_SCANORDER="dm". But this also did not work.

primary:/vol2/grid />cat /etc/sysconfig/oracleasm
#
# This is a configuration file for automatic loading of the Oracle
# Automatic Storage Management library kernel driver.  It is generated
# By running /etc/init.d/oracleasm configure.  Please use that method
# to modify this file
#

# ORACLEASM_ENABELED: 'true' means to load the driver on boot.
ORACLEASM_ENABLED=true

# ORACLEASM_UID: Default user owning the /dev/oracleasm mount point.
ORACLEASM_UID=

# ORACLEASM_GID: Default group owning the /dev/oracleasm mount point.
ORACLEASM_GID=

# ORACLEASM_SCANBOOT: 'true' means scan for ASM disks on boot.
ORACLEASM_SCANBOOT=true

# ORACLEASM_SCANORDER: Matching patterns to order disk scanning
ORACLEASM_SCANORDER=dm

# ORACLEASM_SCANEXCLUDE: Matching patterns to exclude disks from scan
ORACLEASM_SCANEXCLUDE=""

primary:/vol2/grid />


  • Even though after deleting the ASM disk in OS level, the ASM instance was starting with the error.

SQL> conn / as sysasm
Connected to an idle instance.
SQL> startup
ASM instance started

Total System Global Area  283930624 bytes
Fixed Size    2227664 bytes
Variable Size  256537136 bytes
ASM Cache   25165824 bytes
ORA-15032: not all alterations performed
ORA-15017: diskgroup "ASM_DISK1" cannot be mounted
ORA-15063: ASM discovered an insufficient number of disks for diskgroup
"ASM_DISK1"


SOLUTION

  • Remove the old diskgroup name from the parameter file (PFILE) asm_diskgroups.

SQL> show parameter asm_diskgroups

NAME   TYPE  VALUE
------------------------------  ----------------  ------------------------------
asm_diskgroups   string   DATA_GRP1, ASM_DISK1
SQL> 

SQL> alter system set asm_diskgroups='DATA_GRP1' scope=both;

System altered.

SQL> show parameter disk

NAME   TYPE  VALUE
------------------------------  ----------------  ------------------------------
asm_diskgroups   string  DATA_GRP1
asm_diskstring   string /dev/oracleasm/disks/*
SQL>

  • Create a pfile from spfile.

SQL> create pfile='/vol2/grid/init.ora' from spfile;

File created.

  • Startup the ASM instance with the pfile.

SQL> shut immediate
ASM diskgroups dismounted
ASM instance shutdown

SQL> startup pfile='/vol2/grid/init.ora';
ASM instance started

Total System Global Area  283930624 bytes
Fixed Size     2227664 bytes
Variable Size   256537136 bytes
ASM Cache    25165824 bytes
ASM diskgroups mounted
SQL>

  • ASM Started normally.

  • Create a SPFILE and restart the ASM instance.

SQL> create spfile from pfile='/vol2/grid/init.ora';

File created.

SQL> shut immediate;
ASM diskgroups dismounted
ASM instance shutdown
SQL> startup
ASM instance started

Total System Global Area  283930624 bytes
Fixed Size    2227664 bytes
Variable Size  256537136 bytes
ASM Cache   25165824 bytes
ASM diskgroups mounted
SQL> 

SQL> set lines 200 pages 1000
SQL> col name format a25
SQL> select name,total_mb,free_mb from v$asm_disk;

NAME    TOTAL_MB FREE_MB
-------------------------   ----------      ----------
DATA_GRP1_0000     21050         20998

SQL> select name,total_mb,free_mb from v$asm_diskgroup;

NAME     TOTAL_MB FREE_MB
-------------------------   ----------      ----------
DATA_GRP1          21050         20998

SQL> 

  • Now we can see that there was no error message during the instance startup.



No comments:

Post a Comment