Coskan’s Approach to Oracle

December 22, 2008

How to use “top” effectively on Linux as a DBA

Filed under: Linux, Tips — coskan @ 7:28 pm

I have been familiar with linux since 2000, when I was at second class of university, but I have never worked  on a  linux machine which was hosting primary production database.   The first OS  I used Oracle on, was IBM AIX then, I always worked on HP/UX with a Server management team  so, I never go that much deep for monitoring tools of Unix based systems, till last couple of weeks at which I started to study for managing oracle on linux exam.

Before studying, my   top command  usage was always like ,  run top / topas  command  then check the processes and quit the screen. I never asked myself, if I can do anything more. on top screen.  Another reason about this laziness, is that , I never liked the layout of manual pages. I always got bored in 5th second 🙂 . On the other hand, when you are studying something on linux, you have to leave all your boredom about man pages behind and start to read them completely.

After reading the manual, I discovered that top screen is very powerfull interactive tool  on which you can do many modifications by parameters like changing the default sort option filtering by users changing the layout refresh time.  You will find small tutorial about what you can do with top at the pages below.

1-Basic top screen

$ top

top

2- For changing the default layout press f or o in the top screen.  After you press you will see the screen below. Letter with star indicator  are the fields you can see on the default page.

top2

3- When you press any of the starred letter on keyboard their star will diseppear and letter will be lowercase this means you deselected them from fields. When you press any on the non starred letter a star will apper at each one of them and letter will be uppercase This means you selected them as field.

top3

After you change the fields top screen will be like below with UID SWAP PPID and CPU Time columns are added to fields

top4

4- If you want to filter the processes from oracle user only (which is the best option for me) press u to filter the screen and write the username / userid . To remove the filter just press enter after u.

top5

processes from oracle user only

top6

5- If you want only top 10 processes from oracle user just press n and enter 10. To revert back enter 0

top7n

Ta daaa you have top 10 oracle sessions  list on your top screen

top8n

6- To change the screen refreshment period press d and set the delay with seconds

top9s

7- To kill a session press k and give the PID of the session. top10k

After you entered the pid, It will ask you the signal with default of 15

top11k

9-  Suppose that you want to change the sort order. There are two ways to do it. First way is press F and set the sorting column from the next screen by pressing the column letter . Second way is using moving by < > keys when you are at the top screen. It can also sort to a field which is not shown on the screen.

top-sort

Now its all sorted bymemory usage  instead of CPU

topsort-mem

10- you can also press W and it will write your current configuration to the conf file to keep it for future usage as a default.

These are all I wanted to mention about interactive usage of TOP command as a DBA.

For more info about the top command just write man top on you command line 🙂

Wish you Happy Christmas  for all.

7 Comments »

  1. Thanks, it was a great reading.

    Comment by Nayyar Ahmad — March 5, 2009 @ 2:16 pm

  2. Thank you for the excellent notes on Top usage

    Comment by Vamshee — October 19, 2009 @ 7:48 pm

  3. I have been absent for some time, but now I remember why I used to love this web site. Thanks , I¡¦ll try and check back more often. How frequently you update your web site?

    Comment by Jamel Gunnell — April 24, 2011 @ 7:39 pm

  4. […] Use top Effectively […]

    Pingback by Random Links | Joe Martel — February 24, 2012 @ 1:58 am

  5. Can you give a tutorial on how to actually interpret what the TOP output actually means in terms of the resulting system performance?

    Comment by tom — October 21, 2012 @ 8:25 am

  6. I tend not to leave a comment, but I browsed a few responses
    oon this page How to use “top” effectively on Linux as a DBA | Coskan’s Approach to Oracle.
    I do have a couple of questions for you if you don’t mind.
    Is it only me or do a few of the comments look as if they are
    written by brain dead visitors? 😛 And, if you are posting oon other online sites, I would like to kdep up with everything
    fresh you have to post. Could you make a list
    of all of all your publc sites like your linkedin profile,
    Facebook page or twitter feed?

    Comment by Adalberto — August 6, 2014 @ 2:30 pm

  7. Very nice post. I just stumbled upln your blog and wished to say that I’ve truly enjoyed
    surfing around your blog posts. After all I’ll
    be subscribing to your rss feed and I hope you write again very soon!

    Comment by best porn movies — September 10, 2014 @ 7:57 am


RSS feed for comments on this post. TrackBack URI

Leave a comment

Create a free website or blog at WordPress.com.