经常遇到pl/sql developer等依赖client的工具无法连接oracle数据库服务器的问题。至今也没完全理清楚,先发个帖总结一下目前的方
经常遇到pl/sql developer等依赖client的工具无法连接oracle数据库服务器的问题。至今也没完全理清楚,先发个帖总结一下目前的方法,后面会不断完善。
方法一:
重启oracle服务器端相关服务,包括...tnslistener,所用的数据库实例的服务。可直接在windows的“服务”中重启。或者(可使用的命令):
lsnrctl stop
lsnrctl start
lsnrctl reload
sqlplus / as sysdba;
startup;
这个方法试过多次有效,但原因未知,求真相。
方法二:
使用net configuration assist配置服务器端和客户端。
oracle服务器端需要设置listener(监听程序),设置结果影响listener.ora(...\db_1\network\admin)。client端(客户端)需要配置“本地net服务名配置”,可能影响tnsnames.ora和sqlnet.ora两个文件。若是oracle client,,则文件位置是...\client_1\network\admin
方法三:
若装有oracle client,则可使用enterprise manager console添加数据库连接,会修改tnsnames.ora文件(...\client_1\network\admin)。
方法四:
查看sqlnet.ora中是否有names,directory_path等,可能与此有关。
# sqlnet.ora network configuration file: c:\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= (nts)
names.directory_path= (tnsnames, ezconnect)
注意:
1. enterprise manager console与net configuration assist添加的数据库连接描述符不同,前者为...connect_data=(sid=...)(server=...)...,后者为...(servicename=...)...。
2. enterprise manager console中删除一条连接后,tnsnames.ora中的描述字符串不会自动删除;net configuration assist中删除一条本地net服务配置后,tnsnames.ora文件中对应的描述字符串会自动删除。
3. 若安装配置owb(oracle warehouse builder),则文件位置是...\client_1\network\admin