啟動/關閉資料庫歸檔(ARCHIVELOG)模式

來源:互聯網
上載者:User

 

  Oracle資料庫可以運行在2種模式下:歸檔模式(archivelog)和非歸檔模式(noarchivelog)
  
  歸檔模式可以提高Oracle資料庫的可恢複性,生產資料庫都應該運行在此模式下,歸檔模式應該和相應的備份策略相結合,只有歸檔模式沒有相應的備份策略只會帶來麻煩。
  
  本文簡單介紹如何啟用和關閉資料庫的歸檔模式。
  
  1.shutdown normal或shutdown immediate關閉資料庫
  
  [oracle@jumper oracle]$ sqlplus "/ as sysdba"
  
  SQL*Plus: Release 9.2.0.4.0 - Production on Sat Oct 15 15:48:36 2005
  
  Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
  
  Connected to:
  Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
  With the Partitioning option
  JServer Release 9.2.0.4.0 - Production
  
  SQL> shutdown immediate;
  Database closed.
  Database dismounted.
  ORACLE instance shut down.
  
  2.啟動資料庫到mount狀態
  
  SQL> startup mount;
  ORACLE instance started.
  
  Total System Global Area 101782828 bytes
  Fixed Size          451884 bytes
  Variable Size       37748736 bytes
  Database Buffers      62914560 bytes
  Redo Buffers         667648 bytes
  Database mounted.
  
  3.啟用或停止歸檔模式
  
  如果要啟用歸檔模式,此處使用
  
  alter database archivelog 命令。
  SQL> alter database archivelog;
  Database altered.
  
  SQL> alter database open;
  
  Database altered.
  
  SQL> archive log list;
  Database log mode       Archive Mode
  Automatic archival       Enabled
  Archive destination      /opt/oracle/oradata/conner/archive
  Oldest online log sequence   148
  Next log sequence to archive  151
  Current log sequence      151
  
  如果需要停止歸檔模式,此處使用:
  
  alter database noarchivelog 命令。
  SQL> shutdown immediate;
  Database closed.
  Database dismounted.
  ORACLE instance shut down.
  SQL> startup mount;
  ORACLE instance started.
  
  Total System Global Area 101782828 bytes
  Fixed Size          451884 bytes
  Variable Size       37748736 bytes
  Database Buffers      62914560 bytes
  Redo Buffers         667648 bytes
  Database mounted.
  SQL> alter database noarchivelog;
  
  Database altered.
  
  SQL> alter database open;
  
  Database altered.
  
  SQL> archive log list;
  Database log mode       No Archive Mode
  Automatic archival       Enabled
  Archive destination      /opt/oracle/oradata/conner/archive
  Oldest online log sequence   149
  Current log sequence      152
  
  4.修改相應的初始化參數
  
  Oracle10g之前,你還需要修改初始化參數使資料庫處於自動歸檔模式。
  
  在pfile/spfile中設定如下參數:
  
  log_archive_start = true
  
  重啟資料庫此參數生效,此時資料庫處於自動歸檔模式。
  
  也可以在資料庫啟動過程中,手工執行:
  
  archive log start
  
  使資料庫啟用自動歸檔,但是重啟後資料庫仍然處於手工歸檔模式。
  
  從Oracle10g開始,log_archive_start參數已經廢除

 

聯繫我們

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