Ora 01012 not logged on ошибка

Symptoms

You connect to an Oracle database by using the Microsoft OLE DB Provider for Oracle (MSDAORA), and then you end the connection on the server side. When you open a new connection to the Oracle database from your application, you receive the following exception error message:

System.Data.OleDb.OleDbException: Unspecified error
ORA-01012: not logged on

Cause

When you end the connection to the Oracle database on the server side while using MSDAORA, the broken connection is returned to the connection pool. The connection pooling code incorrectly interacts with the ResetConnection property of MSDAORA. When this property is not supported by the provider, the pooling code incorrectly interprets that the connection is reset, and that the connection is a valid one. When the client code opens a new connection, the broken connection that was returned to the connection pool may be retrieved. Therefore, you receive the error message that is mentioned in the «Symptoms» section.

Resolution

Hotfix information

A supported hotfix is now available from Microsoft. However, it is intended to correct only the problem that is described in this article. Apply it only to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next service pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Customer Support Services to obtain the hotfix. For a complete list of Microsoft Customer Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=supportNote In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

File information

The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.

Microsoft Data Access Components (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

This hotfix is available as part of a cumulative hotfix package. When you receive this hotfix from Microsoft Product Support Services, the article number that is listed in the hotfix package will be 839801 for MDAC 2.8 or 836799 for MDAC 2.7 SP1. For more information, see the following article in the Microsoft Knowledge Base:

MDAC 2.8

839801 FIX: Hotfixes are available for MDAC 2.8

MDAC 2.7 SP1

836799 FIX: Hotfixes are available for MDAC 2.7 Service Pack 1

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the «Applies to» section.

More Information

Steps to reproduce the behavior

  1. Start Microsoft Visual Studio .NET.

  2. On the File menu, point to
    New, and then click Project. The New Project dialog box appears.

  3. Under Project Types, click Visual Basic Projects, and then click Console Applicationunder Templates.

  4. In the Name box, type
    MyApp, and then click OK. By default, the Module1.vb file is created.

    If you are using Microsoft Visual C# .NET, the Class1.cs file is created.

  5. Add the following code at the top:

    Microsoft Visual Basic .NET code

    Imports System
    Imports System.Data.OleDb

    Visual C# .NET code

    using System.Data.OleDb;

  6. Add the following code to the Mainprocedure:

    Visual Basic .NET code

    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 code

    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();

    Note Modify the connection string according to your environment.

  7. On the Build menu, click Build Solution.

  8. On the Debug menu, click
    Start. You see that a command is displayed in the console window.

  9. In Oracle SQL*Plus, run the command that is displayed in the console window.

  10. Press ENTER. In the console window, you see the exception that is mentioned in the «Symptoms» section.

References

For more information about the Microsoft OLE DB Provider for Oracle, visit the following Microsoft Developer Network (MSDN) Web site:

http://msdn2.microsoft.com/en-us/library/ms810685.aspx For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

824684 Description of the standard terminology that is used to describe Microsoft software updates

The third-party products that this article discusses are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, regarding the performance or reliability of these products.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Problem Description
Users cant able to login to database server. Though it allow sysdba to login,
it does not allow to run any query. Sometimes it will show database is
connected to an idle instance. But when we startup database it shall throw
error ORA-01081: cannot start already-running ORACLE — shut it down first.

 $ sqlplus ‘/as sysdba’

SQL*Plus: Release 11.2.0.3.0 Production on Sat Oct 12 07:53:11 2013

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 — 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select instance_name,status from v$instance;
ERROR at line 1:
ORA-01012: not logged on

SQL> desc v$instance
ERROR:
ORA-01012: not logged on

SQL> startup
ORA-01012: not logged on

Changes
Oracle has been forcefully shutdown at OS level or crashed.

 CAUSE
An orphaned shared memory segment belonging to the ORACLE_SID still exists from
a previous instance startup.

The command
ps -ef | grep $ORACLE_SID

shows no processes but with ORACLE_SID set the Oracle ‘sysresv’ utility shows a
shared memory segment for a non-existing instance, e.g.

 $ sysresv

IPC Resources for ORACLE_SID «TEST» :

Shared Memory:
ID             
KEY
5963794         0x00000000
5996563         0x00000000
6029332         0xb2e3c9ac

Semaphores:
ID             
KEY
No semaphore resources used
Oracle Instance not alive for sid «TEST»

Solution
On OS level, remove the orphaned shared memory segment using:

ipcrm -m <problem shared memory id>

$ ipcrm -m 5963794
$ ipcrm -m 5996563
$ ipcrm -m 6029332

$sqlplus ‘/as sysdba’

Connected to an idle instance.

SQL> startup Oracle instance started
Total System Global Area   10689474560 bytes
Fixed
Size                    
2237776 bytes
Variable
Size              
6375344816 bytes
Database
Buffers           
4294967296 bytes
Redo Buffers                 
16924672 bytes
Oracle Instance Started.

Oracle Database Opened.

Problem:

When trying start the database you may get the error ORA-01012 not logged on.

$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Dec 11 07:21:30 2018

Copyright (c) 1982, 2011, Oracle. All rights reserved.

Connected.

SQL> startup

ORA-01012: not logged on

error ora 01012

Solution:

To resolve this error you need to remove the orphaned shared memory segment usingg sysresv utility. I was able to reolve the issue successfully with this approach.

$sysresv

sysresv command will list the currently allocated IPC resources for shared memory and then you can remove the shared memory segment using ipcrm -m command as you can see in the screenshor below. You can ignore the Semaphores.

sysresv solution ora 01012

Once done now you can start the database and it shoud start successfully.

databasestart

Kashif Baksh

Problem Description
Users cant able to login to database server. Though it allow sysdba to login, it does not allow to run any query. Sometimes it will show database is connected to an idle instance. But when we startup database it shall throw error ORA-01081: cannot start already-running .

[oracle@mezon01 ~]$ sqlplus sys/System_2018@IIRDB

SQL*Plus: Release 11.2.0.4.0 Production on Thu May 24 08:03:07 2018

Copyright (c) 1982, 2013, Oracle. All rights reserved.

ERROR:
ORA-12520: TNS:listener could not find available handler for requested type of
server

Enter user-name: sys
Enter password:
ERROR:
ORA-00020: maximum number of processes (1500) exceeded

Enter user-name:
ERROR:
ORA-01017: invalid username/password; logon denied

SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
[oracle@mezon01 ~]$ sqlplus -prelim “/as sysdba”

SQL*Plus: Release 11.2.0.4.0 Production on Thu May 24 08:04:06 2018

Copyright (c) 1982, 2013, Oracle. All rights reserved.

SQL> show parameter sga_t;
ORA-01012: not logged on
Process ID: 0
Session ID: 0 Serial number: 0

SQL> startup;
ORA-01012: not logged on
SQL> shutdown immediate;
ORA-01012: not logged on
SQL> show parameter sga_max;
ORA-01012: not logged on
Process ID: 0
Session ID: 0 Serial number: 0

SQL> EXİT
SP2-0042: unknown command “EXİT” – rest of line ignored.
SQL> exit
Disconnected from ORACLE
[oracle@mezon01 ~]$ ps -ef | grep IIRDB
oracle 6096 1 0 08:05 ? 00:00:00 ora_pmon_IIRDB
oracle 6098 1 0 08:05 ? 00:00:00 ora_psp0_IIRDB
oracle 6136 1 1 08:05 ? 00:00:01 ora_vktm_IIRDB
oracle 6140 1 0 08:05 ? 00:00:00 ora_gen0_IIRDB
oracle 6142 1 0 08:05 ? 00:00:00 ora_diag_IIRDB
oracle 6144 1 0 08:05 ? 00:00:00 ora_dbrm_IIRDB
oracle 6146 1 0 08:05 ? 00:00:00 ora_ping_IIRDB
oracle 6148 1 0 08:05 ? 00:00:00 ora_acms_IIRDB
oracle 6150 1 0 08:05 ? 00:00:00 ora_dia0_IIRDB
oracle 6152 1 0 08:05 ? 00:00:00 ora_lmon_IIRDB
oracle 6162 1 0 08:05 ? 00:00:00 ora_lmd0_IIRDB
oracle 6164 1 0 08:05 ? 00:00:00 ora_rms0_IIRDB
oracle 6166 1 0 08:05 ? 00:00:00 ora_lmhb_IIRDB
oracle 6172 1 4 08:05 ? 00:00:04 ora_mman_IIRDB
oracle 6174 1 0 08:05 ? 00:00:00 ora_dbw0_IIRDB
oracle 6176 1 0 08:05 ? 00:00:00 ora_dbw1_IIRDB
oracle 6178 1 0 08:05 ? 00:00:00 ora_dbw2_IIRDB
oracle 6180 1 0 08:05 ? 00:00:00 ora_dbw3_IIRDB
oracle 6182 1 0 08:05 ? 00:00:00 ora_lgwr_IIRDB
oracle 6184 1 0 08:05 ? 00:00:00 ora_ckpt_IIRDB
oracle 6186 1 0 08:05 ? 00:00:00 ora_smon_IIRDB
oracle 6188 1 0 08:05 ? 00:00:00 ora_reco_IIRDB
oracle 6190 1 0 08:05 ? 00:00:00 ora_rbal_IIRDB
oracle 6192 1 0 08:05 ? 00:00:00 ora_asmb_IIRDB
oracle 6194 1 0 08:05 ? 00:00:00 ora_mmon_IIRDB
oracle 6198 1 0 08:05 ? 00:00:00 ora_mmnl_IIRDB
oracle 6200 1 0 08:05 ? 00:00:00 ora_d000_IIRDB
oracle 6202 1 0 08:05 ? 00:00:00 ora_s000_IIRDB
oracle 6204 1 0 08:05 ? 00:00:00 ora_mark_IIRDB
oracle 6206 1 0 08:05 ? 00:00:00 ora_ocf0_IIRDB
oracle 6325 1 0 08:05 ? 00:00:00 ora_o000_IIRDB
oracle 10089 28710 0 08:07 pts/1 00:00:00 grep IIRDB
oracle 20902 25965 0 May23 ? 00:04:20 /oracle/product/11.2.0.4/db/jdk/bin/java -server -Xmx384M -XX:MaxPermSize=400M -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=40 -DORACLE_HOME=/oracle/product/11.2.0.4/db -Doracle.home=/oracle/product/11.2.0.4/db/oc4j -Doracle.oc4j.localhome=/oracle/product/11.2.0.4/db/mezon01_IIRDB/sysman -DEMSTATE=/oracle/product/11.2.0.4/db/mezon01_IIRDB -Doracle.j2ee.dont.use.memory.archive=true -Djava.protocol.handler.pkgs=HTTPClient -Doracle.security.jazn.config=/oracle/product/11.2.0.4/db/oc4j/j2ee/OC4J_DBConsole_mezon01_IIRDB/config/jazn.xml -Djava.security.policy=/oracle/product/11.2.0.4/db/oc4j/j2ee/OC4J_DBConsole_mezon01_IIRDB/config/java2.policy -Djavax.net.ssl.KeyStore=/oracle/product/11.2.0.4/db/sysman/config/OCMTrustedCerts.txt-Djava.security.properties=/oracle/product/11.2.0.4/db/oc4j/j2ee/home/config/jazn.security.props -DEMDROOT=/oracle/product/11.2.0.4/db/mezon01_IIRDB -Dsysman.md5password=true -Drepapi.oracle.home=/oracle/product/11.2.0.4/db -Ddisable.checkForUpdate=true -Doracle.sysman.ccr.ocmSDK.websvc.keystore=/oracle/product/11.2.0.4/db/jlib/emocmclnt.ks -Dice.pilots.html4.ignoreNonGenericFonts=true -Djava.awt.headless=true -jar /oracle/product/11.2.0.4/db/oc4j/j2ee/home/oc4j.jar -config /oracle/product/11.2.0.4/db/oc4j/j2ee/OC4J_DBConsole_mezon01_IIRDB/config/server.xml
oracle 25965 1 0 May23 ? 00:00:12 /oracle/product/11.2.0.4/db/perl/bin/perl /oracle/product/11.2.0.4/db/bin/emwd.pl dbconsole /oracle/product/11.2.0.4/db/mezon01_IIRDB/sysman/log/emdb.nohup

————————————————————————————————————————————-

[oracle@mezon01 ~]$ sysresv
IPC Resources for ORACLE_SID “IIRDB” :
Shared Memory:
ID KEY
100270098 0x00000000
100302867 0x00000000
100335643 0x14203f64
Semaphores:
ID KEY
136445992 0xf1e96e54
136478764 0xf1e96e55
136511533 0xf1e96e56
136544302 0xf1e96e57
136577071 0xf1e96e58
136609840 0xf1e96e59
136642609 0xf1e96e5a
136675378 0xf1e96e5b
136708147 0xf1e96e5c
Oracle Instance alive for sid “IIRDB”
[oracle@mezon01 ~]$ ipcrm -m 100270098
[oracle@mezon01 ~]$ ipcrm -m 100302867
[oracle@mezon01 ~]$ ipcrm -m 100335643
[oracle@mezon01 ~]$
[oracle@mezon01 ~]$
Changes
Oracle has been forcefully shutdown at OS level or crashed.

CAUSE
An orphaned shared memory segment belonging to the ORACLE_SID still exists from a previous instance startup.

The command
ps -ef | grep $ORACLE_SID

shows no processes but with ORACLE_SID set the Oracle ‘sysresv’ utility shows a shared memory segment for a non-existing instance, e.g.

$ sysresv

IPC Resources for ORACLE_SID “IIRDB” :

Shared Memory:
ID              KEY
100270098 0x00000000
100302867 0x00000000
100335643 0x14203f64

Semaphores:
ID              KEY
No semaphore resources used
Oracle Instance not alive for sid “IIRDB”

Solution
On OS level, remove the orphaned shared memory segment using:

ipcrm -m <problem shared memory id>

ipcrm -m 100270098
ipcrm -m 100302867
ipcrm -m 100335643

$sqlplus ‘/as sysdba’

Connected to an idle instance.

SQL> startup Oracle instance started
Total System Global Area   10689474560 bytes
Fixed Size                     2237776 bytes
Variable Size               6375344816 bytes
Database Buffers            4294967296 bytes
Redo Buffers                  16924672 bytes
Oracle Instance Started.
Oracle Database Opened.

█ 11.08.2007 12:35

Проблемка в следующем:

set nls_lang=american_america.ms8win1251
svrmgrl

SVRMGR> Connected.
SVRMGR> alter database backup controlfile to trace
*
ORA-01012: not logged on
SVRMGR>

вот собственно эта ORA-01012: not logged on возникает при любой команде

перезапуск всех сервисов не помог решить проблему, база переходит в статут OPEN без проблем из DBA.

помогите плиз.

█ 11.08.2007 12:59

connect internal/_пароь_sys_@_имя_базы_
STARTUP MOUNT

з.ы. поясни что с базой стряслось??? подохли контрольники??? историю в студию…

█ 11.08.2007 14:40

@имя базы не нужно. А вот посмотреть в алерт, почему база тебя отрубила — надо.

█ 11.08.2007 20:02

поскольку явно не указал SID думаю что имя базы не помешает …
вдруг несколько стоит.. скажем на тестовомрезервном серваке.. ))

