First step, to find out the list of active processes on the server, just run the command
$ ps -ef
You will see a big list of processes. Just limit the list to only related to oracle database by issuing the following command
$ ps -ef |grep "ora_"
The above command will remove all but the Oracle background processes since the oracle background process always start with 'ora_".
You will again note that the output includes the process thats running the grep command. Now pipe the output to "grep -v grep" to exclude that process. Now the command becomes
$ ps -ef |grep "ora_" |grep -v grep
grep -v option excludes the required string.
Still, we have filter out processes which is related only to a particular SID. Now append this filter like the following,
$ ps -ef |grep "ora_" |grep -v grep | grep $ORACLE_SID
2) Kill active processes running on the server
To kill background Unix process, use the 'kill' command. The syntax of using this command is as follows,
$ kill -9 PID1 PID2 PID3
The "-9" directs unix to kill the process immediately.
3) Finding Strings
Use the find command to find any matching strings in any files. For e.g. if you want to search for 'ServerAdmin' , then issue the command as follows,
$ find . -print |xargs grep -i ServerAdmin
-i option is used for 'ignore case'
4)Monitor Execution of a Process
Since most of the oracle processes are written to a logfile, the process can be monitored by using the following command,
$ tail -f opmn.log
5) Process Management
If you want to display top CPU consumers on a server, just issue the command,
$ ps -ef | sort +6| tail
Or
$ ps -ef | sort +7| tail
Since the Unix sort command sorts it according in ascending order, the process which consumes most CPU will be at the end of the list.
6) Get Active Oracle Dedicated Connections
$ ps -ef | grep -v grep|grep $ORACLE_SID|grep -v "ora_"|wc -l
In the above command, grep -v "ora_" excludes all the background oracle processes.
No comments:
Post a Comment