For system-level monitoring for, top command is a practical and efficient Swiss Army knife. Compared vmstat, sar, it provides real-time process information to monitor performance, troubleshoot problems, is very efficient. And it provides an interactive command mode, flexible combination of the output results.
If the database exists in the system cpu or excessive use of memory, or high IO wait, you can quickly locate a command to the system through the top process information, and then a mapping from system-level and database-level process to obtain database-level process to locate possible problems.
top command is a command personally preferences, generally summed up under some of the more useful features.
First briefly explain some of the content under the top command.
The first row shows the system load level, load average has three outputs, representing in the last 1 minute, 5 minutes, 15 minutes load average, you can see the current system there is no pressure. Uptime command output and this part is the same.
Line 2 shows some information about the process in general, the total number of the current process, which processes are running, what sleep, waiting status. 27758 is the process can be seen running state, because subscript bright process list if "S" corresponds to a value R represents a running, if S was sleeping.
Line 3 shows some of the cpu load information, this feature is also a more practical top command. Especially% id and% wa these two indicators is particularly important, many performance problems, if the% id too low,% wa very low, indicating cpu usage is high, there may be some sql statements consume a lot of cpu resources If% wa very high, it is likely to be a problem with the system IO. In the conventional system upgrade, if the 10% found% wa too, it shows very high IO wait, dd, etc. can do a simple test.
Row 4 shows the number of memory usage. If memory usage obvious exception, you can find% MEM process by consuming a relatively high standard in light of process information.
Line 5 shows some cases swap, if enough memory or system load is not high, no major changes in the data section.
Enter the top, then directly enter B in the screen, it will turn on or off the table important figures in bold, if you are careful comparison will find that there are indeed some data is made bold display, so the problem is also more convenient for you investigation.
Top -c or direct input (input top, then directly enter the screen c) the name of the command will switch the display to complete the process or command line input.
28751 process you can see the process corresponding to the command line input
If you want to customize the display output order top command, such as the default in the order pid, user to display process information, if you want based on user, pid to display, you can use the c option
Enter the top, and then enter o on the display screen will pop up an interactive interface. I would like to show the column USER, then enter E, and then press Enter, the results have been rearranged.
Order of the columns displayed on the corresponding adjusted modified.
Output or more of the top command can be used to make flexible flip, after all, a lot of the number of processes, some processes information in one screen also displays less, you can flip around to see.
Enter the top, and then enter directly on the screen can show the tab of the information process.
-F Or O options
As needed on a column to sort, the default sort is% CPU
Enter the top, and then enter the F or O on the output screen, select the appropriate column to sort, such as our sort of PPID.
The output results are as follows, for some may be called by the recursive problem can use this method to troubleshoot.
This option for some troubleshooting performance issues is even more powerful, for example, we just look at what processes are running the state, which does not need to see a sleep state, you can use the -i option.
Enter the top -i or enter the top, then i entered directly on the screen, it will show those who are running the process.
If you want to display the results can be more clear, you can use the -z option to switch the color mode or monochrome mode
Then enter the top of the screen will show the total input i relatively clear process information, according to their own needs to decide whether to enable.
If you just want to view a user's process information, you can use the u option.
The output is more clear, just show ora11g process.
-d option or s
Because the output of the top command is dynamic, it will be an average of once every 3 seconds to refresh, if you want to adjust the refresh frequency, you can use the d or s option.
Enter the top, and then enter d or s, you can set your own refresh rate.