Oracle 歸檔模式的打開及關閉

Oracle 歸檔模式的打開關閉


2008-09-06 23:36:17|  分類: Oracle |字號 訂閱
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 modeArchive ModeAutomatic 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 modeNo Archive ModeAutomatic 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
使數據庫啓用自動歸檔,但是重啓後數據庫仍然處於手工歸檔模式。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章