Oracle歸檔模式的定義以及修改方法

來源:互聯網
上載者:User

一、意義:

我們知道資料庫有至少兩組線上記錄檔,這些記錄檔是迴圈使用的。
歸檔模式就是當線上記錄檔被迴圈重用(覆蓋)之前儲存一份副本檔案到其他位置,這樣我們就保留了曆史上對資料庫的所有修改日誌記錄,對資料庫恢複很有意義。

二、修改歸檔模式

首先查看資料庫現有模式可使用以下語句
select name,log_mode from v$database;
也可以用下面的語句
archive log list;(該方法需要as sysdba)

對於非歸檔模式的資料庫該為歸檔模式(主要以Oracle 10g為參考)使用以下步驟:
1. SQL> alter system set log_archive_dest_1=’location=/oracle/oracle10g/log/archive_log’;
該語句含義是確定歸檔日誌的路徑,實際上Oracle 10g可以產生多份一樣的日誌,儲存多個位置,以防不測

例如再添加一個日誌位置可使用以下語句
SQL>alter system set log_archive_dest_2=’location=/oracle/oracle10g/log2/archive_log’;

2.關閉資料庫
SQL> shutdown immediate

3.啟動資料mount狀態:
SQL> startup mount;

4、修改資料庫為歸檔模式:
SQL> alter database archivelog;

5、開啟資料庫,查詢:
SQL> alter database open;

修改記錄檔命名格式:
SQL> alter system set log_archive_max_processes = 5;
SQL> alter system set log_archive_format = "archive_%t_%s_%r.log" scope=spfile;

修改完成後可以查看記錄模式是否修改成功!

特別指出的是在Oracle 9i中還要修改參數log_archive_start = true才會生效,oracle 10g中已經廢除了該參數,所以不需要設定該參數。
————————————————————————————————
SQL> SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area 1258291200 bytes
Fixed Size 1978336 bytes
Variable Size 318771232 bytes
Database Buffers 922746880 bytes
Redo Buffers 14794752 bytes
Database mounted.
SQL> alter database archivelog;

Database altered.

SQL> alter database open;

Database altered.

聯繫我們

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