先谈谈如何进行ASM管理,我暂时总结有两种方式进入:
方法一:
oracle@GDGZ-DCS-SV01C-RAC01:~> export ORACLE_SID=+ASM1
oracle@GDGZ-DCS-SV01C-RAC01:~> sqlplus / as sysasm
SQL*Plus: Release 11.1.0.7.0 - Production on Sat Dec 25 10:27:44 2010
Copyright (c) 1982, 2008, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> select group_number, name, type, total_mb, free_mb
2 from v$asm_diskgroup;
1 DG_DATA EXTERN 1216512 1216325
2 DG_IDX EXTERN 399360 399180
3 DG_ORA EXTERN 92271 91877
方法二:
oracle@GDGZ-DCS-SV01C-RAC01:~> export ORACLE_SID=+ASM1
oracle@GDGZ-DCS-SV01C-RAC01:~> asmcmd
ASMCMD>
ASMCMD> lsdg
State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Name
MOUNTED EXTERN N 512 4096 1048576 1216512 1216325 0 1216325 0 DG_DATA/
MOUNTED EXTERN N 512 4096 1048576 399360 399180 0 399180 0 DG_IDX/
MOUNTED EXTERN N 512 4096 1048576 92271 91877 0 91877 0 DG_ORA/
ASMCMD> lsdsk
Path
/dev/raw/raw1
/dev/raw/raw2
/dev/raw/raw3
/dev/raw/raw4
/dev/raw/raw5
ASMCMD> pwd
+
ASMCMD> du
Used_MB Mirror_used_MB
216 216
ASMCMD> ls
DG_DATA/
DG_IDX/
DG_ORA/
个人比较推荐第二种方式,因为和常用的磁盘操作很类似(比如ls/cd/rm/cp等命令都可以使用)
我在RAC建库时就碰到这样一个问题:
1,第一次建库时进行到4%,发现日志文件的模板搞错了,立即停止执行建库
2,重新修改正确 后,再次建库,提示控制文件别名已被使用
于是我使用第二种方法进入ASM磁盘管理:
ASMCMD> cd DG_ORA
ASMCMD> ls
ORA/
ASMCMD> cd ORA
ASMCMD> ls
CONTROLFILE/
control01.ctl
control02.ctl
control03.ctl
control11.ctl
control12.ctl
control13.ctl
control21.ctl
control22.ctl
control23.ctl
果然看到了已经建好的控制文件(由于我试过几次修改控制文件别名,所以导致控制文件有9个),删除上面的控制文件
可见 control01.ctl只是一个链接(其实就是前面设置的别名),无法删除,必须进入到对应的摸板目录删除真实的数据文件
ASMCMD> cd CONTROLFILE/
ASMCMD> ls
Current.256.738606603
Current.257.738606603
Current.258.738606603
Current.259.738607647
Current.260.738607647
Current.261.738607647
Current.262.738609287
Current.263.738609287
Current.264.738609287
ASMCMD> ls -al
Type Redund Striped Time Sys Name
CONTROLFILE UNPROT FINE DEC 24 17:00:00 Y +DG_ORA/ORA/control01.ctl => Current.256.738606603
CONTROLFILE UNPROT FINE DEC 24 17:00:00 Y +DG_ORA/ORA/control02.ctl => Current.257.738606603
CONTROLFILE UNPROT FINE DEC 24 17:00:00 Y +DG_ORA/ORA/control03.ctl => Current.258.738606603
CONTROLFILE UNPROT FINE DEC 24 17:00:00 Y +DG_ORA/ORA/control11.ctl => Current.259.738607647
CONTROLFILE UNPROT FINE DEC 24 17:00:00 Y +DG_ORA/ORA/control12.ctl => Current.260.738607647
CONTROLFILE UNPROT FINE DEC 24 17:00:00 Y +DG_ORA/ORA/control13.ctl => Current.261.738607647
CONTROLFILE UNPROT FINE DEC 24 17:00:00 Y +DG_ORA/ORA/control21.ctl => Current.262.738609287
CONTROLFILE UNPROT FINE DEC 24 17:00:00 Y +DG_ORA/ORA/control22.ctl => Current.263.738609287
CONTROLFILE UNPROT FINE DEC 24 17:00:00 Y +DG_ORA/ORA/control23.ctl => Current.264.738609287
使用rm -rf *删除
重新建库成功!!!