█ 11.08.2007 22:03

Цитата:

baggio ➤ поскольку явно не указал SID думаю что имя базы не помешает …

Немного не точно выразился, я про то, что нужно указать %ORACLE_SID% и подключаться напрямую, без @

█ 13.08.2007 09:51

явно задавая set ORACLE_SID=xxx не решает проблемы. Ну а с база впринципе работает и запускаеться нормально (это тестовая база).

█ 13.08.2007 12:28

Цитата:

set nls_lang=american_america.ms8win1251

ох не нравится мне такое написание, это ты сюда с ошибкой написал или на самом деле выдаёшь такую команду?

█ 13.08.2007 13:04

написал с ошибкой, на самом деле
set nls_lang=american_america.cl8mswin1251

█ 15.08.2007 16:02

Цитата:

undos ➤ ORA-01012: not logged on

Такое бывает при переносе базы на другой комп или восстановлении из архива.

C:Documents and SettingsUser>set nls_lang=american
C:Documents and SettingsUser>svrmgrl
Oracle Server Manager Release 3.1.6.0.0 — Production
Copyright (c) 1997, 1999, Oracle Corporation. All Rights Reserved.
ORA-12560: TNS:protocol adapter error
SVRMGR> connect internal@OraBase
Password:
Connected.
SVRMGR> alter database backup controlfile to trace;
Statement processed.

мож поможет такой батничек
set base=OraBase [Твоей БД]
del D:ORACLEORA81DATABASEpwd%base%.ora
D:ORACLEORA81binorapwd.exe file=D:ORACLEORA81DATABASEpwd%base%.ora password=qqq

и перезапустить базу.

:/

Часовой пояс GMT +3, время: 03:16.

Форум на базе vBulletin®
Copyright © Jelsoft Enterprises Ltd.
В случае заимствования информации гипертекстовая индексируемая ссылка на Форум обязательна.

Возможно, вам также будет интересно:

  • Ora 00979 not a group by expression ошибка
  • Ora 00942 table or view does not exist ошибка
  • Ora 00918 column ambiguously defined ошибка
  • Ora 00911 invalid character ошибка
  • Ora 20999 описание ошибки

  • Понравилась статья? Поделить с друзьями:
    0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии