0

在客户端开发了一个使用 ODP.NET 访问 oracle 12c 数据库服务器的应用程序。我在客户端和服务器上都有 2 个网络适配器。服务器正在不同端口上的两个网络轨道上进行侦听。

如果我从服务器端拉出一根网线,客户端大约需要 21 秒才能将其故障转移到另一个网络轨道,以便与数据库通信。我该如何加快速度?我使用了 TCP.CONNECT_TIMEOUT、TRANSPORT_CONNECT_TIMEOUT 和 CONNECTION_TIMEOUT,但似乎没有任何应用。我已经在 sqlnet.ora 和应用程序级别应用了 TCP.CONNECT_TIMEOUT,但没有任何效果。TNSPING 和 sqlplus 工作正常,并根据指定的超时进行故障转移。

看起来 OPD.NET 并没有尊重描述部分中的很多东西。出于好奇,我测试了其他的东西,比如把 FAILOVER=off ,它仍然失败了。我还将描述部分放在“数据源”标签下的连接字符串中。依然没有。ODP.NET 中是否存在错误?

请帮忙。-大卫


客户:

DBSVR =
  (DESCRIPTION =
    (RETRY_COUNT = 0)
    (LOAD_BALANCE = off)
    (FAILOVER = on)
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.11)(PORT = 1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.11)(PORT = 1526))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = DBSVR)
      (FAILOVER_MODE =
        (TYPE = select)
        (METHOD = basic)
      )
    )
  )

sqlnet.ora 和 app.config 中的设置:

TCP.CONNECT_TIMEOUT = 3
TRANSPORT_CONNECT_TIMEOUT = 3
CONNECTION TIMEOUT = 60

跟踪文件的摘录:

