ORA-38760: Thisdatabase instance failed to turn on flashback database
背景
数据库的Flashback是打开的,测试冷备和恢复。
SQL> select * from v$version;
BANNER
-------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
SQL> select flashback_on from v$database;
FLASHBACK_ON
------------------
YES
测试过程
## 备份脚本: ##
#!/bin/bash
sqlplus / as sysdba <<EOF
shutdown immediate;
ho cp /u01/app/oracle/oradata/orcl/control01.ctl /rmp/backup/controlfile/contril01.ctl
ho cp /u01/app/oracle/fast_recovery_area/orcl/control02.ctl /rmp/backup/controlfile/control02.ctl
ho cp /u01/app/oracle/oradata/orcl/*.dbf /rmp/backup/datafile/
ho cp /u01/app/oracle/oradata/orcl/*.log /rmp/backup/logfile/
startup;
exit;
EOF;
## 恢复: ##
将备份后的文件restore到相应的目录下,打开数据库,出现错误。
错误信息
## alert.log ##
Allocated 15937344bytesin shared pool for flashback generation buffer
Starting background process RVWR
Tue Jan 0515:56:452016
RVWR started with pid=20, OS id=6507
Errors infile /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_rvwr_6507.trc:
ORA-38739: Flashback logfile is more recent than control file.
ORA-38701: Flashback database log2 seq 2 thread 1: "/u01/app/oracle/fast_recovery_area/ORCL/flashback/o1_mf_c8mwpz5j_.flb"
Database mounted in Exclusive Mode
Lost write protection disabled
Completed: alter database mount
Tue Jan 0515:56:522016
alter database open
Errors infile /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_6472.trc:
ORA-38760: This database instance failed to turn onflashbackdatabase
ORA-38760 signalled during: alter database open...
## trace log ##
Trace file /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_rvwr_6507.trc
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1
System name: Linux
Node name: orcl01
Release: 2.6.32-358.el6.x86_64
Version: #1 SMP Fri Feb 22 00:31:26 UTC 2013
Machine: x86_64
Instance name: orcl
Redo thread mounted by this instance: 1
Oracle process number: 20
Unix process pid: 6507, image: oracle@orcl01 (RVWR)
*** 2016-01-0515:56:45.248
*** SESSION ID:(5.3) 2016-01-0515:56:45.248
*** CLIENT ID:() 2016-01-0515:56:45.248
*** SERVICE NAME:() 2016-01-0515:56:45.248
*** MODULE NAME:() 2016-01-0515:56:45.248
*** ACTION NAME:() 2016-01-0515:56:45.248
ORA-38739: Flashback logfileis more recent than control file.
ORA-38701: Flashback database log2 seq 2 thread 1: "/u01/app/oracle/fast_recovery_area/ORCL/flashback/o1_mf_c8mwpz5j_.flb"
原因
[oracle@orcl01 ~]$ oerr ora 38760
38760, 00000, "This database instance failed to turn on flashback database"
// *Cause: Database flashback is on but this instance failed to
// start generating flashback data. Look in alert log for more
// specific errors.
// *Action: Correct the error or turn off database flashback.
[oracle@orcl01 ~]$ oerr ora 3873938739, 00000, "Flashback log file is more recent than control file."
// *Cause: The control file change sequence numberin the flashback
// database log file was greater than the numberin the
// control file. This implies that the wrong control file
// was being used. Note that repeatedly causing this error
// can make it stop happening without correcting the real
// problem. Every attempt toopen the database will advance the
// control file change sequence number until it is great enough.
// *Action: FLASHBACK DATABASE can only be used with the current
// control file. If it isnot available, then a restore
// and an incomplete recovery must be performed instead.
[oracle@orcl01 ~]$ oerr ora 3870138701, 00000, "Flashback database log %s seq %s thread %s: \"%s\""
// *Cause: This message reports the filename for details of another message.
// *Action: Other messages will accompany this message. See the associated
// messages for the appropriate actionto take.
解决办法
SQL> alter database flashback off;
Database altered.
SQL> alter database open;
Database altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 1603411968bytes
Fixed Size 2228784bytesVariable Size 973082064bytes
Database Buffers 620756992bytes
Redo Buffers 7344128bytes
Database mounted.
SQL> alter database flashback on;
Database altered.
SQL> alter database open;
Database altered.