Linux下配置Oracle监听器

1. 修改监听器配置文件

Linux下Oracle监听器配置文件在:$ ORACLE_HOME/network/admin/listerer.ora, 如:
 $ ORACLE_HOME=/u01/oracle/app/product/11.2.0/dbhome_1
 
修改并配置要监听SID的相关信息,如:

#listener.ora Network Configuration File:/u01/oracle/app/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /bank/oracle/oracle10g/product/10.2.0)
      (PROGRAM = extproc)
    )

    (SID_DESC =
      (GLOBAL DBNAME = orcl
      (SID_NAME = orcl)
    )

  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
  )
  
2. 启动监听器

(1). 切换至oracle安装用户(一般为oracle)
su - oracle  

(2). 启动监听器
lsnrctl start  

另:停止监听器
lsnrctl stop

3. 测试监听器是否运行正常

在客户端修改tnsnames.ora配置文件就访问Oracle数据库,如:

BKSERVER =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME =
orcl)
    )
  )
  
通过命令tnsping测试是否能访问到监听器,如:

tnsping orcl



已使用 TNSNAMES 适配器来解析别名
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
(HOST = localhost)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVIC
E_NAME = orcl)))
OK (20 毫秒)

注意: 监听器是否能被tnsping通跟数据库的开启/关闭无关,所以就算可以tnsping通监听器但未必能连接到数据库,这时请检查listener.ora文件配置信息是否正确,还有数据库是否已经被开启。

你可能感兴趣的:(Oracle,oracle,oracle监听配置)