Active DataGuard由于db_file_name_convert设置不当,导致数据文件无法自动同步到备库问题处理过程。
检查主备日志同步
SQL> select max(sequence#) from v$archived_log;
MAX(SEQUENCE#)
--------------
386952
SQL> select max(sequence#) from v$archived_log where applied='YES';
MAX(SEQUENCE#)
--------------
386932
检查alter log
Managed Standby Recovery starting Real Time Apply
Thu Apr 07 10:04:08 2016
Errors in file /app/Oracle/diag/rdbms/pgsadg/pgsadg/trace/pgsadg_dbw0_31401.trc:
ORA-01186: file 35 failed verification tests
ORA-01157: cannot identify/lock data file 35 - see DBWR trace file
ORA-01111: name for data file 35 is unknown - rename to correct file
ORA-01110: data file 35: '/app/oracle/product/11.2.0/db_1/dbs/UNNAMED00035'
File 35 not verified due to error ORA-01157
MRP0: Background Media Recovery terminated with error 1111
Errors in file /app/oracle/diag/rdbms/pgsadg/pgsadg/trace/pgsadg_pr00_5529.trc:
ORA-01111: name for data file 35 is unknown - rename to correct file
ORA-01110: data file 35: '/app/oracle/product/11.2.0/db_1/dbs/UNNAMED00035'
ORA-01157: cannot identify/lock data file 35 - see DBWR trace file
ORA-01111: name for data file 35 is unknown - rename to correct file
ORA-01110: data file 35: '/app/oracle/product/11.2.0/db_1/dbs/UNNAMED00035'
Managed Standby Recovery not using Real Time Apply
Completed: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION
Recovery Slave PR00 previously exited with exception 1111
MRP0: Background Media Recovery process shutdown (pgsadg)
检查db_file_name_convert参数配置。
SQL> show parameter conver
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string +DATA_JD_DG/pgs/datafile/, /da
ta/pgs/datafile/, +DATA_JD_DG/
pgs/tempfile/, /data/pgs/tempf
ile/
select file_name,file_id from dba_data_files where file_id=35;
FILE_NAME FILE_ID
---------------------------------------------------- ----------
/app/oracle/product/11.2.0/db_1/dbs/UNNAMED00035 35
$ ls -l /app/oracle/product/11.2.0/db_1/dbs/UNNAMED00035
ls: cannot access /app/oracle/product/11.2.0/db_1/dbs/UNNAMED00035: No such file or directory
错误原因是由于在参数db_file_name_convert配置以外的磁盘组FRAJD_DG上创建表空间,路径无法转换导致数据文件无法同步。
解决办法:
备库修改db_file_name_convert参数配置,将新的磁盘组转换添加到参数中。
alter system set db_file_name_convert='+DATA_JD_DG/pgs/datafile/','/data/pgs/datafile/','+DATA_JD_DG/pgs/tempfile/','/data/pgs/tempfile/','+FRAGT_DG/pgs/datafile/','/data/pgs/datafile/','+DATA_GT_DG/pgs/datafile/','/data/pgs/datafile/','+FRAJD_DG/pgs/datafile/','/data/pgs/datafile/' scope=spfile;
重启备库,只能将数据库启动到mount状态:
shutdown immediate
startup mount;
将备库的standby_file_management参数修改为手动管理模式
SQL> alter system set standby_file_management='MANUAL' scope=both;
System altered.
把UNNAMED数据文件放到正确路径
SQL> alter database create datafile '/app/oracle/product/11.2.0/db_1/dbs/UNNAMED00035' as '/data/pgs/datafile/tbs_rpt_data.256.908366191';
Database altered.
将备库的standby_file_management参数修改回自动模式
SQL> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO scope=both;
System altered.
开启实时应用日志同步
SQL> alter database recover managed standby database using current logfile disconnect;
Database altered.
SQL> SELECT PROCESS, STATUS, THREAD#, SEQUENCE#,BLOCK#,BLOCKS,PID FROM V$MANAGED_STANDBY;