Search This Blog

Showing posts with label Error. Show all posts
Showing posts with label Error. Show all posts

Tuesday, July 6, 2010

Oracle error: ORA-02392: exceeded session limit on CPU usage, you are being logged off

This error occurs when during your Session with Oracle Database Server, you are performing lots of operations which consumes more and more of CPU time on the Oracle Database server, which exceeded the CPU_PER_SESSION setting/value (total CPU time in hundreds of seconds) of Profile your UserID has been assigned.

You can check this value for your UserID/Profile, by running query:
Select * From User_Resource_Limits

You may contact your DB Administrator and ask them to set CPU_PER_SESSION to UNLIMITED to resolve this issue. The Default Profile on Oracle DB has this value set to UNLIMITED already. So, you also have an option to set your UserID to Default Profile.

If your Organization does not allow you to set CPU_PER_SESSION setting/value to UNLIMITED, then you have a workaround. This is for .NET, but it shouldn't be hard to implement in any other programming language.

CODE:
try
{
    // Your code
}
catch (Exception dbExc)
{
    // Oracle: exceeded session limit on CPU usage, you are being logged off
     if (dbExc.Message.Contains("ORA-02392"))
     {
        System.Threading.Thread.Sleep(30000);
        }
        else
        throw dbExc;
}


Basically what you will be doing here is to Catch the Exception, identify it to confirm that it is the error about exceeded CPU usage, then put the current Thread to Sleep for say 30 seconds and then continue with your process flow. It will reconnect to the Oracle database and will work fine.Make sure that in your code you are checking the Connection state before executing your SQL. If the Connection is closed after returning from the Catch block, then just Open it and continue.

Wednesday, June 30, 2010

Toad error - Can't initialize OCI. Error -1

While fixing this error the first thing to check is that you have all correct Registry values for your Oracle Home, as well as the Oracle installation folder and the BIN subfolder paths should be present in the PATH environment variable.

Here's one more reason why this error occurs in Toad. It is when you have more than one Oracle Client installed on your machine. Even when you select the correct Oracle Home in "Connect Using" field of Toad Login screen, you still get this error. So, to resolve this you need to go to the installation folder of that Oracle Home (e.g. C:\Oracle\ora92\), then go to the BIN subfolder and open Oracle.Key in Notepad. Confirm that it is showing Registry entry/path to the correct Oracle Home (e.g. SOFTWARE\ORACLE\HOME0 or SOFTWARE\ORACLE\HOME1 or whatever your Oracle Home is).