2017-02-26 16:21:27.818678 TID:1   (CFG) (SQLNET)   SQLNET.AUTHENTICATION_SERVICES : (none)
2017-02-26 16:21:27.820678 TID:1   (CFG) (SQLNET)   TRACE_LEVEL_CLIENT : SUPPORT
2017-02-26 16:21:27.820678 TID:1   (CFG) (SQLNET)   TRACE_DIRECTORY_CLIENT : C:\OracleTrace
2017-02-26 16:21:27.820678 TID:1   (CFG) (SQLNET)   TRACE_FILE_CLIENT : client_trace.log
2017-02-26 16:21:27.820678 TID:1   (CFG) (SQLNET)   DIAG_ADR_ENABLED : OFF
2017-02-26 16:21:27.822678 TID:1   (CFG) (ENV)      Machine Name : CASGUI2
2017-02-26 16:21:27.822678 TID:1   (CFG) (ENV)      User Name : aimscsadmin
2017-02-26 16:21:27.822678 TID:1   (CFG) (ENV)      OS Version : Microsoft Windows NT 6.1.7601 Service Pack 1
2017-02-26 16:21:27.822678 TID:1   (CFG) (ENV)      64-bit OS : True
2017-02-26 16:21:27.822678 TID:1   (CFG) (ENV)      64-bit Process : False
2017-02-26 16:21:27.822678 TID:1   (CFG) (ENV)      .NET Runtime Version : 4.0.30319.42000
2017-02-26 16:21:27.822678 TID:1   (CFG) (VER)      Oracle Data Provider for .NET, Managed Driver Version : 4.121.2.0
2017-02-26 16:21:27.822678 TID:1   (CFG) (VER)      Oracle Data Provider for .NET, Managed Driver Informational Version : 4.121.2.20141216 ODAC RELEASE 3
2017-02-26 16:21:27.822678 TID:1   (CFG) (.NET)     TraceLevel : 7
2017-02-26 16:21:27.822678 TID:1   (CFG) (.NET)     TRANSPORT_CONNECT_TIMEOUT : 6
2017-02-26 16:21:27.822678 TID:1   (CFG) (.NET)     TRACE_FILE_CLIENT : client_trace.log
2017-02-26 16:21:27.822678 TID:1   (CFG) (.NET)     DIAG_ADR_ENABLED : OFF
2017-02-26 16:21:27.822678 TID:1   (CFG) (.NET)     TCP.CONNECT_TIMEOUT : 3
2017-02-26 16:21:27.822678 TID:1   (CFG) (.NET)     TRACE_DIRECTORY_CLIENT : C:\OracleTrace
2017-02-26 16:21:27.822678 TID:1   (CFG) (.NET)     TRACE_LEVEL_CLIENT : SUPPORT
2017-02-26 16:21:27.822678 TID:1   (CFG) (.NET)     SQLNET.AUTHENTICATION_SERVICES : (none)
2017-02-26 16:21:27.823679 TID:1   (CFG) (TNSNAMES) DBSVR : (DESCRIPTION =(RETRY_COUNT = 0)(LOAD_BALANCE = off)(FAILOVER = on)(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.11)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.11)(PORT = 1526)))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = DBSVR)(FAILOVER_MODE =(TYPE = select)(METHOD = basic))))
2017-02-26 16:21:27.826679 TID:1   (CFG) (SQLNET)   FilePath : C:\oracle\product\12.1.0\client_1\network\admin\sqlnet.ora
2017-02-26 16:21:27.826679 TID:1   (CFG) (TNSNAMES) FilePath : C:\oracle\product\12.1.0\client_1\network\admin\tnsnames.ora
2017-02-26 16:21:27.826679 TID:1   (PUB) (ENT) OracleConnection.ctor()
2017-02-26 16:21:27.829679 TID:1   (PRI) (ENT) (CP) ConnectionString.GetCS()
2017-02-26 16:21:27.831679 TID:1   (PRI) (ENT) (CP) ConnectionString.ctor()
2017-02-26 16:21:27.834679 TID:1   (PRI) (ENT) (CP) ConnectionString.Parse()
2017-02-26 16:21:27.837679 TID:1   (PRI) (ENT) (CP) ConnectionString.SetProperty()
2017-02-26 16:21:27.837679 TID:1   (PRI) (EXT) (CP) ConnectionString.SetProperty()
2017-02-26 16:21:27.837679 TID:1   (PRI) (ENT) (CP) ConnectionString.SetProperty()
2017-02-26 16:21:27.837679 TID:1   (PRI) (EXT) (CP) ConnectionString.SetProperty()
2017-02-26 16:21:27.837679 TID:1   (PRI) (ENT) (CP) ConnectionString.SetProperty()
2017-02-26 16:21:27.837679 TID:1   (PRI) (EXT) (CP) ConnectionString.SetProperty()
2017-02-26 16:21:27.837679 TID:1   (PRI) (ENT) (CP) ConnectionString.SetProperty()
2017-02-26 16:21:27.837679 TID:1   (PRI) (EXT) (CP) ConnectionString.SetProperty()
2017-02-26 16:21:27.837679 TID:1   (PRI) (EXT) (CP) ConnectionString.Parse()
2017-02-26 16:21:27.837679 TID:1   (PRI) (EXT) (CP) ConnectionString.ctor()
2017-02-26 16:21:27.837679 TID:1   (PRI) (EXT) (CP) ConnectionString.GetCS()
2017-02-26 16:21:27.838679 TID:1   (PUB) (EXT) OracleConnection.ctor()
2017-02-26 16:21:27.873681 TID:1   (PUB) (ENT) OracleConnection.Open() (conid=45028263) (state=Closed) (sessid=0) (implid=0) (pooling=T) (txnid=n/a)
2017-02-26 16:21:27.874681 TID:1   (PRI) (ENT) (CP) OracleConnectionDispenser`3..cctor()
2017-02-26 16:21:27.875681 TID:1   (PRI) (EXT) (CP) OracleConnectionDispenser`3..cctor()
2017-02-26 16:21:27.875681 TID:1   (PRI) (ENT) (CP) OracleConnectionDispenser`3.Get()
2017-02-26 16:21:27.876682 TID:1   (PRI) (ENT) (CP) PoolManager`3.ctor()
2017-02-26 16:21:27.877682 TID:1   (PRI) (EXT) (CP) PoolManager`3.ctor()
2017-02-26 16:21:27.878682 TID:1   (PRI) (ENT) (CP) PoolManager`3.Initialize() (constr=data source=dbsvr;user id=USR1;Connection Timeout=60;)
2017-02-26 16:21:27.878682 TID:1   (PRI) (ENT) (CP) ConnectionString.Secure()
2017-02-26 16:21:27.879682 TID:1   (PRI) (EXT) (CP) ConnectionString.Secure()
2017-02-26 16:21:27.882682 TID:1   (PRI) (EXT) (CP) PoolManager`3.Initialize() (pmid=56648283) (constr=data source=dbsvr;user id=USR1;Connection Timeout=60;)
2017-02-26 16:21:27.882682 TID:1   (PRI) (BUF) (OBP.CTOR) (poolid:40072506) (OracleConnectionDispenser`3.GetPM)
2017-02-26 16:21:27.884682 TID:1   (PRI) (ENT) (CP) OraclePoolManager.Get()
2017-02-26 16:21:27.887682 TID:1   (PRI) (ENT) (CP) PoolManager`3.Get() (txnid=n/a) (bForceMatch=F)
2017-02-26 16:21:27.889682 TID:1   (PRI) (ENT) (CP) PoolManager`3.CreateNewPR() (txnid=n/a)
2017-02-26 16:21:28.027690 TID:1   (PRI) (ENT) TimeStamp.GetLocalTZOffset()
2017-02-26 16:21:28.027690 TID:1   (PRI) (EXT) TimeStamp.GetLocalTZOffset()
2017-02-26 16:21:28.029690 TID:1   (PRI) (ENT) (CP) ConnectionString.GetStringFromSecureString()
2017-02-26 16:21:28.029690 TID:1   (PRI) (EXT) (CP) ConnectionString.GetStringFromSecureString()
2017-02-26 16:21:28.031690 TID:6   (PRI) (ENT) (CP) PoolManager`3.CreateNewPRThreadFunc()
2017-02-26 16:21:28.033691 TID:6   (PRI) (SVC) (ENT) OracleConnectionImpl.Connect() (oper=open) (aff=n/a) (inst=) (affmatch=n/a) (sessid=-1:-1) (F;F;F;;N) (pmid=56648283)
2017-02-26 16:21:28.034691 TID:6   (PRI) (BUF) (COBP.CTOR) (poolid:1) (parentpoolid:40072506) (OracleConnectionImpl.Connect)
2017-02-26 16:21:49.046892 TID:6   (PRI) (BUF) (ALLOCATION) (bufid:1)
4

1 回答 1

0

您提供了主池线程的跟踪。能否也提供连接建立线程的跟踪文件,让我们看看它挂在什么上面?

抱歉,我会把它作为评论而不是答案,但 SO 不会让我这样做。

注意,你是对的。ODP.Managed 不支持 (failover=)。ODP.Managed 仅支持故障转移(不支持 address_list 负载平衡),因此 address_list 的唯一目的是故障转移。

此外,ODP.Managed 还不支持重试(retry_count 和 retry_delay)。

于 2017-03-03T22:43:42.873 回答