1.查看监听程序是否启动
打开cmd窗口,cmd用管理员运行,否则无法执行启动与停止监听命令
lsnrctl status查看运行状态
lsnrctl stop停止监听
lsnrctl start启动监听
执行停止监听命令
2.修改监听配置文件
a> 打开<OracleHome>/network/admin/listener.ora文件,找到:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\app\glass\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\app\glass\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
)
GLOBAL_DBNAME全局数据库默认为orcl.hostname,安装数据库时配置
b> 添加:
(SID_DESC =
(GLOBAL_DBNAME = ORCL.16.167.16)需要修改
(ORACLE_HOME = C:\app\glass\product\11.2.0\dbhome_1)
(SID_NAME = ORCL)需要修改
)
c> 修改后的配置文件如下
# listener.ora Network Configuration File: C:\app\glass\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\app\glass\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\app\glass\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
(SID_DESC =
(GLOBAL_DBNAME = ORCL.16.167.16)
(ORACLE_HOME = C:\app\glass\product\11.2.0\dbhome_1)
(SID_NAME = ORCL)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.167.16)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
)
ADR_BASE_LISTENER = C:\app\glass
注意:配置文件中配置的ip必须为有效的ip,否则无法启动,如果电脑ip不固定,变化ip后,刚会导致oracle监听无法启动,可根据需要自己配置,若只在本机上使用,可只保留127.0.0.1的ip,这样不管是否连网,都能顺利启动监听程序