DB_RECOVERY_FILE_DEST參數是默認的flash
recovery area的路徑,里面存放有歸檔日志、閃回日志以及rman的備份文件等文件。
LOG_ARCHIVE_DEST_n參數是存放歸檔日志的路徑,n表示1~10的一個整數,由于歸檔日志在recovery的時候擔當了重要的角色,所以我們可以設置多個歸檔目錄(最多可以設置10個)。這種情況下,聯機日志在歸檔時,會在不同的目錄下都會生成有一個相同的歸檔文件,通過冗余的來保證歸檔日志的安全。
系統默認的情況是以DB_RECOVERY_FILE_DEST定義的目錄來存放歸檔日志。但是,課上演示的時候,老師已經設置了log_archive_dest_1、log_archive_dest_2和log_archive_dest_3,三個參數。我現在將這三個參數修改回去,讓系統使用默認的DB_RECOVERY_FILE_DEST目錄來存放歸檔日志。
經過下面的操作,發現提示找不到歸檔的目錄。
SQL> alter system set log_archive_dest_1='';
SQL> alter system set log_archive_dest_2='';
SQL> alter system set log_archive_dest_3='';
SQL> alter system archive log current;
alter system archive log current
*
ERROR at line 1:
ORA-16014: log 2 sequence# 50 not archived, no
available destinations
ORA-00312: online log 2 thread 1:
'/opt/ora10g/oradata/orcl/redo02.log'
SQL> archive log list;
Database log modeArchive Mode
Automatic archivalEnabled
Archive destination?/dbs/arch
Oldest online log sequence49
Next log sequence to archive50
Current log sequence51
解決辦法,我們暫時先指定一個目錄來存放歸檔日志。然后再修改三個log_archive_dest_n的系統參數時,指定好scope為spfile,重啟實例即可。
SQL> alter system set log_archive_dest_1='location=/logs/log_1';
SQL> alter system archive log current;
System altered.
SQL> alter system set log_archive_dest_1='' scope=spfile;
SQL> alter system set log_archive_dest_2='' scope=spfile;
SQL> alter system set log_archive_dest_3='' scope=spfile;
SQL> startup force
ORACLE instance started.
Total System Global Area285212672 bytes
Fixed Size1218992 bytes
Variable Size104859216 bytes
Database Buffers176160768 bytes
Redo Buffers2973696 bytes
Database mounted.
Database opened.
查看一下現在使用的歸檔的目錄,已經成功改回為了DB_RECOVERY_FILE_DEST。
SQL> archive log list;
Database log modeArchive Mode
Automatic archivalEnabled
Archive destinationUSE_DB_RECOVERY_FILE_DEST
Oldest online log sequence51
Next log sequence to archive53
Current log sequence53
最后再查看一下log_archive_dest_n參數,這些參數都沒有被設置了,均為空:
SQL> show parameter log_archive_dest
NAMETYPEVALUE
------------------------------------ -----------
------------------------------
log_archive_deststring
log_archive_dest_1string
log_archive_dest_10string
log_archive_dest_2string
log_archive_dest_3string
log_archive_dest_4string
log_archive_dest_5string
log_archive_dest_6string
log_archive_dest_7string
log_archive_dest_8string
log_archive_dest_9string
小結:log_archive_dest_n與DB_RECOVERY_FILE_DEST參數都可以用來存放歸檔日志,但二者的關系是:不設置log_archive_dest_n時,使用DB_RECOVERY_FILE_DEST來存文件;當設置了log_archive_dest_n時,則使用log_archive_dest_n來存放歸檔日志。
下面我們,再對log_archive_dest_n進行設置,讓DB_RECOVERY_FILE_DEST“失效”。
SQL>alter
system set log_archive_dest_1='location=/logs/log_1' scope=spfile;
SQL>alter
system set log_archive_dest_2='location=/logs/log_2' scope=spfile;
SQL>alter
system set log_archive_dest_3='location=/logs/log_3' scope=spfile;
SQL>
startup force
ORACLE instance
started.
Total System
Global Area 285212672 bytes
Fixed Size1218992 bytes
Variable
Size109053520 bytes
Database
Buffers171966464 bytes
Redo
Buffers2973696 bytes
Database
mounted.
Database opened.
我們進行下手動歸檔
SQL>
alter system archive log current;
查看下系統時間,發現三個目錄下,都已經有了最新的歸檔日志:
[root@localhost
logs]$ date
Wed Sep1 10:48:39 CST 2010
[root@localhost
logs]# ll -t log_1
-rw-r----- 1
oracle oinstall280576 Sep1 10:48 1_54_723037014.dbf
[root@localhost
logs]# ll -t log_2
-rw-r----- 1
oracle oinstall280576 Sep1 10:48 1_54_723037014.dbf
[root@localhost
logs]# ll -t log_3
-rw-r----- 1
oracle oinstall280576 Sep1 10:48 1_54_723037014.dbf
而DB_RECOVERY_FILE_DEST目錄下,已經不再會存放新的歸檔日志了:
[oracle@localhost
archivelog]$ ll 2010_09_01/
-rw-r----- 1
oracle oinstall 20992 Sep1 10:07
o1_mf_1_52_67vfc7q5_.arc