ORA-38706: Cannot turn on FLASHBACK DATABASE logging.

來源:互聯網
上載者:User

今天在研究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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.