Oracle資料庫監聽

lansesl2008發表於2013-12-20

最近小白總是能夠遇到一些資料庫監聽問題,導致工具PLSQL連不上去,現在總結一把。

1. 資料庫監聽的配置檔案: listener.ora 和 tnsnames.ora

    listener.ora: 主要負責伺服器端的監聽配置

    tnsnames.ora: 主要負責客戶端的監聽配置

 

listen.ora檔案的內容如下:

# listener.ora Network Configuration File: /home/oracle/app/product/11/db/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER_ORA =                           (注:LISTENER_ORA 為監聽名字)
        (DESCRIPTION_LIST =
        (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = 12.1.4.5)(PORT = 1521))
        )
        )

SID_LIST_LISTENER_ORA =          (注:LISTENER_ORA 為監聽名字)

        (SID_LIST =
        (SID_DESC =
        (GLOBAL_DBNAME = wsj)
        (ORACLE_HOME = /home/oracle/app/product/11/db)
        (SID_NAME = wsj)
        )
        )

tnsnames.ora的檔案內容如下:

# tnsnames.ora Network Configuration File: /home/oracle/app/product/11/db/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

WSJ =                                              (注: WSJ 為例項名)
        (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = 12.1.4.5)(PORT = 1521))
        (CONNECT_DATA =
        (SERVER = DEDICATED)
        (SERVICE_NAME = wsj)
        )
        )

 

2. 一個監聽的有無取決於listen.ora和tnsnames.ora中有沒有那個監聽相關的配置,與此同理,重建一個監聽也只需要在listen.ora和tnsnames.ora中新增如上的配置即可,切忌PORT=1521中的1521埠不能被其他程式給佔用

 

相關文章