Kh?c ph?c: B?n nh?n ?c m?t thng bo l?i "ORA-01012" khi b?n k?t n?i ?n m?t c s? d? li?u Oracle b?ng cch s? d?ng MSDAORA

D?ch tiu ? D?ch tiu ?
ID c?a bi: 834905
Ch ?
Hotfix ny c s?n nh l m?t ph?n c?a m?t gi tch l?y hotfix. Khi b?n nh?n ?c hotfix ny t? d?ch v? h? tr? c?a Microsoft s?n ph?m, s? bi vi?t ?c li?t k trong gi hotfix s? l 839801 cho MDAC 2.8 ho?c 836799 cho MDAC 2,7 SP1. ? bi?t thm chi ti?t, xem bi vi?t sau trong c s? ki?n th?c Microsoft:

MDAC 2,8
839801 Kh?c ph?c: Hotfixes c s?n cho MDAC 2,8
MDAC 2,7 SP1
836799 Kh?c ph?c: Hotfixes c s?n cho MDAC 2,7 Service Pack 1
Bung t?t c? | Thu g?n t?t c?

? Trang ny

TRI?U CH?NG

B?n k?t n?i vo m?t c s? d? li?u Oracle b?ng cch s? d?ng Microsoft OLE Nh cung c?p DB Oracle (MSDAORA), v sau b?n ng?t k?t n?i trn my ch? bn. Khi b?n m? m?t k?t n?i m?i c s? d? li?u Oracle t? c?a b?n ?ng d?ng, b?n nh?n ?c thng bo l?i ngo?i l? sau y:
System.Data.OleDb.OleDbException: L?i khng xc ?nh
ORA-01012: khng ng nh?p

NGUYN NHN

Khi b?n ng?t k?t n?i c s? d? li?u Oracle trn cc pha my ch? trong khi s? d?ng MSDAORA, k?t n?i h?ng l quay tr? l?i cc k?t n?i h? bi. K?t n?i t?ng h?p m? khng chnh xc tng tc v?i cc ResetConnection ti s?n c?a MSDAORA. Khi thu?c tnh ny khng ?c h? tr? b?i cc nh cung c?p, pooling m? khng chnh xc d?ch r?ng k?t n?i ?c ?t l?i, v k?t n?i l m?t trong nh?ng h?p l?. Khi khch hng m? s? m? ra m?t m?i k?t n?i, k?t n?i b? h?ng quay tr? l?i h? bi k?t n?i c th? truy xu?t ?c. V? v?y, b?n nh?n ?c thng bo l?i ?c ? c?p trong cc "Tri?u ch?ng" ph?n.

GI?I PHP

Thng tin hotfix

M?t hotfix ?c h? tr? l by gi? c s?n t? Microsoft. Tuy nhin, n l nh?m kh?c ph?c ch? s? c? ?c m t? trong bi vi?t ny. N ch? p d?ng cho h? th?ng ang g?p v?n ? c? th? ny. Hotfix ny c th? nh?n ?c th? nghi?m b? sung. V? v?y, n?u b?n khng b? ?nh h?ng b?i v?n ? ny, chng ti ? ngh? b?n ?i cho gi d?ch v? ti?p theo c ch?a hotfix ny.

? gi?i quy?t v?n ? ny ngay l?p t?c, lin h? v?i d?ch v? h? tr? khch hng Microsoft ? c ?c cc hotfix. ?i v?i m?t danh sch ?y ? cc d?ch v? h? tr? Microsoft khch hng s? i?n tho?i v thng tin v? chi ph h? tr?, gh thm Web site sau c?a Microsoft:
http://support.Microsoft.com/contactus/?WS=support
Lu ? Trong tr?ng h?p ?c bi?t, chi ph m th?ng ph?i gnh ch?u cho cc cu?c g?i h? tr? c th? ?c h?y b? n?u chuyn vin h? tr? Microsoft xc ?nh r?ng m?t C?p Nh?t c? th? s? gi?i quy?t v?n ? c?a b?n. Cc chi ph h? tr? thng th?ng s? p d?ng ? h? tr? thm cu h?i v v?n ? ny khng ? i?u ki?n cho cc C?p Nh?t c? th? trong cu h?i.

Thng tin v? t?p

Phin b?n ti?ng Anh c?a hotfix ny c cc thu?c tnh t?p (ho?c sau ny t?p tin thu?c tnh) m ?c li?t k trong b?ng sau. Ngy thng v th?i gian cho nh?ng t?p tin ?c li?t k trong gi? ph?i h?p qu?c t? (UTC). Khi b?n xem chi tiet tap tin, n ?c chuy?n ?i thnh gi? c?c b?. ? bi?t s? khc nhau gi?a UTC v local time, s? d?ng cc Mi gi? th? cng c? ngy v gi? trong Pa-nen i?u khi?n.
Cc thnh ph?n d? li?u Microsoft Access (MDAC) 2.8
   Date         Time   Version         Size     File name
   ---------------------------------------------------------
   10-Mar-2004  04:22  2.80.1036.0     225,280  Msdaora.dll
   10-Mar-2004  04:22  2000.85.1036.0   24,576  Odbcbcp.dll
   10-Mar-2004  04:21  2.80.1036.0     442,368  Oledb32.dll
   10-Mar-2004  04:21  2000.85.1036.0  401,408  Sqlsrv32.dll
