网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

通过sqlplus连接数据库服务器很慢的问题-创新互联


今天在论坛上看到一个贴子,问题是客户端sqlplus连接数据库很慢:http://www.itpub.net/thread-2090550-1-1.html,之后根据问题的描述与分析,在测试环境做了一下测试,将我的虚拟主机加入域环境,进行测试;之后就联想到去年我所遇到类似的一个问题:http://www.itpub.net/thread-2072574-1-1.html

从事西云机房,服务器租用,云主机,网络空间,空间域名,CDN,网络代维等服务。

实验环境
操作系统:Windows Server 2008 R2,加入AD域环境
数据库:Oracle 11.2.0.4

问题描述:
1、从客户端使用sqlplus xxx/ssss@yyy 的方式连接数据库,第一次连数据库时很慢,基本上要几十秒才能连接到数据库,接下来几次连接很正常,但过会儿再连接数据库又变慢了
2、数据库的日志文件中,有大量的WARNING: inbound connection timed out (ORA-3136) 错误信息
排除过程:
1、查了ORA-03136的错误,根据网上查找的资料,把数据库服务的监听添加了如下参数
    LSNRCTL> set inbound_connect_timeout 0  

并保存,此时,数据库中不在报ORA-03136的错误了,但是,从客户端连接到oracle数据库服务器还是存在很慢的问题
2、客户端连接数据库服务时,数据库的那台主机的硬件负载都不高;
3、服务器的监听文件和客户端的tnsname.ora中的主机地址都是使用ip地址
4、在服务器上使用sqlplus xxx/ssss@yyy尝试连接多次,速度正常,感觉服务器端没问题
5、从客户端ping服务器的监听地址,没有丢包现像
6、在客户端使用tnsping测试到服务器的解析也很快,毫秒以内
7、通过5和6的测试,感觉客户端到服务器的网络是正常的
8、继续查询,在网上发现这篇文章和我的情况类似,http://blog.csdn.net/jaray/article/details/36008871后来根据这个文章上的方法,修改了服务器上的sqlnet.ora中的SQLNET.AUTHENTICATION_SERVICES的值为none
9、再次使用sqlplus 测试从客户端测试到服务端的连接,速度正常,几秒内连接成功
10、尝试把那个值再改成NTS,故障又再次出现

问题分析:

在sqlnet.ora的SQLNET.AUTHENTICATION_SERVICES设置,如果设置NTS,则优先使用Windows验证,然后使用Oracle验证;而设置none,则只使用Oracle验证。由于我测试的环境加入了AD域,所以如果优先Windows验证,则Oracle会通过远程的AD域服务器进行验证,验证失败后再进行Oracle验证,所以速度会很慢;

解决问题:

将sqlnet.ora的SQLNET.AUTHENTICATION_SERVICES值设置为none

问题分析到这里,不经让我想起去年遇到一个同样类似的问题:通过sqlplus远程连接Oracle数据库的时,有时候能够连接上,有什么就连接不上?(如下图所示)

通过sqlplus连接数据库服务器很慢的问题

以下是Oracle11g官方文档关于sqlnet.ora的说明:

************************************************************************************************************************************

The sqlnet.ora file is the profile configuration file. It resides on the client machines and the database server. Profiles are stored and implemented using this file. The database server can be configured with access control parameters in the sqlnet.ora file. These parameters specify whether clients are allowed or denied access based on the protocol.

The sqlnet.ora file enables you to do the following:

·         Specify the client domain to append to unqualified names

·         Prioritize naming methods

·         Enable logging and tracing features

·         Route connections through specific processes

·         Configure parameters for external naming

·         Configure Oracle Advanced Security

·         Use protocol-specific parameters to restrict access to the database

By default, the sqlnet.ora file is located in the ORACLE_HOME/network/admin directory. The sqlnet.ora file can also be stored in the directory specified by the TNS_ADMIN environment variable.

************************************************************************************************************************************

从描述中看出,该文件是控制客户端访问数据库服务器的,可以设定多种参数进行访问控制。关于其他参数的详细配置请参考官方文档;而接触到的最多的参数是 sqlnet.authentication_services,官方说明如下:

************************************************************************************************************************************

SQLNET.AUTHENTICATION_SERVICES

Purpose

To enable one or more authentication services. If authentication has been installed, then it is recommended that this parameter be set to either noneor to one of the authentication methods.

Default

None

Note:

When installing the database with Database Configuration Assistant (DBCA), this parameter may be set to nts in the sqlnet.ora file.

Values

·         Authentication Methods Available with Oracle Net Services:

o   none for no authentication methods, including Microsoft Windows native operating system authentication. WhenSQLNET.AUTHENTICATION_SERVICES is set to none, a valid user name and password can be used to access the database.

o   all for all authentication methods.

o   nts for Microsoft Windows native operating system authentication.

·         Authentication Methods Available with Oracle Advanced Security:

o   kerberos5 for Kerberos authentication.

o   radius for RADIUS authentication.

o   tcps for SSL authentication.

************************************************************************************************************************************

从参数的说明可以了解到提供两种服务,net服务和高级安全服务。高级安全服务参数这里不讨论了,讨论一下 none / all / nts三个参数的作用。

设定sqlnet.authentication_services:

  • none:作用是不允许通过os系统用户登录数据库,需要提供用户名及密码;
  • all:作用是允许所有的登录方式;
  • nts:作用是windows的本地操作系统用户认证;

注:需要说明的是该用户名和密码是指具有sysdba权限的用户;在linux上若用系统用户oracle登录数据库需要设定为all或者不加该字段;

关于通过SQLNET.ora文件限制IP地址访问的问题请参考盖大师的博客:

http://www.eygle.com/archives/2008/01/sqlnetora_ip_limit.html

作者:SEian.G(苦练七十二变,笑对八十一难)

ITPUB:http://blog.itpub.net/31015730/

51CTO:http://seiang.blog.51cto.com/


网站题目:通过sqlplus连接数据库服务器很慢的问题-创新互联
当前链接:http://bjjierui.cn/article/dpspes.html

其他资讯