Analyzes the detailed process of terminating Oracle with the kill command of UNIX.

Source: Internet
Author: User

In many cases, we need to terminate all Oracle processes ). When the database is "locked" and you cannot enter Server Manager to terminate the database, you can use the kill command in UNIX to terminate all Oracle processes. This is one of the common uses of the kill command.

To terminate an Oracle instance on a UNIX server, perform the following steps:

Terminate all Oracle processes related to ORACLE_SID.

Use the ipcs-pmb command to identify all occupied RAM memory fragments.

Use the ipcrm-m command to release the occupied RAM memory from UNIX.

For Non-AIX only: Use the ipcs-sa command to display the occupation mark, and use the ipcrm-s command to release the occupation mark of the instance.

It is very easy to create a single command to terminate the Oracle process related to the hung database instance. In the following example, we use the ps command to identify the Oracle process, and then use the awk program to obtain the process ID (PID) of the Oracle process ). Then, we enter the process ID in the kill command of UNIX.

Root> ps-ef | grep $ ORACLE_SID | grep-v grep | awk '{print $2}' | xargs-I kill-9 {}

After terminating all Oracle processes, we can use the ipcs-pmb command to check the occupied memory and clear the memory occupied by the database. We first show all memory usage on the database server:

Ipstatus from/dev/kmem as of Mon Sep 10 16:45:16 2001
T ID KEY MODE OWNER GROUP SEGSZ CPID LPID
Shared Memory:
M 24064 0x4cb0be18 -- rw-r ----- oracle dba 28975104 1836 23847
M 1 0x4e040002 -- rw-root 31008 572 572
M 2 0x411ca945 -- rw-root 8192 572 584
M 4611 0x0c6629c9 -- rw-r ----- root 7216716 1346
M 4 0x06347849 -- rw-root 77384 1346

Root> ipcs-pmb

Now, we can see that Oracle only has one RAM memory with ID = 24064. The following command releases the memory segment: root> ipcrm-m 24064

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.