今天在做一个备份的时候,出现磁盘耗尽的错误,具体如下:
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 06/12/2014 19:23:43
ORA-19504: failed to create file "+ASM"
ORA-17502: ksfdcre:4 Failed to create file +ASM
ORA-15041: diskgroup space exhausted
查看ASM的alert日志,发现以下警告:
WARNING: allocation failure on disk ASM_0000 for file 284 xnum 386
WARNING: allocation failure on disk ASM_0001 for file 284 xnum 386
WARNING: allocation failure on disk ASM_0000 for file 284 xnum 386
WARNING: allocation failure on disk ASM_0001 for file 284 xnum 386
ASM的alert日志位置,在我的机器上的位置(因人而异):
[oracle@kel bdump]$ vim alert_+ASM.log
[oracle@kel bdump]$ pwd
/home/oracle/admin/+ASM/bdump
本来是一个最基本的错误,然后查看磁盘空间的大小,如下:
SQL> select name,state,total_mb,free_mb from v$asm_diskgroup;
NAME STATE TOTAL_MB FREE_MB
---------- ---------- ---------- ----------
ASM MOUNTED 4094 774
KEL MOUNTED 4094 2500
从上面可以看出,在ASM磁盘组中,ASM的磁盘组共有两个组,一个组为ASM,剩余的空间774M,另外一个组为KEL,剩余的磁盘空间为1个多G,此次备份的数据大约在一个G内,那么磁盘组ASM的空间肯定是不够的,但是磁盘组KEL的空间是足够的,从而再次进行备份:
RMAN> backup as copy database format '+ASM/KEL';
Starting backup at 12-JUN-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001 name=/home/oracle/oradata/ipap/system01.dbf
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 06/12/2014 19:37:32
ORA-19504: failed to create file "+ASM/kel"
ORA-17502: ksfdcre:4 Failed to create file +ASM/kel
ORA-15041: diskgroup space exhausted
此备份语句的本意是将备份数据放在实例名为ASM的asm实例中,然后放在KEL磁盘组中,发现报错依然是磁盘空间耗尽的错误,在这里也是犯了一个最基本的错误,在选择ASM磁盘组的时候,使用的应该是直接磁盘组的名称即可,而不需要加上实例名,在这里能犯这个错误,主要是实例名称为ASM,而有一个组的名称恰好也为ASM,从而也没有进行深究,在选择磁盘组的时候,直接使用“+磁盘组名称”即可:
RMAN> backup as copy database format '+KEL';
Starting backup at 12-JUN-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001 name=/home/oracle/oradata/ipap/system01.dbf
output filename=+KEL/ipap/datafile/system.260.850074633 tag=TAG20140612T195029 recid=6 stamp=850074717
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:35
channel ORA_DISK_1: starting datafile copy
从而得出,在使用ASM磁盘组的时候,指定ASM磁盘组时,只要直接使用+磁盘组名称即可,不需要其他的东西。
在前面的报错中,无论是使用什么语句,它都是将备份文件放在ASM磁盘组中,而恰好ASM磁盘组的空间不足,从而导致出现磁盘空间不足的错误。