How to handle HANG Databases

Source: Internet
Author: User

How to handle HANG Databases

1. Generate systemstate dump:
SQL> sqlplus-prelim/as sysdba
SQL> alter session set max_dump_file_size = unlimited;
SQL> alter session set events 'immediate trace name systemstate level 10 ';
Wait for some 30 seconds
SQL> alter session set events 'immediate trace name systemstate level 10 ';
Wait for some 30 seconds
SQL> alter session set events 'immediate trace name systemstate level 10;


2. Start a new SESSION:
SQL> sqlplus-prelim/as sysdba
SQL> oradebug setmypid
SQL> oradebug unlimit;
SQL> oradebug dump hanganalyze 3
Wait for 30 seconds
SQL> oradebug dump hanganalyze 3
Wait for 30 seconds
SQL> oradebug dump hanganalyze 3

Analyze the generated file.

Appendix: system state dump when connection to the instance is not possible
There are several ways of getting more information when connection to an instance is not possible by sqlplus. It is useful to collect as much information about a hang before clearing the instance.

1) Using OS debuggers like dbx or gdb.
For example:
$ Ps-ef | grep $ Oracle_SID # Use PID of any User Process instead of BG Process
$ Gdb $ ORACLE_HOME/bin/oracle <PID_from_earlier_step>
Print ksudss (10)
The systemstate dump will be in the bdump or udump depending on the PID chosen
2.) Using the new 10.1 sqlplus-prelim option.
For example:
Export ORACLE_SID = PROD # Replace PROD with the SID you want to trace
Sqlplus-prelim/as sysdba
Oradebug setmypid
Oradebug unlimit;
Oradebug dump systemstate 10
3.) Finally if either option (1) or (2) is not doable, please remember to take stacks of all the Oracle Background process using pstack or gdb
For example:
Script stack. log
Pstack <pid_of_pmon>
Pstack <pid_of_smon>
4.) Finally you may also want to collect some truss, tusc or strace of sqlplus
Note: The recommended systemstate level for 10g is 266

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.