在Oracle 数据库的实际应用中,开启archivelog模式是必不可少的,但是在设置archivelog的过程中,可能因为不小心出现错误,导致数据库无法启动,本案例就是一种情况。
误操作现象:
设置archivelog name格式时,将archivelog的命名格式设置为archive_%s_%t.arc,修改系统配置文件成功,重启数据库使设置生效。但是异常发生了,数据库无法启动。
出错原因:
设置archivelog name格式时,匹配符%s,%t,%r是必须的。
%s 日志序列号。
%t 重做线程编号。
%r RESETLOGS的ID值。
因为在设置的时候没有符合匹配符%s,%t,%r都存在的要求,所以在数据库启动,加载参数文件时,这条设置无法验证通过,导致数据库无法启动。
1 SQL> alter system set log_archive_format="archive_%s_%t.arc" scope=spfile; 2 3 System altered. 4 5 SQL> shutdown immediate 6 Database closed. 7 Database dismounted. 8 ORACLE instance shut down. 9 SQL> startup mount 10 ORA-19905: log_archive_format must contain %s, %t and %r 11 SQL> alter system set log_archive_format="robt_%s_%t_%r.arc" scope=spfile; 12 alter system set log_archive_format="robt_%s_%t_%r.arc" scope=spfile 13 * 14 ERROR at line 1: 15 ORA-01034: ORACLE not available 16 Process ID: 0 17 Session ID: 153 Serial number: 7663