DATAGUARD配置如下:
PROD为主库,SBDB为备库
日志组1-3组为redolog file,4-6组为standby log
在创建standby log后主库关库,使用冷备tar包将数据传输到备库进行的恢复。
DG配置完成之后,启动备库之后,备库alert日志报错如下:
Errors in file /u01/app/oracle/admin/SBDB/udump/sbdb_rfs_14903.trc:
ORA-00313: open failed for members of log group 7 of thread 1
ORA-00312: online log 7 thread 1: '/u01/app/oracle/oradata/PROD/disk2/log4b.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
略。。。。。
看了一下之后发现不太对,备库的路径应该是'/u01/app/oracle/oradata/SBDB才对,怎么会是PROD呢,应该是在备库的参数文件中配置有错误,打开备库参数文件发现果然有错误如下:
LOG_FILE_NAME_CONVERT='SBDB','PROD'
应该是:
LOG_FILE_NAME_CONVERT='PROD','SBDB'
修改之后,关闭数据库,重建了spfile文件,启动数据库,发现备库的alert日志依然有如下错误:
RFS[3]: Assigned to RFS process 15120
RFS[3]: Identified database type as 'physical standby'
RFS[3]: No standby redo logfiles created
RFS[3]: Archived Log: '/home/oracle/arch/SBDB/1_7_831568959.arc'
Mon Mar 17 11:33:28 2014
Redo Shipping Client Connected as PUBLIC
-- Connected User is Valid
RFS[4]: Assigned to RFS process 15122
RFS[4]: Identified database type as 'physical standby'
Primary database is in MAXIMUM PERFORMANCE mode
Primary database is in MAXIMUM PERFORMANCE mode
依然提示没有standby redo logfiles,但我此时数据库中是有'/u01/app/oracle/oradata/PROD/disk2/log4b.log'等等standby log的,查询一下v$standby_log:
SYS@SBDB> select * from v$standby_log;
no rows selected
提示没有standby log,好吧 没办法干掉原来的standby log重建吧:
SYS@SBDB> alter database drop logfile group 4;
alter database drop logfile group 4
*
ERROR at line 1:
ORA-01156: recovery in progress may need access to files
SYS@SBDB> alter database recover managed standby database cancel;
Database altered.
SYS@SBDB> alter database drop logfile group 4;
alter database drop logfile group 4
*
ERROR at line 1:
ORA-00359: logfile group 4 does not exist
提示该日志组也不存在,那就直接从操作系统上删除这些日志组,然后再进行重建。
[oracle@jp2 SBDB]$ cd disk1
[oracle@jp2 disk1]$ ls
control01.ctl log5a.log log7a.log redo02.log sysaux01.dbf temp01.dbf
log4a.log log6a.log redo01.log redo03.log system01.dbf undotbs01.dbf
[oracle@jp2 disk1]$ rm -f *a.log
[oracle@jp2 disk1]$ cd ../disk2
[oracle@jp2 disk2]$ ls
control02.ctl log4b.log log5b.log log6b.log log7b.log
[oracle@jp2 disk2]$ rm -f *b.log
备库上:
SYS@SBDB> alter database add standby logfile group 4
2 ('/u01/app/oracle/oradata/SBDB/disk1/log4a.log','/u01/app/oracle/oradata/SBDB/disk2/log4b.log') size 100m;
Database altered.
SYS@SBDB> alter database add standby logfile group 5 ('/u01/app/oracle/oradata/SBDB/disk1/log5a.log','/u01/app/oracle/oradata/SBDB/disk2/log5b.log') size 100m;
alter database add standby logfile group 6 ('/u01/app/oracle/oradata/SBDB/disk1/log6a.log','/u01/app/oracle/oradata/SBDB/disk2/log6b.log') size 100m;
alter database add standby logfile group 7 ('/u01/app/oracle/oradata/SBDB/disk1/log7a.log','/u01/app/oracle/oradata/SBDB/disk2/log7b.log') size 100m;
Database altered.
SYS@SBDB>
Database altered.
SYS@SBDB>
Database altered.
重建完毕在主库上切换日志:
SYS@PROD>alter system switch logfile;
System altered.
查看备库alert日志,一切正常了,standby log也能找到了
RFS[5]: Successfully opened standby log 4: '/u01/app/oracle/oradata/SBDB/disk1/log4a.log'