Windows监听日志文件过大,需要清理,设置log_status off报错TNS-12508

(1)检查监听日志状态
C:\Users\Administrator>lsnrctl status
...
LISTENER 的 STATUS
------------------------
别名                      LISTENER
版本                      TNSLSNR for 64-bit Windows: Version 11.2.0.3.0 - Produ
ction
启动日期                  26-10月-2017 13:03:25
正常运行时间              0 天 0 小时 2 分 19 秒
跟踪级别                  off
安全性                    ON: Local OS Authentication
SNMP                      OFF
监听程序参数文件          D:\app\Administrator\product\11.2.0\dbhome_1\network\a
dmin\listener.ora
监听程序日志文件          D:\app\Administrator\diag\tnslsnr\WIN-MIRBE4NEBAU\listener\alert\log.xml
...
  实例 "orcl", 状态 READY, 包含此服务的 1 个处理程序...
服务 "orclXDB" 包含 1 个实例。
  实例 "orcl", 状态 READY, 包含此服务的 1 个处理程序...
命令执行成功

(2)设置log_status off
LSNRCTL> set log_status off
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=WIN-MIRBE4NEBAU)(PORT=1521)
))
TNS-12508: TNS: 监听程序无法解析给定的 COMMAND

(3)检查listener.ora:
# listener.ora Network Configuration File: D:\app\Administrator\product\11.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
INBOUND_CONNECT_TIMEOUT_LISTENER = 0
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = D:\app\Administrator\product\11.2.0\dbhome_1)
      (PROGRAM = extproc)
      (ENVS = "EXTPROC_DLLS=ONLY:D:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll")
    )
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = D:\app\Administrator\product\11.2.0\dbhome_1)
      (PROGRAM = extproc)
      (ENVS = "EXTPROC_DLLS=ONLY:D:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll")
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = WIN-MIRBE4NEBAU)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

ADR_BASE_LISTENER = D:\app\Administrator

Admin_Restrictions_LISTENER = ON      ---包含此行



(4)修改listener.ora中的Admin_Restrictions_LISTENER = OFF

然后执行lsnrctl reload,提示设置成功

LSNRCTL> set log_status off
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=WIN-MIRBE4NEBAU)(PORT=1521)
))
TNS-12508: TNS: 监听程序无法解析给定的 COMMAND
LSNRCTL> reload
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=WIN-MIRBE4NEBAU)(PORT=1521)
))
命令执行成功
LSNRCTL> set log_status off
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=WIN-MIRBE4NEBAU)(PORT=1521)
))
LISTENER 参数 "log_status" 设为 OFF
命令执行成功
LSNRCTL>

(5)删除listener.log成功


参考MOS文章:
TNS-12508 When Issuing Any SET Command For The Listener (文档 ID 238312.1)

你可能感兴趣的:(Oracle)