Oracle資料庫歸檔模式設定

來源:互聯網
上載者:User

在單擊節點或本機機器上進行設定

  1 sql> archive log list; #查看是否是歸檔方式

  2 sql> alter system set log_archive_start=true scope=spfile; #啟用自動歸檔

  sql> alter system set log_archive_dest_1='location=H:archivelogarch1' scope=spfile;

  #設定歸檔路徑1

  sql> alter system set log_archive_dest_2='location=H:archivelogarch2' scope=spfile;

  #設定歸檔路徑2,一般情況下將路徑2存放到其它盤中。

  sql> alter system set log_archive_format='arch_%d_%t_%r_%s.log'

  #設定歸檔日誌格式

  3 sql> shutdown immediate;

  4 sql> startup mount; #開啟控制檔案,不開啟資料檔案

  5 sql> alter database archivelog; #將資料庫切換為歸檔模式

  6 sql> alter database open; #將資料檔案開啟

  7 sql> archive log list; #查看此時便處于歸檔模式

  8 查詢以確定資料庫位於archivelog模式中且歸檔進程進行中

  sql> select log_mode from v$database;

  sql> select archiver from v$instance;

  9 執行一次日誌切換

  sql> alter system switch logfile;

  10 此次日誌切換將歸檔寫到兩個目的地,即第二步的H:archivelogarch1和H:archivelogarch2,如果希望對此確認,在Oracle環境中運行如下查詢:

  sql> select name from v$archived_log;

  然後在作業系統中確認查詢所列出的檔案

  二 設定非歸檔方式

  1 sql> archive log list; #查看是否是歸檔方式

  2 sql> alter system set log_archive_start=false scope=spfile; #禁用自動歸檔

  3 sql> shutdown immediate;

  4 sql> startup mount; #開啟控制檔案,不開啟資料檔案

  5 sql> alter database noarchivelog; #將資料庫切換為非歸檔模式

  6 sql> alter database open; #將資料檔案開啟

  7 sql> archive log list; #查看此時便處於非歸檔模式

  三 歸檔相關命令

  archive log stop;

  archive log start;

  archive log list;

  show parameters;

  show parameters log_archive_start;

  show parameters log_archive_max_process; #歸檔進程數

  alter system set log_archive_max_process=5; #將歸檔進程數改為5

  select * from v$bgprocess; #查看後台進程

相關文章

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.