Terminate process

We have a system user "oracle_usr" always run some process in the system , but sometimes , these processes will not stop automatically until we terminate the process , can suggest the method how to terminate the process that is run by "oracle_usr" and run over 10 minutes ? thx

if this really happens all the time, you should consider writing a script to automate this process for you. But if it does not happen all that often, you can use the following interactive procedure (which could also be a basis for a script).

In a shell, run ps --user=oracle_usr --format=pid,user,comm,etime --sort etime
This will return all of the active processes owned by oracle_usr, sorting them by how long they have been running for (in [[dd-]hh:]mm:ss format). This elapsed time will be the last column in the table returned to you. The first column with be the PID (process id) of each process. Record the PID's of the proccesses with elapsed times of over 10 minutes (or whatever time you want). Then using the PID of each process, you can send it a signal to terminate it properly. But you should read the Oracle documentation to understand what would be the most appropriate signal to use.
Speaking in generic terms, you can terminate a process by sending it a TERM or KILL signal. E.g., for each process that you want to kill, you could try kill -TERM <PID>, and if that does't work, kill -KILL <PID> . By the way, to use kill on a process, you have to own it (i.e., here be oracle_usr) or be a privelaged user.

thx reply , but I have no experience to write a script to do that , could you provide some help . thx a lot

Well if you are running Oracle on *nix, you probably should have someone around who knows shell scripting quite well, because an Oracle system is heavy and not so easy to maintain properly.
If you want to learn shell scripting, there are many books and tutorlals on the web. One book that is highly regarded by many is UNIX Shell Programming, by Stephen Kochan.

Here is the script you asked for. I presume that only one program hangs; thus you don't want to kill all processes owned by oracle_usr, but only those that are the program that hangs. You have to figure out what program that is. (You can use ps -U oracle_usr to list the user's processes.)
Copy and past the script below into an editor, and you can change $2 to the name of the command that hangs (you don't need ot include the argument, if any, but just the command itself). You should also change $1 to "oracle_usr", and change the signal as apropriate (READ THE ORACLE DOCS!!).
(The script as it is now lets the user specifiy the user and the command to kill when invoking the script. But if it is alsways oracle_usr and the program that hangs, this is not necessary; just specify these by editing the script as I just told you).
When you are done editing the script, save it as a file, and make it executable with chmod +x <FILENAME>. Then you can invoke it from the command line as root or as oracle_usr.

#!/bin/sh

## script to kill each process of a particular command name
## of a particular user, if that process is over 10 minutes old

## in this line, please replace "$1" with "oracle_user"
user="$1"

## please replace "$2" with name of program that you want to kill
command="$2"   

## please read Oracle documentation to ascertain which signal
## is appropriate to terminate this process. Then you can replace TERM
## here with the appropriate signal if necessary
signal=TERM

# get PID's of processes to kill, then kill them with specified signal
ps -U "$user" -o comm,etime,pid | awk -v com="$command" '$1 == com && $2 ~ /:[0-9][0-9]:[0-9][0-9]|[1-9][0-9]:[0-9][0-9]/ { print $3 }' | while read pid
do
   echo killing process $pid ...
   kill -$signal $pid
done

I think you had better get a better understanding of scripting and especially ORACLE itself before you progress much further.

I am not convinced that you should go around simply killing ORACLE processes. You may be doing some harm to your installation or data by doing so, because the kill may not be allowing the process to terminate (tidy up) properly.

Just a cautionary note!

MBB