您好我在數據庫重新啓動後登記到分佈式事務有問題。無法在數據庫重啓後登記分佈式事務
我的環境:
- 的Windows 7 64位與SP1
- Oracle數據庫11g Express Edition的
- ODP.NET 4.112.3.0
我的程序:
const string connectionString = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=LOCALHOST)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=XE)));User Id=system;Password=sasa;";
static void Main(string[] args)
{
using (TransactionScope scope = new TransactionScope())
{
while (true)
{
using (OracleConnection connection = new OracleConnection(connectionString))
{
try
{
connection.Open();
Console.WriteLine("Connection opened");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
Thread.Sleep(1000);
}
}
}
所有作品在應用後都很棒開始。當我開始停止數據庫時,我得到NRE和一些異常告訴我數據庫關閉正在進行中。再次啓動後,我收到錯誤 - 無法登記分佈式事務。打開的連接不再打印。
輸出:
Connection opened
Connection opened
Connection opened
Connection opened
Connection opened
-- here I'm stopping database
ORA-12518: TNS:listener could not hand off client connection
ORA-12528: TNS:listener: all appropriate instances are blocking new connections
-- here database is stopped I suppose
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
-- here I'm starting database again
ORA-12528: TNS:listener: all appropriate instances are blocking new connections
ORA-1033: ORACLE initialization or shutdown in progress
Unable to enlist in a distributed transaction
Unable to enlist in a distributed transaction
Unable to enlist in a distributed transaction
Unable to enlist in a distributed transaction
Unable to enlist in a distributed transaction
...
- 什麼是行爲的原因是什麼?
- 如何診斷髮生了什麼?
你說「之後」 - 這是否意味着它最終有效?數據庫是在windows還是linux/unix上運行? – 2013-02-20 22:06:06
客戶端和服務器都運行在同一臺計算機上 - Windows 7 x64,並且所有工作都很好,直到服務器服務重新啓動 – 2013-02-21 09:36:38
它在什麼時候工作很好?重啓後?過了一段時間?另外,打印整個異常(Console.WriteLine(ex.ToString()))。內部異常中可能會有其他數據。 – 2013-02-21 12:47:06