Oracle10g用戶端工具plsql連結服務端配置
Oracle10g用戶端工具比如plsql,在網路中連結服務端問題比較多,經常出現很多莫名其妙的問題。實際上不是plsql的配置,問題還是出在用戶端配置上面,網上有很多的解決辦法,並非真正的湊效,下面說一下有效解決辦法:
安裝用戶端為企業管理器,預設安裝吧。
安裝後需要配置,這個位置位置在:D:\oracle\product\10.2.0\client_1\NETWORK\ADMIN
有兩個檔案需要配置:
sqlnet.ora
tnsnames.ora
先看tns:
# tnsnames.ora Network Configuration File: d:\oracle\product\10.2.0\client_1\network\admin\tnsnames.ora # Generated by Oracle configuration tools.
EXTPROC_CONNECTION_DATA = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0)) ) (CONNECT_DATA = (SID = PLSExtProc) (PRESENTATION = RO) ) )
KFCS = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.87.30.44)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 10.87.30.45)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 10.87.30.46)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 10.87.30.47)(PORT = 1521)) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = KFCS) ) ) |
紅色部分為伺服器端配置的tns,服務名為KFCS
這下注意了,還有個網路服務檔案也需要配置:
# sqlnet.ora Network Configuration File: D:\oracle\product\10.2.0\db_1\network\admin\sqlnet.ora # Generated by Oracle configuration tools.
# This file is actually generated by netca. But if customers choose to # install "Software Only", this file wont exist and without the native # authentication, they will not be able to connect to the database on NT.
SQLNET.AUTHENTICATION_SERVICES= (KFCS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT) |
上面的紅色服務名要和tns檔案中的配置保持一致,否則會有問題。預設的不對)
預設安裝用戶端的時候不對。
只要有了這兩項配置,你就可以正確的通過plsql連結資料庫了。
-----------------------------------------------------------
特別說明下:通過sqlplus命令列連結資料庫可能和這個配置無關,具體我試過,感覺sqlplus可以連結成功,就是plsql不成功。感覺sqlplus連結的方式可能不一樣。
本文出自 “熔 岩” 部落格,請務必保留此出處http://lavasoft.blog.51cto.com/62575/1290320