MDAC 2,7 Service Pack 1
   Date         Time   Version         Size     File name
   ---------------------------------------------------------
   10-Mar-2004  02:19  2000.81.9046.0   61,440  Dbnetlib.dll
   10-Mar-2004  02:20  2.71.9046.0     221,184  Msdaora.dll
   10-Mar-2004  02:15  2.71.9046.0     126,976  Msdart.dll
   10-Mar-2004  02:15  3.520.9046.0    204,800  Odbc32.dll
   10-Mar-2004  02:20  2000.81.9046.0   24,576  Odbcbcp.dll
   10-Mar-2004  02:20  3.520.9046.0     98,304  Odbccp32.dll
   10-Mar-2004  02:16  2.71.9046.0     417,792  Oledb32.dll
   10-Mar-2004  02:19  2000.81.9046.0  471,040  Sqloledb.dll
   10-Mar-2004  02:19  2000.81.9046.0  385,024  Sqlsrv32.dll

T?NH TR?NG

Microsoft ? xc nh?n r?ng y l m?t v?n ? trong cc s?n ph?m c?a Microsoft ?c li?t k trong ph?n "p d?ng cho".

THNG TIN THM

Cc b?c ? t?o l?i hnh vi

  1. B?t ?u Microsoft Visual Studio.NET.
  2. Trn cc T?p tin tr?nh n, i?m ?nM?i, sau b?m D? n. Cc M?i D? n h?p tho?i s? xu?t hi?n.
  3. D?i Cc lo?i d? n, b?m Th? gic Cc d? n c b?n, sau b?m Giao di?n i?u khi?n ?ng d?ngd?i M?u.
  4. Trong cc Tn h?p, lo?iMyApp, sau b?m Ok. Theo m?c ?nh, cc t?p tin Module1.vb ?c t?o ra.

    N?u b?n ang s? d?ng Microsoft Visual C# .NET, cc t?p tin Class1.cs ?c t?o ra.
  5. Thm m? sau ? ?u trang:

    Microsoft Visual Basic.NET m?
    Imports System
    Imports System.Data.OleDb
    Visual C#.NET m?
    using System.Data.OleDb;
  6. Thm m? sau y ? cc Chnhth? t?c:

    Visual Basic.NET m?
    Dim cn As OleDbConnection
    Dim cmd As OleDbCommand
    Dim r As OleDbDataReader
    Dim sid As String
    Dim orlcmd As String
    Dim connString As String = "Provider=MSDAORA;DataSource=<data source>;User ID=<user name>;Password=<password>;"
    Try
        'Create a new connection to the Oracle database by using MSDAORA.
        cn = New OleDbConnection
        cn.ConnectionString = connString
        cn.Open()
        cmd = New OleDbCommand
        cmd.CommandText = "SELECT SID , SERIAL# FROM V$SESSION WHERE SID = (SELECT SID FROM V$MYSTAT WHERE ROWNUM=1)"
        cmd.Connection = cn
        r = cmd.ExecuteReader()
        sid = ""
        If (r.Read()) Then
            sid = r.GetValue(0).ToString() + "," + r.GetValue(1).ToString()
        End If
        orlcmd = "Alter System Kill Session '" + sid + "' Immediate;"
        Console.WriteLine("Open the SQL Plus window, run the following command, and then press ENTER:")
        Console.WriteLine(orlcmd)
        Console.ReadLine()
        r.Close()
        cmd.CommandText = "SELECT count(*) from TAB"
        Try
            'Expecting this command to fail because connection has been killed
            r = cmd.ExecuteReader()
        Catch orlex As OleDbException
            Console.WriteLine(orlex.Message)
            cmd.Dispose()
            'Close the bad connection.
            cn.Close()
            System.Threading.Thread.Sleep(1000)
            cn.ConnectionString = connString
            cn.Open()
            cmd = New OleDbCommand
            cmd.CommandText = "SELECT count(*) FROM TAB"
            cmd.Connection = cn
            'This command will fail, but it will work when a new connection is used.
            r = cmd.ExecuteReader()
            If (r.Read()) Then
                Console.WriteLine(r.GetValue(0))
            End If
       End Try
    Catch ex As OleDbException
       Console.WriteLine(ex.ToString())
    End Try
    Console.WriteLine("Press ENTER to exit...")
    Console.ReadLine()
    
    Visual C#.NET m?
    OleDbConnection cn;
    OleDbCommand cmd;
    OleDbDataReader r;
    String sid;
    String orlcmd;
    String connString="Provider=MSDAORA;DataSource=<data source>;User ID=<user name>;Password=<password>;";
    try
    {
        //Create a connection to the Oracle database by using MSDAORA.
        cn= new OleDbConnection();
        cn.ConnectionString=connString;
        cn.Open();
        cmd=new OleDbCommand();
        cmd.CommandText="SELECT SID , SERIAL# FROM V$SESSION WHERE SID = (SELECT SID FROM V$MYSTAT WHERE ROWNUM=1)";
        cmd.Connection=cn;
        r=cmd.ExecuteReader();
        sid="";
        if(r.Read())
        {
           sid=r.GetValue(0).ToString()+","+r.GetValue(1).ToString();
        }
        orlcmd="Alter System Kill Session '"+sid+"' Immediate;";
        Console.WriteLine("Open the SQL Plus window, run the following command, and then press ENTER:");
        Console.WriteLine(orlcmd);
        Console.ReadLine();
        r.Close();
        cmd.CommandText="SELECT count(*) from TAB";
        try
        {
            //Expecting this to fail because the connection is killed.
            r=cmd.ExecuteReader();
        }
        catch(OleDbException orlex)
        {
            Console.WriteLine(orlex.Message);
            cmd.Dispose();
            //Close the bad connection.
            cn.Close();
            System.Threading.Thread.Sleep(1000);
            cn.ConnectionString=connString;
            cn.Open();
            cmd=new OleDbCommand();
            cmd.CommandText="SELECT count(*) FROM TAB";
            cmd.Connection=cn;
            //This command will fail, but it will work when a new connection is used.
            r=cmd.ExecuteReader();
            if(r.Read())
            {
               Console.WriteLine(r.GetValue(0).ToString());
            }
        }
    }
    catch(OleDbException ex)
    {
        Console.WriteLine(ex.ToString());
    }
    Console.WriteLine("Press ENTER to exit...");
    Console.ReadLine();
    
    Lu ? S?a ?i cc chu?i k?t n?i theo i?u c?a b?n mi tr?ng.
  7. Trn cc Xy d?ng tr?nh n, nh?p vo Xy d?ng Gi?i php.
  8. Trn cc G? l?i tr?nh n, nh?p voB?t ?u. B?n th?y r?ng m?t l?nh ?c trng by t?i bn i?u khi?n c?a s?.
  9. Trong Oracle SQL * Plus, ch?y l?nh s? ?c hi?n th? trong c?a s? giao di?n i?u khi?n.
  10. Nhn ENTER. Trong c?a s? giao di?n i?u khi?n, b?n nh?n th?y ngo?i l? ? c?p ?n trong ph?n "Tri?u ch?ng".

