Recently I faced one issue where all the connection to database hung and it was also not possible to login to database using “/ as sysdba”.
To get access of sqlplus I used the following syntax:
$ sqlplus -prelim / as sysdba
With “prelim” option we can run some commands which will help in collection useful information about the problem.
This will work only in Oracle 10g and higher version.
After successfully getting connected run the following commands to generate Hanganalyze and systemstate traces:
SQL> oradebug setmypid
SQL> oradebug unlimit
SQL> oradebug dump systemstate 266
SQL> oradebug tracefile_name
— This will give you the name of the tracefile generated.
SQL > oradebug dump hanganalyze 2
SQL > oradebug tracefile_name
To analyze these trace files one should be aware of Metalink Note: 215858.1.
After analyzing these files I found that following event was active and causing the hang:
<span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: small;">"resmgr:cpu quantum" Cmd: PL/SQL Execute
It means that the sessions are waiting for their turn on CPU.
This event occurs when resource manage is active and controls the allocation of CPU to processes.
We can also see the command which is causing all this: i.e some PL/SQL code was executing and spnning on for CPU.
After finding out this, checked with “TOP” command, got the PID of the process consuming all the cpu and killed that process with “kill -9”
After killing that process the users were able to connect.
So the cause of the Hang was found i.e PL/SQL, but it is still unknown why PL/SQL caused problems. 🙂