熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Oracle >> 正文

如何啟動或關閉數據庫的歸檔模式

2022-06-13   來源: Oracle 

  Oracle數據庫可以運行在種模式下:歸檔模式(archivelog)和非歸檔模式(noarchivelog)

  歸檔模式可以提高Oracle數據庫的可恢復性生產數據庫都應該運行在此模式下歸檔模式應該和相應的備份策略相結合只有歸檔模式沒有相應的備份策略只會帶來麻煩

  本文簡單介紹如何啟用和關閉數據庫的歸檔模式

  shutdown normal或shutdown immediate關閉數據庫

  [oracle@jumper oracle]$ sqlplus / as sysdba

  SQL*Plus: Release Production on Sat Oct ::

  Copyright (c) Oracle Corporation  All rights reserved

  Connected to:

  Oraclei Enterprise Edition Release Production

  With the Partitioning option

  JServer Release Production

  SQL> shutdown immediate;

  Database closed

  Database dismounted

  ORACLE instance shut down

  啟動數據庫到mount狀態

  SQL> startup mount;

  ORACLE instance started

  Total System Global Area  bytes

  Fixed Size                   bytes

  Variable Size              bytes

  Database Buffers           bytes

  Redo Buffers                 bytes

  Database mounted

  啟用或停止歸檔模式

  如果要啟用歸檔模式此處使用

  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    

  Next log sequence to archive  

  Current log sequence          

  如果需要停止歸檔模式此處使用

  alter database noarchivelog 命令

  SQL> shutdown immediate;

  Database closed

  Database dismounted

  ORACLE instance shut down

  SQL> startup mount;

  ORACLE instance started

  Total System Global Area  bytes

  Fixed Size                   bytes

  Variable Size              bytes

  Database Buffers           bytes

  Redo Buffers                 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    

  Current log sequence          

  修改相應的初始化參數

  Oracleg之前你還需要修改初始化參數使數據庫處於自動歸檔模式

  在pfile/spfile中設置如下參數

  log_archive_start = true

  重啟數據庫此參數生效此時數據庫處於自動歸檔模式

  也可以在數據庫啟動過程中手工執行

  archive log start

  使數據庫啟用自動歸檔但是重啟後數據庫仍然處於手工歸檔模式


From:http://tw.wingwit.com/Article/program/Oracle/201311/17704.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.