How to remove an empty ASM system directory

Source: Internet
Author: User

 

Sometimes it can happen that the ASM contains empty System directories which cannot be removed. according to note 3751057.8 (alter diskgroup drop directory force removes system aliases) The system generated directories shoshould be removed automatically as soon as all it's files are removed. however this does not happen sometimes and a manual directory removal will fail:

 

SQL> set pages 2000
SQL> SELECT level, dir, sys, substr(lpad(' ',2*level,' ')||CONCAT('+'||gname,
     SYS_CONNECT_BY_PATH(aname,'/')),1,60) full_path
     FROM ( SELECT g.name gname, a.parent_index pindex, a.name aname,
     a.reference_index rindex, a.ALIAS_DIRECTORY dir, a.SYSTEM_CREATED sys
                      FROM v$asm_alias a, v$asm_diskgroup g
                    WHERE a.group_number = g.group_number)
     START WITH (MOD(pindex, POWER(2, 24))) = 0
     CONNECT BY PRIOR rindex = pindex
     ORDER BY rtrim(ltrim(full_path))desc, level asc;

          3 N Y       +DATA/UDWH/DATAFILE/ADASTRA.376.624105133             
          2 Y Y     +DATA/UDWH/DATAFILE                                     
          3 N Y       +DATA/UDWH/CONTROLFILE/Current.486.624103637          
          3 N Y       +DATA/UDWH/CONTROLFILE/Current.479.624103637          
          3 N Y       +DATA/UDWH/CONTROLFILE/Current.434.624103637          
          2 Y Y     +DATA/UDWH/CONTROLFILE                                  
          1 Y Y   +DATA/UDWH                                               
          1 Y Y   +DATA/TDWH                                                
          2 N N     +DATA/IDWH/spfileIDWH.ora                               
          2 N N     +DATA/IDWH/control03.ctl                                
          2 N N     +DATA/IDWH/control02.ctl                                
          2 N N     +DATA/IDWH/control01.ctl  

 

The tdwh directory from the above list is empty but cannot be removed:

 

ASMCMD> cd tdwh
ASMCMD> ls
ASMCMD> cd ..
ASMCMD> rm -rf tdwh
ORA-15032: not all alterations performed
ORA-15177: cannot operate on system aliases (DBD ERROR: OCIStmtExecute)

 

alter diskgroup DATA drop directory  '+DATA/TDWH' FORCE; 
ORA-15032: not all alterations performed 
ORA-15177: cannot operate on system aliases (DBD ERROR: OCIStmtExecute)

A solution to remove these directories is to recreate the ASM diskgroups but this is not something one wocould do very often especially when the ASM is used by production databases.

 

Solution

Either:
Create a new database with the dbca having the same name as the old directory and subsequently drop the database with the dbca.

Or:
Create a dummy tablespace having a datafile within the directory to be dropped, drop the tablespace and then remove the datafile using the asmcmd tool. The old directory will be removed automatically.

 

There is a scenario when there are left behind directories after the database is dropped using rman's command "drop database including backups [noprompt];". when one falls into this there is no way out but to recreate the diskgroups. this problem is being investigated in bug 6606689. to avoid this issue one shoshould run the following two commands instead of "drop database including backups ;":

RMAN> Delete backupset;

RMAN> drop database;

 

 

 

 

From Oracle

Bytes -------------------------------------------------------------------------------------------------------

Blog: http://blog.csdn.net/tianlesoftware

Email: dvd.dba@gmail.com

Dba1 group: 62697716 (full); dba2 group: 62697977 (full) dba3 group: 62697850 (full)

Super DBA group: 63306533 (full); dba4 group: 83829929 dba5 group: 142216823

Chat group: 40132017 chat 2 group: 69087192

-- Add the group to describe the relationship between Oracle tablespace and data files in the remarks section. Otherwise, the application is rejected.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.