1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Oracle ASM から Databaseファイル削除する

Last updated at Posted at 2016-01-27

Database は削除したのに、ASM上にファイルが残っている
削除したい、そんなときのスクリプト

column a format a120
set linesize 120

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;

実行すると プロンプトが あらわれるので データベース名を入力

Enter value for databasename: ORCL
old 15: and a.name = '&DATABASENAME'
new 15: and a.name = 'ORCL'

あとは ASMインスタンスで 出力された alter文を実行する

alter diskgroup DATA drop file '+DATA/ORCL/ARCHIVELOG/2016_01_08/thread_1_seq_81.272.707781651';
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?