ORA-01336: specified dictionary file cannot be opened

这篇介绍使用Logminer时遇到ORA-01336: specified dictionary file cannot be opened错误的各种场景

 

1:dictionary_location参数的路径最后多了一个/符号。

 

SQL>  show parameter utl_file_dir;
 
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
utl_file_dir                         string      /u01/app/utl_file_dir
SQL> exec dbms_logmnr_d.build(dictionary_filename=>'logmin.ora', dictionary_location=>'/u01/app/utl_file_dir/',options=>dbms_logmnr_d.store_in_flat_file);
BEGIN dbms_logmnr_d.build(dictionary_filename=>'logmin.ora', dictionary_location=>'/u01/app/utl_file_dir/',options=>dbms_logmnr_d.store_in_flat_file); END;
 
*
ERROR at line 1:
ORA-01336: specified dictionary file cannot be opened
ORA-29280: invalid directory path
ORA-06512: at "SYS.DBMS_LOGMNR_INTERNAL", line 6003
ORA-06512: at "SYS.DBMS_LOGMNR_INTERNAL", line 6093
ORA-06512: at "SYS.DBMS_LOGMNR_D", line 12
ORA-06512: at line 1

 

如下所示,将dictionary_location的值从dictionary_location=>’/u01/app/utl_file_dir/’ 改为=>’/u01/app/utl_file_dir’就会OK。

SQL> exec dbms_logmnr_d.build(dictionary_filename=>'logmin.ora', dictionary_location=>'/u01/app/utl_file_dir',options=>dbms_logmnr_d.store_in_flat_file);
 
PL/SQL procedure successfully completed.
 
SQL> 

 

2:随意指定的dictionary_location,与参数utl_file_dir不一致。

 

这个纯属菜鸟犯的错误,没有太多要说的。如下所示,你就知道这个是怎样的一个场景:

SQL> exec dbms_logmnr_d.build(dictionary_filename=>'logmin.ora', dictionary_location=>'/u01/app/kkk',options=>dbms_logmnr_d.store_in_flat_file);
BEGIN dbms_logmnr_d.build(dictionary_filename=>'logmin.ora', dictionary_location=>'/u01/app/kkk',options=>dbms_logmnr_d.store_in_flat_file); END;
 
*
ERROR at line 1:
ORA-01336: specified dictionary file cannot be opened
ORA-29280: invalid directory path
ORA-06512: at "SYS.DBMS_LOGMNR_INTERNAL", line 6003
ORA-06512: at "SYS.DBMS_LOGMNR_INTERNAL", line 6093
ORA-06512: at "SYS.DBMS_LOGMNR_D", line 12
ORA-06512: at line 1
 
 
SQL> ! oerr ora 1336
01336, 00000, "specified dictionary file cannot be opened"
// *Cause: The dictionary file or directory does not exist or is inaccessible.
// *Action: Make sure that the dictionary file and directory exist and are
//          accessible.
 
 
SQL> show parameter utl_file_dir;
 
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
utl_file_dir                         string      /u01/app/utl_file_dir
SQL> 
 
SQL> exec dbms_logmnr_d.build(dictionary_filename=>'logmin.ora', dictionary_location=>'/u01/app/utl_file_dir',options=>dbms_logmnr_d.store_in_flat_file);
 
PL/SQL procedure successfully completed.
 
SQL> 

 

3:定义utl_file_dir 参数最好使用完整路径,使用预定义环境变量会导致无法打开文件目录

 

SQL> alter system set utl_file_dir='$ORACLE_BASE/log_mnr' scope=spfile;
 
System altered.
 
SQL> shutdown immediate;
SQL> startup;
 
SQL> exec dbms_logmnr_d.build(dictionary_filename=>'logmin.ora', dictionary_location=>'/u01/app/oracle/log_mnr',options=>dbms_logmnr_d.store_in_flat_file);
BEGIN dbms_logmnr_d.build(dictionary_filename=>'logmin.ora', dictionary_location=>'/u01/app/oracle/log_mnr',options=>dbms_logmnr_d.store_in_flat_file); END;
 
*
ERROR at line 1:
ORA-01336: specified dictionary file cannot be opened
ORA-29280: invalid directory path
ORA-06512: at "SYS.DBMS_LOGMNR_INTERNAL", line 6003
ORA-06512: at "SYS.DBMS_LOGMNR_INTERNAL", line 6093
ORA-06512: at "SYS.DBMS_LOGMNR_D", line 12
ORA-06512: at line 1

点赞