Oracle 設定歸檔與非歸檔模式

來源:互聯網
上載者:User

-,查看Oracle歸檔模式
SQL> conn evan/evan  (dba)
Connected.
SQL> archive log list
ORA-01031: insufficient privileges

SQL> conn / as sysdba --archive log list需要以sysdba執行
Connected.
SQL> archive log list
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     2
Current log sequence           4
查詢v$database
SQL> select name,log_mode from v$database;

NAME      LOG_MODE
--------- ------------
ORALIFE   NOARCHIVELOG

二,修改歸檔模式
歸檔日誌位置,Oracle 10g可以產生多份一樣的日誌,儲存多個位置,以防不測
SQL> alter system set log_archive_dest_1='location=/oracle/10g/oracle/log/archive_log';

System altered.

SQL> alter system set log_archive_dest_2='location=/oracle/10g/oracle/log/archive_log2';

System altered.

SQL> shutdown immediate
ORA-01031: insufficient privileges
SQL> conn / as sysdba
Connected.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area  528482304 bytes
Fixed Size                  1220360 bytes
Variable Size             163578104 bytes
Database Buffers          356515840 bytes
Redo Buffers                7168000 bytes
Database mounted.
SQL> alter database archivelog; --設定歸檔模式

Database altered.

SQL> alter database open;

Database altered.

配置歸檔檔案格式(從oracle 10g 開始,必須帶有%s,%t,%r)
SQL> alter system set log_archive_format="archive_%t_%s_%r.arclog" scope=spfile;

System altered.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area  528482304 bytes
Fixed Size                  1220360 bytes
Variable Size             163578104 bytes
Database Buffers          356515840 bytes
Redo Buffers                7168000 bytes
Database mounted.
SQL> archive log list  --查看是否歸檔
Database log mode              Archive Mode
Automatic archival             Enabled          --已開啟自動歸檔
Archive destination            /oracle/10g/oracle/log/archive_log2
Oldest online log sequence     2
Next log sequence to archive   4
Current log sequence           4

SQL> select destination from v$archive_dest;  --查看歸檔日誌位置

DESTINATION
--------------------------------------------------------------------------------
/oracle/10g/oracle/log/archive_log
/oracle/10g/oracle/log/archive_log2

10 rows selected.

還可以配置歸檔進程個數
alter system set log_archive_max_processes=n

  • 1
  • 2
  • 下一頁

聯繫我們

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