首页 » ORACLE » Enabling Listener Trace ,TNS-01251

Enabling Listener Trace ,TNS-01251

Enabling Listener Trace ,TNS-01251

Oracle version 11g introduced the ADR or Automatic Diagnostic Repository feature,Trying to change the log file using the Lsnrctl utility fails with:
TNS-01251: Cannot set trace/log directory under ADR.

oracle@db231 trace]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 15-AUG-2013 14:15:59

Copyright (c) 1991, 2011, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date                15-AUG-2013 14:06:57
Uptime                    0 days 0 hr. 9 min. 1 sec
Trace Level               OFF
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/db231/listener/alert/log.xml
Listener Trace File       /u01/app/oracle/diag/tnslsnr/db231/listener/trace/ora_15271_139821785470688.trc
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db231)(PORT=1521)))
Services Summary...
Service "anbob.com" has 1 instance(s).
  Instance "anbob", status READY, has 1 handler(s) for this service...
Service "anbobXDB.com" has 1 instance(s).
  Instance "anbob", status READY, has 1 handler(s) for this service...
The command completed successfully

[oracle@db231 trace]$ lsnrctl
LSNRCTL> show cur
Current Listener is LISTENER
LSNRCTL>  show trc_directory
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
LISTENER parameter "trc_directory" set to /u01/app/oracle/diag/tnslsnr/db231/listener/trace
The command completed successfully
LSNRCTL> set trc_directory /home/oracle
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-01251: Cannot set trace/log directory under ADR

[oracle@db231 trace]$ vi /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = db231)(PORT = 1521))
    )
  )

ADR_BASE_LISTENER = /u01/app/oracle

If the parameter DIAG_ADR_ENABLED_listenername is set to ON in the listener.ora file, the parameter log_directory is ignored. The trace and log files are created in the location defined by ADR_BASE_listener_name.you can disable ADR by setting in listener.ora

set the below parameter in listener.ora disable ADR (default is on)
DIAG_ADR_ENABLED_<listener_name> = OFF

My listener name was LISTENER as “show cur” output above.

[oracle@db231 ~]$ vi /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = db231)(PORT = 1521))
    )
  )
ADR_BASE_LISTENER = /u01/app/oracle
DIAG_ADR_ENABLED_LISTENER=OFF  #disable ADR

[oracle@db231 ~]$ lsnrctl

LSNRCTL> reload
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
The command completed successfully

LSNRCTL> set trc_directory  /home/oracle
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-01178: Trace Level is 0. Trace file/directory unchanged

LSNRCTL> set trc_level 16
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
LISTENER parameter "trc_level" set to support
The command completed successfully
LSNRCTL> set trc_directory  /home/oracle
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
LISTENER parameter "trc_directory" set to /home/oracle
The command completed successfully
LSNRCTL> set trc_file lsn.trc
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
LISTENER parameter "trc_file" set to lsn.trc

LSNRCTL> show trc_directory
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
LISTENER parameter "trc_directory" set to /home/oracle

[oracle@db231 ~]$ ll /home/oracle lsn.trc  
-rw-r-----  1 oracle oinstall 19210 Aug 15 14:33 lsn.trc

-bash: trai: command not found
[oracle@db231 ~]$ head /home/oracle/lsn.trc     

TNSLSNR for Linux: Version 11.2.0.3.0 - Production on 15-AUG-2013 14:33:20

Copyright (c) 1991, 2011, Oracle.  All rights reserved.

[15-AUG-2013 14:33:20:166] --- TRACE CONFIGURATION INFORMATION FOLLOWS ---
[15-AUG-2013 14:33:20:166] New trace stream is /home/oracle/lsn.trc
[15-AUG-2013 14:33:20:166] New trace level is 16
[15-AUG-2013 14:33:20:166] --- TRACE CONFIGURATION INFORMATION ENDS ---
[15-AUG-2013 14:33:20:166] nsglrespond: entry

LSNRCTL> set trc_level off
LSNRCTL> show trc_level
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
LISTENER parameter "trc_level" set to off
The command completed successfully
LSNRCTL> exit

— done —

打赏

对不起,这篇文章暂时关闭评论。