在客戶端開發了一個使用ODP.NET訪問Oracle 12c數據庫服務器的應用程序。我在客戶端和服務器上都有2個網絡適配器。服務器在不同端口上的兩個網絡導軌上偵聽。在多個IP地址上故障轉移
如果我從服務器端拉出網線,客戶端需要約21秒鐘才能故障轉移到其他網絡導軌,以便與數據庫交談。我如何加快速度?我已經使用TCP.CONNECT_TIMEOUT,TRANSPORT_CONNECT_TIMEOUT和CONNECTION_TIMEOUT,但似乎沒有適用。我在sqlnet.ora和應用程序級別都應用了TCP.CONNECT_TIMEOUT,但沒有任何效果。 TNSPING和sqlplus工作正常,並根據指定的超時進行故障切換。
它真的好像OPD.NET不尊重描述部分中的很多東西。出於好奇,我測試過其他的東西,比如把FAILOVER =關閉,它仍然會故障結束。我還將描述部分放置在「數據源」標籤下的連接字符串中。依然沒有。 ODP.NET中有錯誤嗎?
請幫忙。 -David
客戶:
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)
它看起來像你使用託管ODP.NET?如果是這樣,首先要做的是確保TNSNAMES.ORA和SQLNET.ORA正在被拾取。我首先將這些文件移動到與.EXE相同的目錄中,從任何配置文件中刪除TNS_ADMIN,然後重新啓動應用程序以查看是否有幫助。接下來,我會升級到最新的託管ODP.NET,因爲您使用的版本已經進行了許多與網絡相關的增強功能。 –
感謝Christian給出的建議。我檢查過並確實有最新版本。所有的ora文件都是通過測試其他設置來獲取的,但僅僅爲了好玩,我沒有將文件移動到exe文件所在的本地文件夾中,但無濟於事......仍在撓頭...... – dave
您的跟蹤文件表明您正在使用ODAC Rel 3 。請升級到ODAC版本4.您可以從nuget獲得最新的ODP.NET管理:https://www.nuget.org/packages/Oracle.ManagedDataAccess/ –