因為平時使用Linux的時候較多,所以有時還會遇到sqlnet.ora這個文件有問題,直接給它刪了就好了~~
有時在Windows下裝的oracle的listener服務就啟動不了,遇到這種情況,直接去Oracle的bin目錄下面找到lsnrctl.exe那個文件,直接給它運行,彈出來的窗口不要關閉,就可以了。
Oracle Server端Listener.ora文件(一個instance):
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL=TCP)(HOST=hostname)(PORT=1521))//主機名或IP及端口設置
)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = database1) // database1為數據庫instance名
(ORACLE_HOME = /opt/oracle/product/10.1.0) //Oracle安裝目錄,根據安裝情況更改
(PROGRAM = extproc)
)
)
Oracle Server端Listener.ora文件(兩個instance):
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL=TCP)(HOST=hostname)(PORT=1521))
)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = database1) // database1為數據庫instance1名
(ORACLE_HOME = /opt/Oracle/product/10.1.0)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = database2) // database2為數據庫instance2名
(ORACLE_HOME = /opt/Oracle/product/10.1.0)
(PROGRAM = extproc)
)
)
Oracle Server端監聽器啟動、停止、查看狀態命令:
$ lsnrctl start
$ lsnrctl stop
$ lsnrctl status
Oracle ClIEnt端Tnsnames.ora文件:
ORALOCAL =//別名oralocal
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = database1) //database1為SID名
)
)
Oracle ClIEnt端檢查監聽器連接狀態用命令:
$ tnsping 別名
例如:用Oracle用戶執行命令 $ tnsping oralocal