轉載eygle的開啟oracle的歸檔模式

jerryhui發表於2009-04-01

如何啟動或關閉資料庫的歸檔(ARCHIVELOG)模式

http://www.eygle.com/archives/2004/10/oracle_howtoeci.html

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引數已經廢除,請參考:Oracle10g已經廢棄log_archive_start引數.

Oracle10g已經廢棄log_archive_start引數

http://www.eygle.com/archives/2005/04/oracle10gonieul.html

Oracle10g中,log_archive_start引數已經被廢棄,只要啟動資料庫的歸檔模式,Oracle就會啟用自動歸檔,從而避免了10g以前由於使用者疏忽所帶來的一系列問題。

$ sqlplus "/ as sysdba"

 

SQL*Plus: Release 10.1.0.3.0 - Production on Wed Apr 13 09:53:25 2005

 

Copyright (c) 1982, 2004, Oracle.  All rights reserved.

 

 

Connected to:

Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - 64bit Production

With the Partitioning and Data Mining options

 

SQL> archive log list;

Database log mode              No Archive Mode

Automatic archival             Disabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     25

Current log sequence           27

SQL> show parameter log_archive_start

 

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

log_archive_start                    boolean     FALSE

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

 

SQL> startup mount;

ORACLE instance started.

 

Total System Global Area 3204448256 bytes

Fixed Size                  1304912 bytes

Variable Size             651957936 bytes

Database Buffers         2550136832 bytes

Redo Buffers                1048576 bytes

Database mounted.

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            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     25

Next log sequence to archive   27

Current log sequence           27

SQL>

 


 

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12035968/viewspace-582750/,如需轉載,請註明出處,否則將追究法律責任。

相關文章