1

We have deleted a database but the archive logs remain. We need to delete these as they take a lot of space:

Since the database is deleted, it is not in the rman catalogue so I cannot use delete archivelog expired in Rman to delete these files.

I read about asmcmd but I'm afraid to put out of sync the Enterprise Manager's records with the actual disk content going that way.

What is the cleanest way to proceed?

1 Answer 1

1

We finally deleted the files manually and OEM is fine.

We ran this query to get the delete scripts:

SELECT 'alter diskgroup ' 
       || gname 
       || ' drop file ''+' 
       || gname 
       || Sys_connect_by_path(aname, '/') 
       || ''';' a 
FROM   (SELECT b.name            gname, 
               a.parent_index    pindex, 
               a.name            aname, 
               a.reference_index rindex, 
               a.system_created, 
               a.alias_directory 
        FROM   v$asm_alias a, 
               v$asm_diskgroup b 
        WHERE  a.group_number = b.group_number) 
WHERE  alias_directory = 'N' 
       AND system_created = 'Y' 
START WITH ( MOD(pindex, Power(2, 24)) ) = 0 
           AND rindex IN (SELECT a.reference_index 
                          FROM   v$asm_alias a, 
                                 v$asm_diskgroup b 
                          WHERE  a.group_number = b.group_number 
                                 AND ( MOD(a.parent_index, Power(2, 24)) ) = 0 
                                 AND a.name = '&DATABASENAME') 
CONNECT BY PRIOR rindex = pindex; 

Replace &DATABASENAME with your old database name and then run the scripts.

Important note: you would normally not do this. I'm sure my database has been deleted and that the remaining files are completely useless. If your intent is to clean obsolete archive logs, use RMAN instead. It's safe and really easy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.