测试log_archive_dest_1与log_archive_format对生成的归档文件名的影响

客户反映归档的位置不太多,再仔细看归档的名字也不对;检查下发现指定 归档目录类似
/arch/test 而不是/arch/test/
如下测试验证log_archive_dest_1与log_archive_format对生成的归档文件名的影响。

1.log_archive_dest_1指定的目录后面还有字段

1.1. 字段对应的无同名目录,生成归档文件名=log_archive_dest_1+log_archive_format

1.2 字段对应的有同名目录,生成归档文件在同名目录下,文件名为log_archive_format

2.log_archive_dest_1指定的目录不存在--报错

3.log_archive_dest_1指定的目录
归档文件名=log_archive_format

-----------------------------------

1 log_archive_dest_1指定的目录后面还有字段

1.1. 字段对应的无同名目录,生成归档文件名=log_archive_dest_1+log_archive_format

归档文件名=log_archive_dest_1+log_archive_format
SQL> alter system set log_archive_dest_1='LOCATION=/u01/oracle/base/oracle/oradata/arch/test';
System altered.
SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u01/oracle/base/oracle/oradata/arch/test
Oldest online log sequence     24
Next log sequence to archive   26
Current log sequence           26
SQL> show parameter log_archive_format
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_format                   string      %t_%s_%r.dbf
SQL> alter system switch logfile;
System altered.
--------生成的文件名
[oracle@bys1 arch]$ pwd
/u01/oracle/base/oracle/oradata/arch
[oracle@bys1 arch]$ ls
test1_26_900253622.dbf

1.2 字段对应的有同名目录,生成归档文件在同名目录下,文件名为log_archive_format

文件在同名目录下,文件名为log_archive_format

SQL> alter system switch logfile;
System altered.

[oracle@bys1 test]$ pwd
/u01/oracle/base/oracle/oradata/arch/test
[oracle@bys1 test]$ ls
1_40_900253622.dbf

2.log_archive_dest_1指定的目录不存在--直接报错
SQL> alter system set log_archive_dest_1='LOCATION=/u01/oracle/base/oracle/oradata/arch/test/';
alter system set log_archive_dest_1='LOCATION=/u01/oracle/base/oracle/oradata/arch/test/'
*
ERROR at line 1:
ORA-02097: parameter cannot be modified because specified value is invalid
ORA-16032: parameter LOG_ARCHIVE_DEST_1 destination string cannot be translated
ORA-07286: sksagdi: cannot obtain device information.
Linux Error: 2: No such file or directory

3.log_archive_dest_1指定目录
归档文件名=log_archive_format
[oracle@bys1 arch]$ mkdir test
[oracle@bys1 arch]$ ls
test  test1_26_900253622.dbf
SQL> alter system set log_archive_dest_1='LOCATION=/u01/oracle/base/oracle/oradata/arch/test/';
System altered.
SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u01/oracle/base/oracle/oradata/arch/test/
Oldest online log sequence     25
Next log sequence to archive   27
Current log sequence           27
SQL> show parameter log_archive_format
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_format                   string      %t_%s_%r.dbf
SQL> alter system switch logfile;
System altered.
---------
[oracle@bys1 arch]$ cd test
[oracle@bys1 test]$ ls -al
total 12
drwxr-xr-x 2 oracle oinstall 4096 Feb  1 16:13 .
drwxr-xr-x 3 oracle oinstall 4096 Feb  1 16:13 ..
-rw-r----- 1 oracle asmadmin 2560 Feb  1 16:13 1_27_900253622.dbf
[oracle@bys1 test]$ pwd
/u01/oracle/base/oracle/oradata/arch/test



你可能感兴趣的:(测试log_archive_dest_1与log_archive_format对生成的归档文件名的影响)