0
点赞
收藏
分享

微信扫一扫

How To Remove An Empty ASM System Directory


 

       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 should 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 ​​​​+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 would 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 should run the following two commands instead of  "DROP DATABASE INCLUDING BACKUPS;":

RMAN> delete backupset;

RMAN> drop database;

 

 

 

 

From Oracle

  聊天2群:69087192

举报

相关推荐

0 条评论