[Oracle] End the outstanding Oracle process with orakill

xiaoxiao2021-03-11  185

[Oracle] Oracle process with OraKill end of out of control: Builder.com 2005-01-07 11:36 AM

A user process occasionally hangs or occupies too much resource to reject other sessions. If DBA is still able to access the database, she can usually issue the following query:

Select S.Username, S. OSuser, S.SID, S.Serial #, P.SPID from V $ Session S, V $ Process P where spaddr = p.addr and s.username is not null;

This query will return to the database username, the operating system username, the session ID, the serial number, and the system process ID (SPID). Then, the DBA user can issue the following command (using the SID and Serial # information returned earlier):

Alter System Kill Session 'SID, Serial #'; ALTER System Kill Session '9, 203';

There are two problems with this statement. First, any lock or resource assigned to this process will not be released before the session is completely timeout. Second, query and kill commands need to access the database. If a loses control, the database access may have problems.

In a UNIX database, the next step is the positioning process in the UNIX prompt output from the PS command (also finding an ID of OSUSER and SPID) and then ends the outdoor background process of the Lower-9 SPID. However, in Windows, there is only one process Oracle.exe, and the user connection is processed in the Windows thread without being processed in the process. If you use the Windows Task Manager to end the Oracle thread, you may affect all users and background threads, and cause the database to crash.

For these reasons, Oracle provides an ORAKILL.EXE command in the Oracle Home / Bin directory, the parameters of this command are the same as the ALTER System Kill Session, but the database connection is not required. To locate a specific thread, you need to find a program that can display all threads belonging to a process. Windows Task Manager can only display threads and processes. You need to find a tool program for Windows 2000 and NT from Microsoft's Resource Toolkit, such as free QuickSlice, or QSLICE.exe (this tool is Windows), or Pstat (PStat.exe is a command line tool ). Simply enter the thread ID after the ORAKILL command (in decimal representation) and SID:

ORAKILL Orakill Orcl 2760

"Kill of Thread ID 2760 in Instance ORCL SUCCESSFULLY SIGNALLED [SIC]."

ORAKILL should only be used without accessing the database to execute the ALTER SYSTEM KILL SESSION. If an unwanted background process is completed, such as PMON, it is likely to cause the database to crash. Novice never do this.

-------------------------------------------------- ------------------------------ author: Scott Stephens has been working for more than 13 years at Oracle, he was in technical support, E-commerce, market and software development and other departments work. For more schera skills for Scott Stephens, please visit our Oracle dev tips library. Tot: http://www.zdnet.com.cn/developer/Database/story/0,380006906,39265609,00.htm

转载请注明原文地址:https://www.9cbs.com/read-128966.html

New Post(0)