RMAN备份恢复报错 ORA-19573: cannot obtain exclusive enqueue for datafile 5
用vi 编辑了一个数据文件 ,导致下面的错误:
验证还原
RMAN> validate datafile 5;
Starting validate at 2015-06-29 22:26:23
using channel ORA_DISK_1
channel ORA_DISK_1: starting validation of datafile
channel ORA_DISK_1: specifying datafile(s) for validation
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of validate command on ORA_DISK_1 channel at 06/29/2015 22:26:23
ORA-01122: database file 5 failed verification check
ORA-01110: data file 5: '/export/11g/oradata/orcl/example01.dbf'
ORA-01565: error in identifying file '/export/11g/oradata/orcl/example01.dbf'
ORA-27046: file size is not a multiple of logical block size
Additional information: 1
列出备份信息
RMAN> list backup;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
5 Full 69.02M DISK 00:00:06 2015-06-29 21:06:47
BP Key: 5 Status: AVAILABLE Compressed: NO Tag: TAG20150629T210641
Piece Name: /export/11g/flash_recovery_area/ORCL1/backupset/2015_06_29/o1_mf_nnndf_TAG20150629T210641_bs3tx260_.bkp
List of Datafiles in backup set 5
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ------------------- ----
5 Full 1422071 2015-06-29 21:06:42 /export/11g/oradata/orcl/example01.dbf
之前做了一个备份,准备还原:
还原准备
RMAN> restore datafile 5;
Starting restore at 2015-06-29 22:28:33
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00005 to /export/11g/oradata/orcl/example01.dbf
channel ORA_DISK_1: reading from backup piece /export/11g/flash_recovery_area/ORCL1/backupset/2015_06_29/o1_mf_nnndf_TAG20150629T210641_bs3tx260_.bkp
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 06/29/2015 22:28:35
ORA-19870: error while restoring backup piece /export/11g/flash_recovery_area/ORCL1/backupset/2015_06_29/o1_mf_nnndf_TAG20150629T210641_bs3tx260_.bkp
ORA-19573: cannot obtain exclusive enqueue for datafile 5
出现了错误 ORA-19573: cannot obtain exclusive enqueue for datafile 5
SQL> select FILE_NAME,STATUS,ONLINE_STATUS from dba_data_files;
FILE_NAME
--------------------------------------------------------
/export/11g/oradata/orcl/example01.dbf
AVAILABLE ONLINE
设置数据文件离线
我们可以看到数据文件还是在线的状态,现将其离线,再次查看状态,变成了recover 状态。
SQL> alter database datafile 5 offline;
Database altered.
Database altered.
SQL> select FILE_NAME,STATUS,ONLINE_STATUS from dba_data_files;
FILE_NAME
--------------------------------------------------------------------------------
/export/11g/oradata/orcl/example01.dbf
AVAILABLE RECOVER
再次执行还原
RMAN> restore datafile 5;
Starting restore at 2015-06-29 22:32:36
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00005 to /export/11g/oradata/orcl/example01.dbf
channel ORA_DISK_1: reading from backup piece /export/11g/flash_recovery_area/ORCL1/backupset/2015_06_29/o1_mf_nnndf_TAG20150629T210641_bs3tx260_.bkp
channel ORA_DISK_1: piece handle=/export/11g/flash_recovery_area/ORCL1/backupset/2015_06_29/o1_mf_nnndf_TAG20150629T210641_bs3tx260_.bkp tag=TAG20150629T210641
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
Finished restore at 2015-06-29 22:32:44
这次还原成功了。