今天把一个新上线的数据库改为了归档模式,顺便修改了一下归档文件存放路径,开始配置的log_archive_dest,后来发现在闪回区同样还会有一份共两份,后来重新配置log_archive_dest_1变成了一份,下面请仔细看我的操作过程
sqlplus / as sysdba
sql>alter system set log_archivelog_dest=’/backup/archivedlog/’ scope=spfile;
sql>shutdown immediate
sql>startup mount
sql>alter database archivelog
sql>alter database open;
————————–
note: 不可以直接startup mount force,如果有数据需要recover
—————————
sql>alter system switch logfile;
sql>alter system switch logfile;
–强制两次切换日志归档
用rman 查看归档日志
RMAN> list archivelog all; using target database control file instead of recovery catalog List of Archived Log Copies Key Thrd Seq S Low Time Name ------- ---- ------- - ------------------- ---- 1 1 13 A 2011-05-18 09:26:05 /backup/archivedlog/1_13_751026649.dbf 2 1 13 A 2011-05-18 09:26:05 /oracle/flash_recovery_area/AHJCYL/archivelog/2011_05_18/o1_mf_1_13_6x68b3yp_.arc 3 1 14 A 2011-05-18 09:30:43 /backup/archivedlog/1_14_751026649.dbf 4 1 14 A 2011-05-18 09:30:43 /oracle/flash_recovery_area/AHJCYL/archivelog/2011_05_18/o1_mf_1_14_6x68b5lj_.arc
—在log_archive_dest一份同时闪回区又一份
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 13
Next log sequence to archive 15
Current log sequence 15
SQL> alter system reset log_archive_dest scope=spfile sid=’*';
System altered.
SQL> alter system set log_archive_dest_1=’/backup/archivedlog/’ scope=spfile;
alter system set log_archive_dest_1=’/backup/archivedlog/’ scope=spfile
*
ERROR at line 1:
ORA-32017: failure in updating SPFILE
ORA-16179: incremental changes to “log_archive_dest_1″ not allowed with SPFILE
SQL> alter system set log_archive_dest_1=’LOCATION=/backup/archivedlog/’ scope=spfile;
System altered.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 4412407808 bytes
Fixed Size 2089696 bytes
Variable Size 1493175584 bytes
Database Buffers 2902458368 bytes
Redo Buffers 14684160 bytes
Database mounted.
Database opened.
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /backup/archivedlog/
Oldest online log sequence 13
Next log sequence to archive 15
Current log sequence 15
SQL> alter system switch logfile
SQL> alter system switch logfile
RMAN> list archivelog all;
using target database control file instead of recovery catalog
List of Archived Log Copies
Key Thrd Seq S Low Time Name
------- ---- ------- - ------------------- ----
1 1 13 A 2011-05-18 09:26:05 /backup/archivedlog/1_13_751026649.dbf
2 1 13 A 2011-05-18 09:26:05 /oracle/flash_recovery_area/AHJCYL/archivelog/2011_05_18/o1_mf_1_13_6x68b3yp_.arc
3 1 14 A 2011-05-18 09:30:43 /backup/archivedlog/1_14_751026649.dbf
4 1 14 A 2011-05-18 09:30:43 /oracle/flash_recovery_area/AHJCYL/archivelog/2011_05_18/o1_mf_1_14_6x68b5lj_.arc
5 1 15 A 2011-05-18 09:30:45 /backup/archivedlog/1_15_751026649.dbf 6 1 16 A 2011-05-18 10:05:38 /backup/archivedlog/1_16_751026649.dbf
–现在变为一份了
总结:
老版本使用log_archive_dest配置归档日志路径最多可以配置2个,除了这个参数还有一个LOG_ARCHIVE_DUPLEX_DEST,这两个参数都只能配置本地路径,格式是log_archive_dest=’/backup1/xxx/’;
到了企业版,log_archive_dest这个参数已被oracle不推荐,如果用log_archive_dest_n最多可以配置10个路径,而且可以是本地也可以是远程的standby DB,log_archive_dest_n路径必须加location或service
log_archive_dest与log_archive_dest_n两个参数冲突,如果指定了log_archive_des后log_archive_dest_n显示指定不会起作用
如果指定了log_archive_dest路径,oracle会隐式启用log_archive_dest_10,默认路径为闪回区,所以上面备份会两份,如果显示指定log_archive_dest_10为空串,将不会再备份到闪回区
这两组参数都是静态参数,修改后必须重启数据库生效,如果都未批定会用系统默认:闪回区