-,查看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