- 最后登录
- 2023-8-16
- 在线时间
- 1686 小时
- 威望
- 2135
- 金钱
- 50532
- 注册时间
- 2011-10-12
- 阅读权限
- 200
- 帖子
- 5207
- 精华
- 39
- 积分
- 2135
- UID
- 2
|
2#
发表于 2012-4-30 23:21:01
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
SQL> show parameter recover
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string /s01/orabase/fast_recovery_area
SQL> show parameter log_archive_format
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_format string %t_%s_%r.dbf
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 139
Next log sequence to archive 141
Current log sequence 141
SQL> alter system archive log current;
System altered.
SQL> set linesize 140
SQL> select name from v$archived_log;
NAME
--------------------------------------------------------------------------------------------------------------------------------------------
/s01/orabase/fast_recovery_area/G11R23/archivelog/2012_04_30/o1_mf_1_140_7sxtntt0_.arc
SQL> alter system set log_archive_dest_1='location=/s01/arch';
System altered.
SQL> alter system archive log current;
System altered.
SQL> select name from v$archived_log;
NAME
------------------------------------------------------------------------------------------------------------------------------------------------------
/s01/orabase/fast_recovery_area/G11R23/archivelog/2012_04_30/o1_mf_1_140_7sxtntt0_.arc
/s01/arch/1_141_773077545.dbf
o1_mf_1_140_7sxtntt0_.arc = > o1_mf_%t_%s_%u_.arc
7sxtntt0 是%u 生成的 随即唯一数字
这是USE_DB_RECOVERY_FILE_DEST 独有的archive format,这个格式中没有%r resetlogs ID that ensures unique names are constructed for the archived log files across multiple incarnations of the database
SQL> alter system set log_archive_format='o1_mf_%t_%s_%u_.arc' scope=spfile;
System altered.
SQL> create pfile from spfile;
File created.
SQL> startup force;
ORA-19905: log_archive_format must contain %s, %t and %r
从10g 开始 log_archive_format 必须带有 %s, %t and %r 参数
[oracle@nas dbs]$ oerr ora 19905
19905, 00000, "log_archive_format must contain %%s, %%t and %%r"
// *Cause: log_archive_format is missing a mandatory format element.
// Starting with Oracle 10i, archived log file names must contain each
// of the elements %s(sequence), %t(thread), and %r(RESETLOGS ID) to
// ensure that all archived log file names are unique.
// *Action: Add the missing format elements to log_archive_format.
*.log_archive_format='o1_mf_%t_%s_%u_%r.arc'
SQL> show parameter log_archive_format
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_format string o1_mf_%t_%s_%u_%r.arc
SQL> alter system set log_archive_dest_1='location=/s01/arch';
System altered.
SQL> select name from v$archived_log;
/s01/arch/o1_mf_1_155_0_773077545.arc
/s01/arch/o1_mf_1_156_0_773077545.arc
==》在非USE_DB_RECOVERY_FILE_DEST时 %u 变量无效 总是为0
结论:
在11gR2 中非USE_DB_RECOVERY_FILE_DEST时 %u 变量无效 总是为0 , 且log_archive_format必须带有 %r 变量以保证 归档日志文件名唯一,USE_DB_RECOVERY_FILE_DEST时归档日志名比较特殊为 o1_mf_%t_%s_%u_.arc |
|