掃碼下載APP
及時接收最新考試資訊及
備考信息
Oracle數(shù)據(jù)庫可以運行在2種模式:歸檔模式(archivelog)和非歸檔模式(noarchivelog)歸檔模式可以提高Oracle數(shù)據(jù)庫的可恢復性,生產(chǎn)數(shù)據(jù)庫都應該運行在此模式下,歸檔模式應該和相應的備份策略相結合,只有歸檔模式?jīng)]有相應的備份策略只會帶來麻煩。 Oracle數(shù)據(jù)庫可以運行在2種模式:歸檔模式(archivelog)和非歸檔模式(noarchivelog)歸檔模式可以提高Oracle數(shù)據(jù)庫的可恢復性,生產(chǎn)數(shù)據(jù)庫都應該運行在此模式下,歸檔模式應該和相應的備份策略相結合,只有歸檔模式?jīng)]有相應的備份策略只會帶來麻煩。
下面為大家簡單介紹如何啟用和關閉數(shù)據(jù)庫的歸檔模式。
1.shutdown normal或shutdown immediate關閉數(shù)據(jù)庫
[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.啟動數(shù)據(jù)庫到mount狀態(tài)
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.修改相應的初始化參數(shù)
Oracle10g之前,你還需要修改初始化參數(shù)使數(shù)據(jù)庫處于自動歸檔模式。
在pfile/spfile中設置如下參數(shù):
log_archive_start = true
重啟數(shù)據(jù)庫此參數(shù)生效,此時數(shù)據(jù)庫處于自動歸檔模式。
也可以在數(shù)據(jù)庫啟動過程中,手工執(zhí)行:
archive log start
使數(shù)據(jù)庫啟用自動歸檔,但是重啟后數(shù)據(jù)庫仍然處于手工歸檔模式。
Copyright © 2000 - odtgfuq.cn All Rights Reserved. 北京正保會計科技有限公司 版權所有
京B2-20200959 京ICP備20012371號-7 出版物經(jīng)營許可證 京公網(wǎng)安備 11010802044457號