ORA-38706: Cannot turn on FLASHBACK DATABASE logging.

来源:互联网 发布:哪里招淘宝主播 编辑:程序博客网 时间:2024/05/29 14:45

今天在研究flashback的时候碰到了个小问题,无法开启flashback功能,报错:ORA-38706和ORA-38714

步骤如下:

SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            use_recovery_file_dest
Oldest online log sequence     7
Next log sequence to archive   9
Current log sequence           9


SQL> select log_mode,flashback_on from v$database;


LOG_MODE     FLASHBACK_ON
------------ ------------------
ARCHIVELOG   NO


如果没有开启归档,必须在mount状态下执行:

SQL> alter database archivelog;

否则是无法开启flashback的,因为闪回需要归档


SQL> select open_mode from v$database;



OPEN_MODE
----------
MOUNTED


SQL> alter database flashback on;
alter database flashback on
*
ERROR at line 1:
ORA-38706: Cannot turn on FLASHBACK DATABASE logging.
ORA-38714: Instance recovery required.


在网上google了一下,没找到什么有用的信息,别人出现这个情况是因为归档没有开启,但是我已经开启归档了

查看alert.log文件,也没什么信息,只报了一条:

Wed Aug 21 00:15:20 2013
alter database flashback on
ORA-38706 signalled during: alter database flashback on...


根据提示,理解为需要recover database

SQL> recover database;
Media recovery complete.
SQL> alter database flashback on;
alter database flashback on
*
ERROR at line 1:
ORA-38706: Cannot turn on FLASHBACK DATABASE logging.
ORA-38714: Instance recovery required.

仍然不行,于是从错误代码编号着手,看看有什么有价值的信息

[oracle@RHEL5U3 ~]$ oerr ora 38706
38706, 00000, "Cannot turn on FLASHBACK DATABASE logging."
// *Cause:  An ALTER DATABASE FLASHBACK ON command failed.
//          Other messages in the alert log describe the problem.
// *Action: Fix the problem and retry.


这个等于没说,alert.log里没有什么内容


[oracle@RHEL5U3 ~]$ oerr ora 38714
38714, 00000, "Instance recovery required."
// *Cause:  An ALTER DATABASE FLASHBACK ON command failed because the 
//          database either crashed or was shutdown with the ABORT
//          option.
// *Action: Open the database and then enter the SHUTDOWN command with the
//          NORMAL or IMMEDIATE option.


哇,亮点来了,看到没有,cause里写得很清楚,由于数据库crash或shutdown abort

action也写明了解决方法,只要open以后,再正常关闭数据库就行了,多简单


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  285212672 bytes
Fixed Size                  1218992 bytes
Variable Size              67110480 bytes
Database Buffers          213909504 bytes
Redo Buffers                2973696 bytes
Database mounted.
SQL> alter database flashback on;


Database altered.


flashback开启成功,验证一下:

SQL> select log_mode,flashback_on from v$database;


LOG_MODE     FLASHBACK_ON
------------ ------------------
ARCHIVELOG   YES


总结:出现错误要根据错误提示去一步步解决问题,首先当然是查看alert.log,看是否存在有价值的提示,如果没有,那么就要从ORA-xxxxx 错误本身来查找问题了,如果google不到好的解决方案也不要气馁,我们还有oracle提供的oerr命令,非常之好用,有时候使用它会给你带来意外惊喜哦


-------------------------------------------------------------------------------------------------------
By aaron8219 Chinaunix Blog:http://blog.chinaunix.net/uid/24612962.html

原创内容,转载请注明链接,谢谢!

http://blog.csdn.net/aaron8219/article/details/10129503

原创粉丝点击