alter system switch logfile和alter system archive log current的區別

來源:互聯網
上載者:User

alter system switch logfile 是強制日誌切換,不一定就歸檔當前的重做記錄檔(若自動歸檔開啟,就歸檔前的重做日誌,若自動歸檔沒有開啟,就不歸檔當前重做日誌。)
alter system archive log current 是歸檔當前的重做記錄檔,不管自動歸檔有沒有打都歸檔。
主要的區別在於:
ALTER SYSTEM SWITCH LOGFILE對單一實例資料庫或RAC中的當前執行個體執行日誌切換;
而ALTER SYSTEM ARCHIVE LOG CURRENT會對資料庫中的所有執行個體執行日誌切換。

為什麼執行熱備後要執行alter system archive log current 這個語句,看到很多指令碼都是這樣寫的。
是不是必須的。

一般的RMAN指令碼都是這樣寫的,因為RMAN是可以備份歸檔日誌的。alter system archive log current 這樣後就可以將所有的歸檔都備份出來了。這樣做是為了保證資料的完整和一致。

ALTER SYSTEM SWITCH LOGFILE ;
SWITCH LOGFILE Clause
The SWITCH LOGFILE clause lets you explicitly force Oracle to begin writing to a new redo log file group, regardless of whether the files in the current redo log file group are full. When you force a log switch, Oracle begins to perform a checkpoint but returns control to you immediately rather than when the checkpoint is complete. To use this clause, your instance must have the database open.

ALTER SYSTEM ARCHIVE LOG CURRENT ;
CURRENT Clause
Specify CURRENT to manually archive the current redo log file group of the specified thread(instance), forcing a log switch. If you omit the THREAD parameter, then Oracle archives all redo log file groups from all enabled threads(instances), including logs previous to current logs. You can specify CURRENT only when the database is open.

ALTER SYSTEM ARCHIVE LOG CURRENT NOSWITCH;
NOSWITCH
Specify NOSWITCH if you want to manually archive the current redo log file group without forcing a log switch. This setting is used primarily with standby databases to prevent data divergence when the primary database shuts down. Divergence implies the possibility of data loss in case of primary database failure.

You can use the NOSWITCH clause only when your instance has the database mounted but not open. If the database is open, then this operation closes the database automatically. You must then manually shut down the database before you can reopen it.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.