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'