案例
环境:2节点RAC asm + 单实例DG备库 ,备库用的是文件系统来存放数据文件,未用ASM;RAC一节点上部署有ogg。
在主库上通过在线重定义对表做分区,创建分区表空间时备库上创建数据文件失败,
导致日志传到备库无法应用,备库停止日志应用。
rman备份清理归档的脚本无法及时清理归档导到主库、备库归档磁盘空间均出现满的现象,ogg进程不工作,进程正常,只是time since chkpt 持续升高。
清理了归档后,备库可以接收日志但不应用。查看DG switchover_status 为unresolvable gap 。下面进行备库的恢复。
备库中的alert日志信息如下:
Managed Standby Recovery starting Real Time Apply
Tue Apr 07 08:39:57 2015
Errors in file /u01/app/oracle/diag/rdbms/centerdg/center/trace/center_dbw0_4645.trc:
ORA-01186: file 63 failed verification tests
ORA-01157: cannot identify/lock data file 63 - see DBWR trace file
ORA-01111: name for data file 63 is unknown - rename to correct file
ORA-01110: data file 63: '/u01/app/oracle/product/11.2.0/db_1/dbs/UNNAMED00063'
File 63 not verified due to error ORA-01157
Errors in file /u01/app/oracle/diag/rdbms/centerdg/center/trace/center_dbw0_4645.trc:
ORA-01186: file 201 failed verification tests
ORA-01157: cannot identify/lock data file 201 - see DBWR trace file
ORA-01110: data file 201: '+DATA'
File 201 not verified due to error ORA-01157
MRP0: Background Media Recovery terminated with error 1111
Errors in file /u01/app/oracle/diag/rdbms/centerdg/center/trace/center_pr00_5770.trc:
ORA-01111: name for data file 63 is unknown - rename to correct file
ORA-01110: data file 63: '/u01/app/oracle/product/11.2.0/db_1/dbs/UNNAMED00063'
ORA-01157: cannot identify/lock data file 63 - see DBWR trace file
ORA-01111: name for data file 63 is unknown - rename to correct file
ORA-01110: data file 63: '/u01/app/oracle/product/11.2.0/db_1/dbs/UNNAMED00063'
Managed Standby Recovery not using Real Time Apply
Slave exiting with ORA-1111 exception
处理思路:
1.停ogg
2.置分区表空间cdtbs_par2-10 ,idxtbs_2-10 readonly [表空间来源于下面的查询create_change#>备库当前SCN号,其中备库的cdtbs_par1也没有,但未查出来].
3.拷贝分区表空间对应的数据文件。
4.增备,做恢复。
具体操作:
1.置表空间为read only:
--在此之前先查出备库scn号。
select current_scn from v$database;
10329528031425
--主库上查询
select 'alter tablespace '||b.name||' read only;' from v$datafile a,
v$tablespace b
where a.CREATION_CHANGE#> =10329528031425
and a.TS#=b.TS#;
alter tablespace CDTBS_PAR2 read only;
alter tablespace CDTBS_PAR3 read only;
alter tablespace CDTBS_PAR4 read only;
alter tablespace CDTBS_PAR5 read only;
alter tablespace CDTBS_PAR6 read only;
alter tablespace CDTBS_PAR7 read only;
alter tablespace CDTBS_PAR8 read only;
alter tablespace CDTBS_PAR9 read only;
alter tablespace CDTBS_PAR10 read only;
alter tablespace IDXTBS_2 read only;
alter tablespace IDXTBS_3 read only;
alter tablespace IDXTBS_4 read only;
alter tablespace IDXTBS_5 read only;
alter tablespace IDXTBS_6 read only;
alter tablespace IDXTBS_7 read only;
alter tablespace IDXTBS_8 read only;
alter tablespace IDXTBS_9 read only;
alter tablespace IDXTBS_10 read only;
--因为发现备库上是没有cdtbs_par1表空间对应的数据文件,处理方法如上,先read only后静态拷贝到备库。
alter tablespace CDTBS_PAR1 read only;
2.拷贝文件到备库上。
先从ASM上拷贝到本地文件系统上:
cp CDTBS_PAR1.345.875609233 /home/grid
cp CDTBS_PAR2.346.875609279 /home/grid/arch
cp CDTBS_PAR3.347.875609293 /home/grid/arch
cp CDTBS_PAR4.348.875609307 /home/grid/arch
cp CDTBS_PAR5.349.875609319 /home/grid/arch
cp CDTBS_PAR6.350.875609333 /home/grid/arch
cp CDTBS_PAR7.351.875609345 /home/grid/arch
cp CDTBS_PAR8.352.875609359 /home/grid/arch
cp CDTBS_PAR9.353.875609371 /home/grid/arch
cp CDTBS_PAR10.354.875609385 /home/grid/arch
cp IDXTBS_10.363.875609811 /home/grid/arch
cp IDXTBS_2.355.875609535 /home/grid/arch
cp IDXTBS_3.356.875609679 /home/grid/arch
cp IDXTBS_4.357.875609687 /home/grid/arch
cp IDXTBS_5.358.875609693 /home/grid/arch
cp IDXTBS_6.359.875609699 /home/grid/arch
cp IDXTBS_7.360.875609707 /home/grid/arch
cp IDXTBS_8.361.875609713 /home/grid/arch
cp IDXTBS_9.362.875609719 /home/grid/arch
grid用户直接scp 拷贝,例句:
scp CDTBS_PAR10.354.875609385 oracle@host:/datadg/center/datafile
scp CDTBS_PAR[3,4,5,6]* oracle@host:/datadg/center/datafile
--多个同时拷贝,批考例句:
scp IDXTBS_[2,3,4]* oracle@host:/datadg/center/datafile
scp IDXTBS_[5,6,7,8,9]* oracle@host:/datadg/center/datafile
PS:拷贝后发现文件权限是对的,但是在备库上文件名全部转换成了小写,为了避免linux系统文件名大小写敏感,将文件名重命名为小写,但未验证大写的文件名是否有影响。
3.主库基于备库的SCN号做增备备份
--分配多通道加快速度,恢复时未用多通道耗时较长。
主库上做增备:
rman target /
run{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
BACKUP INCREMENTAL FROM SCN 10329528031425 DATABASE FORMAT '/home/oracle/upstd_%U_%p' tag 'upstd';
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}
backup current controlfile for standby format '/home/oracle/upstdctl_%U';
4.备库上操作,清理有问题的数据文件:
alter system set standby_file_management=manual;
alter database create datafile
'/u01/app/oracle/product/11.2.0/db_1/dbs/UNNAMED00063' as '/datadg/center/datafile/cdtbs_par1.345.875609233';
alter database datafile '/datadg/center/datafile/cdtbs_par1.345.875609233' offline drop;
--alter database datafile '/u01/app/oracle/product/11.2.0/db_1/dbs/UNNAMED00063' offline drop; 用此句应该等效上面2句,未验证。
--然后静态read only将对应的数据文件拷贝过来
alter system set standby_file_management=auto;
5.备库上恢复
rman target /
catalog start with '/home/oracle/dgbak';
recover database noredo;
shutdown immediate;
STARTUP NOMOUNT;
RESTORE STANDBY CONTROLFILE FROM '/home/oracle/dgbak/upstdctl_9uq3rv22_1_1';
alter database mount;
RMAN> alter database open;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 04/08/2015 16:32:47
ORA-10458: standby database requires recovery
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/datadg/center/datafile/system.260.797342827'
继续备库上操作:
SQL> set num 50
SQL> select current_scn from v$database;
此处先应用 日志
SQL>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
SQL> select file#,status,name from v$datafile;
SQL>select * from v$dataguard_status;
ARC4: Beginning to archive thread 1 sequence 171370 (10331448528074-10331448899608)
SQL>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE cancel;
SQL>alter database open read only;
SQL>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE using current logfile DISCONNECT FROM SESSION;
附加后续DG相关信息
备库应用日志及打开到read only状态时alert中的一些信息:
备库上一些操作alert日志中的提示信息,虽然显示的是报错,但其实可以不用管,只是一个信息提示。
mount状态 取消日志应用报错ORA 16037:
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL
MRP0: Background Media Recovery cancelled with status 16037
Errors in file /u01/app/oracle/diag/rdbms/centerdg/center/trace/center_pr00_6282.trc:
ORA-16037: user requested cancel of managed recovery operation
Thu Apr 09 08:32:09 2015
Recovery interrupted!
Recovered data files to a consistent state at change 10331906716894
Thu Apr 09 08:32:10 2015
MRP0: Background Media Recovery process shutdown (center)
Thu Apr 09 08:32:10 2015
Managed Standby Recovery Canceled (center)
Completed: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL
Thu Apr 09 08:32:38 2015
将备库打开提示临时表空间数据文件无法锁定,可忽略,临时表空间会自动处理:
Data Guard Broker initializing...
Data Guard Broker initialization complete
Thu Apr 09 08:32:41 2015
SMON: enabling cache recovery
Dictionary check beginning
Thu Apr 09 08:32:46 2015
RFS[6]: Selected log 26 for thread 2 sequence 189031 dbid -68775212 branch 797342936
Thu Apr 09 08:32:53 2015
Errors in file /u01/app/oracle/diag/rdbms/centerdg/center/trace/center_dbw0_4855.trc:
ORA-01157: cannot identify/lock data file 201 - see DBWR trace file
ORA-01110: data file 201: '+DATA/center/tempfile/temp.264.797342939'
ORA-17503: ksfdopn:2 Failed to open file +DATA/center/tempfile/temp.264.797342939
ORA-15001: diskgroup "DATA" does not exist or is not mounted
ORA-15077: could not locate ASM instance serving a required diskgroup
ORA-29701: unable to connect to Cluster Synchronization Service
Errors in file /u01/app/oracle/diag/rdbms/centerdg/center/trace/center_dbw0_4855.trc:
ORA-01186: file 201 failed verification tests
ORA-01157: cannot identify/lock data file 201 - see DBWR trace file
ORA-01110: data file 201: '+DATA/center/tempfile/temp.264.797342939'
File 201 not verified due to error ORA-01157
Thu Apr 09 08:32:53 2015
Dictionary check complete
Cannot re-create tempfile +DATA/center/tempfile/temp.264.797342939, the same name file exists
Errors in file /u01/app/oracle/diag/rdbms/centerdg/center/trace/center_dbw0_4855.trc:
ORA-01157: cannot identify/lock data file 201 - see DBWR trace file
ORA-01110: data file 201: '+DATA/center/tempfile/temp.264.797342939'
ORA-17503: ksfdopn:2 Failed to open file +DATA/center/tempfile/temp.264.797342939
ORA-15001: diskgroup "DATA" does not exist or is not mounted
ORA-15077: could not locate ASM instance serving a required diskgroup
ORA-29701: unable to connect to Cluster Synchronization Service
Database Characterset is ZHS16GBK
No Resource Manager plan active
replication_dependency_tracking turned off (no async multimaster replication found)
Thu Apr 09 08:32:55 2015
Archived Log entry 485 added for thread 2 sequence 189030 ID 0xfd3d5b54 dest 1:
Physical standby database opened for read only access.
Completed: alter database open read only
到此备库已恢复成功。
在此附上惜纷飞的基于Data Guard出现gap sequence修复的案例,只是其中无创建数据文件。
http://www.xifenfei.com/1176.html