联系:手机/微信(+86 17813235971) QQ(107644445)
作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]
oracle 也推出来了数据库的top命令,叫做oratap,是使用c语言写的,目前只支持linux x86与x64的11gR2与12cR1
使用说明
[oracle@xifenfei tmp]$ ./oratap -h oratop: Release 13.2.4 Usage: oratop [ [Options] [Logon] ] Logon: {username[/password][@connect_identifier] | / } [AS {SYSDBA|SYSOPER}] Options: -i : Interval Delay (requires value in seconds, default: 3s) -f : Long format for header & section 4 (default: 80 column) -r : IORL mode for Section 2 (default is IOPS) -d : Real-Time Top 5 Wait Events (default: Cumulative) -m : MODULE/ACTION mode for Section 4 (default: USER/PROGRAM_NAME) -b : Batch mode -n : maximum number of iterations (requires number) -h : Help
使用说明
1. Log in to the system as the Oracle RDBMS software installation owner
2. Stage the oratop executable on the server on which the tool will be executed. On a RAC system it is only necessary to stage the executable on one node as it is RAC aware.
3. Change the name of the executable, eg.
$ mv oratop* oratop
4. Validate the permissions for oratop are 755 (-rwxr-xr-x). If the permissions are not currently set to 755, set the permissions on oratop as follows:
$ chmod 755 oratop
5. Configure the execution environment as follows (if not already set accordingly)
$ export TERM=xterm #or vt100 $ export ORACLE_HOME=<11.2 database home> $ export LD_LIBRARY_PATH=$ORACLE_HOME/lib $ export PATH=$ORACLE_HOME/bin:$PATH $ export ORACLE_SID=<local 11.2 database SID to be monitored> #only needed if connecting to a local database
6. Invoke the tool to monitor a local database as follows (interval can be any interval in seconds):
$ ./oratop -i 10 / as sysdba
7. Non-dba privileged user requires specific grants to use the tool. See User Guide for grants required.
8. Databases can be monitored remotely using a tns alias as described in the oratop Users Guide .
$ ./oratop -i 10 username/password@tns_alias $ ./oratop -i 10 system/manager@tns_alias
9. To exit the program simply press the keyboard key “q”. To abort, CTRL-C.
Troubleshooting:
If you receive an error similar to
./oratop: error while loading shared libraries: libclntsh.so.11.1: cannot open shared object file: No such file or directory that is an indication that libclntsh.so.11.1 was not found in the path defined in LD_LIBRARY_PATH similar to
$ export LD_LIBRARY_PATH=$ORACLE_HOME/lib (ie., the location of libclntsh.so.11.1)
使用效果
[oracle@xifenfei tmp]$ ./oratap -i 10 chf/xifenfei@ora11g_p oratop: Release 13.2.4 Production on Mon Aug 26 03:10:17 2013 Copyright (c) 2011, Oracle. All rights reserved. Processing ... oratop 1: 148 ora1 03:10:13 up 3.3m, 1 ins, 301M mt, 3 sn, 1 us, 6% db ID %CU HLD MBPS IOPS %FR PGAU ASC ASI ASW ASP AAS USN TPS UCPS SSRT DBC DBW 1 0 0 0 1 5 133M 1 0 0 0 0.1 3 0 2 0u 0 0 EVENT (Cumulative) TOT WAITS TIME(s) AVG_MS PCT WAIT_CLASS DB CPU 218 68 control file parallel write 5535 30 5.5 9 System I/O db file sequential read 10080 27 2.7 8 User I/O os thread startup 198 25 124.9 8 Concurrency db file async I/O submit 2575 21 8.0 7 System I/O ID SID SPID USR PROG PGA OPN SQLID/BLOCKER E/T STATUS STE WAIT_EVENT W/T 1 148 8254 CHF DEDI 2M SEL 4agz3g5aajkdc 0 ACTIVE CPU wa for cpu 0u
参考文档:
oratop – utility for near real-time monitoring of databases, RAC and Single Instance (Doc ID 1500864.1)