当前位置: 代码迷 >> 综合 >> DataGuard ORA-01111文件创建失败问题解决
  详细解决方案

DataGuard ORA-01111文件创建失败问题解决

热度:56   发布时间:2023-12-13 10:20:52.0

原文:http://www.eygle.com/archives/2009/07/dataguard_ora_01111.html

在DataGuard环境中,由于备库的路径、存储、空间等问题,可能会导致文件创建失败的问题。
在正常情况下,如果配置正确,文件是能够自动创建的,出错时可能的日志如下:

Sun Jul  5 23:28:23 2009
Media Recovery Log /opt/oracle/archivelog/1_47_689973859.dbf
Media Recovery Log /opt/oracle/archivelog/1_48_689973859.dbf
Media Recovery Log /opt/oracle/archivelog/1_49_689973859.dbf
WARNING: File being created with same name as in Primary
Existing file may be overwritten
File #5 added to control file as 'UNNAMED00005'.
Originally created as:
'/opt/oracle/oradata/mmstest/test01.dbf'
Recovery was unable to create the file as:
'/opt/oracle/oradata/mmstest/test01.dbf'
Errors with log /opt/oracle/archivelog/1_49_689973859.dbf
出现此种情况,进一步的告警日志可能会报出如下错误:
Sun Jul  5 23:28:28 2009
Errors in file /opt/oracle/admin/mmstest/bdump/mmstest_mrp0_32062.trc:
ORA-19502: write error on file "/opt/oracle/oradata/mmstest/test01.dbf", blockno 1024 (blocksize=8192)
ORA-27072: File I/O error
Linux Error: 9: Bad file descriptor
Additional information: 4
Additional information: 1024
Additional information: 397312
Some recovered datafiles maybe left media fuzzy
Media recovery may continue but open resetlogs may fail
Sun Jul  5 23:28:29 2009
Errors in file /opt/oracle/admin/mmstest/bdump/mmstest_mrp0_32062.trc:
ORA-19502: write error on file "/opt/oracle/oradata/mmstest/test01.dbf", blockno 1024 (blocksize=8192)
ORA-27072: File I/O error
Linux Error: 9: Bad file descriptor
Additional information: 4
Additional information: 1024
Additional information: 397312
以及尝试recover时可能再次出现:
Mon Jul  6 01:36:30 2009
Errors in file /opt/oracle/admin/mmstest/bdump/mmstest_mrp0_32589.trc:
ORA-01111: name for data file 5 is unknown - rename to correct file
ORA-01110: data file 5: '/opt/oracle/product/10.2.0/dbs/UNNAMED00005'
ORA-01157: cannot identify/lock data file 5 - see DBWR trace file
ORA-01111: name for data file 5 is unknown - rename to correct file
ORA-01110: data file 5: '/opt/oracle/product/10.2.0/dbs/UNNAMED00005'
出现这些错误时MRP进程会停止工作,恢复中断:
Mon Jul  6 01:36:30 2009
MRP0: Background Media Recovery process shutdown (mmstest)
在修正相关的问题之后,我们可以进行如下一系列的操作来恢复这些错误:
SQL>  alter system set standby_file_management=manual;

System altered.

SQL>  alter database create datafile 
  2   '/opt/oracle/product/10.2.0/dbs/UNNAMED00005' as '/opt/oracle/oradata/mmstest/test01.dbf';


Database altered.

SQL>  alter system set standby_file_management=auto;

System altered.

SQL>  recover managed standby database disconnect from session;
Media recovery complete.
此时备库的恢复得以继续:
Mon Jul  6 01:41:14 2009
ALTER SYSTEM SET standby_file_management='MANUAL' SCOPE=MEMORY;
Mon Jul  6 01:42:13 2009
alter database create datafile
'/opt/oracle/product/10.2.0/dbs/UNNAMED00005' as '/opt/oracle/oradata/mmstest/test01.dbf'
Mon Jul  6 01:42:14 2009
Completed: alter database create datafile
'/opt/oracle/product/10.2.0/dbs/UNNAMED00005' as '/opt/oracle/oradata/mmstest/test01.dbf'
Mon Jul  6 01:42:26 2009
ALTER SYSTEM SET standby_file_management='AUTO' SCOPE=MEMORY;
Mon Jul  6 01:42:40 2009
ALTER DATABASE RECOVER  managed standby database disconnect from session
Mon Jul  6 01:42:40 2009
Attempt to start background Managed Standby Recovery process (mmstest)
MRP0 started with pid=16, OS id=32607
Mon Jul  6 01:42:41 2009
MRP0: Background Managed Standby Recovery process started (mmstest)
Managed Standby Recovery not using Real Time Apply
 parallel recovery started with 3 processes
Media Recovery Log /opt/oracle/archivelog/1_49_689973859.dbf
Mon Jul  6 01:42:47 2009
Completed: ALTER DATABASE RECOVER  managed standby database disconnect from session
Mon Jul  6 01:43:02 2009
Media Recovery Log /opt/oracle/archivelog/1_50_689973859.dbf
Mon Jul  6 01:43:17 2009
Media Recovery Log /opt/oracle/archivelog/1_51_689973859.dbf
Mon Jul  6 01:43:32 2009
Media Recovery Log /opt/oracle/archivelog/1_52_689973859.dbf
Mon Jul  6 01:43:45 2009
Media Recovery Log /opt/oracle/archivelog/1_53_689973859.dbf
正常情况下的配置及文件创建,其提示应该类似如下过程:
Mon Jul  6 01:53:28 2009
WARNING: File being created with same name as in Primary
Existing file may be overwritten
Recovery created file /opt/oracle/oradata/mmstest/wztest02.dbf
Successfully added datafile 7 to media recovery
Datafile #7: '/opt/oracle/oradata/mmstest/wztest02.dbf'
Media Recovery Log /opt/oracle/archivelog/1_80_689973859.dbf
在这个测试环境中,是由于空间不足导致的文件创建失败。

注意,在以上步骤中,如果standby_file_management设置为AUTO时,执行create命令会遇到如下错误:
SQL> alter database rename 
  2  file '/opt/oracle/product/10.2.0/dbs/UNNAMED00005' to '/opt/oracle/oradata/mmstest/test01.dbf';

alter database rename
*
ERROR at line 1:
ORA-01511: error in renaming log/data files
ORA-01275: Operation RENAME is not allowed if standby file management is automatic.


-The End-
  相关解决方案