I. Question proposal
In many cases, we quickly kill some sessions of oralcle for the following reasons:
1. In some cases, due to the large data volume and large transaction volume, shutdown immediate takes a lot of time, but we want to use the shutdown immediate method, and we need to quickly shut down the database.
2. Our applications may use session control, which controls the number of connections of some users at the application level. But sometimes the network may be transient disconnected, resulting in some dead processes, whose status is inactive. When we use alter system kill session 'sid, serial # 'to clear the session, the status of these sessions becomes killed, and these sessions are cleared slowly by the pmon process, and you are just an impatient temper.
3. The system suddenly slows down. You find that a session is strange and you want to quickly end it.
Ii. Handling Methods
In fact, the solution is very simple. It is called "murder" by some people. Because a session corresponds to a process in the operating system, we do not use alter system kill session instead, when the background process of the session is killed, it will prompt the lazy pmon process to quickly clean up.
1. Use a session as an example,
A. Find the session you want to kill and write down paddr.
B. Find the spid corresponding to this session.
C. Kill the process identified by the spid.
If yourOracleIt is on UNIX platform and can be killed.
$ Killed 13824
If yourOracleIt is on the mongown platform. There are some differences, because mongown uses thead to replace process. The SID and spid values need to be used, and the commands used are also replaced by kill with orakill, format: orakill Sid spid
C:/> orakill 941 13824
D. Check v $ session again to see if the session is absent.
2. How can we kill all Oracle user processes?
A. In a Windows environment, execute the SQL statement as shown in, and save the result as a. BAT file, such as kill. bat. Execute kill. bat.
B. the Unix environment is much simpler. Execute the following command.
$ PS-Ef | grep $ oracle_sid | grep-V ora _ | grep local = No | awk '{print $2}' | xargs kill
Then you can shut down immediate quickly.