THAM KH?O

? bi?t thm v? nh?ng Microsoft OLE DB Provider for Oracle, gh thm Web site sau c?a Microsoft Developer Network (MSDN):
http://msdn2.Microsoft.com/en-US/Library/ms810685.aspx
Cho thng tin b? sung, b?m s? bi vi?t sau y ? xem bi vi?t trong Microsoft Knowledge Base:
824684M ta thut ng chun c s dung m ta cac ban cp nht phn mm cua Microsoft
S?n ph?m c?a bn th? ba r?ng y bi th?o lu?n v? ?c s?n xu?t b?i cc cng ty ?c l?p Microsoft. Microsoft a ra khng c b?o hnh, ng? ? hay cch khc, lin quan ?n cc hi?u su?t ho?c ? tin c?y c?a cc s?n ph?m ny.

Thu?c tnh

ID c?a bi: 834905 - L?n xem xt sau cng: 12 Thang Chin 2011 - Xem xt l?i: 3.0
T? kha:
kbhotfixserver kbqfe kbbug kbprovider kbconnectivity kbdatabase kboracle kbfix kbmt KB834905 KbMtvi
My d?ch
QUAN TRONG: Bi vi?t ny ?c d?ch b?ng ph?n m?m d?ch my c?a Microsoft ch? khng ph?i do con ng?i d?ch. Microsoft cung c?p cc bi vi?t do con ng?i d?ch v c? cc bi vi?t do my d?ch ? b?n c th? truy c?p vo t?t c? cc bi vi?t trong C s? Ki?n th?c c?a chng ti b?ng ngn ng? c?a b?n. Tuy nhin, bi vi?t do my d?ch khng ph?i lc no c?ng hon h?o. Lo?i bi vi?t ny c th? ch?a cc sai st v? t? v?ng, c php ho?c ng? php, gi?ng nh m?t ng?i n?c ngoi c th? m?c sai st khi ni ngn ng? c?a b?n. Microsoft khng ch?u trch nhi?m v? b?t k? s? thi?u chnh xc, sai st ho?c thi?t h?i no do vi?c d?ch sai n?i dung ho?c do ho?t ?ng s? d?ng c?a khch hng gy ra. Microsoft c?ng th?ng xuyn c?p nh?t ph?n m?m d?ch my ny.
Nh?p chu?t vo y ? xem b?n ti?ng Anh c?a bi vi?t ny:834905

Cung cp Phan hi

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com