简介
oratop是采用类似top命令的方式实时监控oracle数据库,包括rac和non-rac数据库。它不需要安装在被监控的数据库服务器上,只要有oracle的客户端就行了,可以采用类似sqlplus的方式连接被监控的数据库。
运行
显示帮助信息
$ ./oratop.RDBMS_11.2_LINUX.X64 -h oratop: Release 14.1.2 Usage: oratop [ [Options] [Logon] ] Logon: {username[/password][@connect_identifier] | / } [AS {SYSDBA|SYSOPER}] connect_identifier: o Net Service Name, (TNS) or o Easy Connect (host[:port]/[service_name]) Options: -d : real-time (RT) wait events, section 3 (default is Cumulative) -k : FILE#:BLOCK#, section 4 lt is (EVENT/LATCH) -m : MODULE/ACTION, section 4 (default is USERNAME/PROGRAM) -s : SQL mode, section 4 (default is process mode) -c : database service mode (default is connect string) -f : detailed format, 132 columns (default: standard, 80 columns) -b : batch mode (default is text-based user interface) -n : maximum number of iterations (requires number) -i : interval delay, requires value in seconds (default: 5s) -v : oratop release version number -h : this help
这些option都有两种方式进行运行,一种是启动时运行,另一种方法是在oratop运行中敲击相应的键使之生效。
设置环境并运行
$ export ORACLE_HOME=<path> $ export LD_LIBRARY_PATH=$ORACLE_HOME/lib $ export PATH=$ORACLE_HOME/bin:$PATH ./oratop.RDBMS_11.2_LINUX.X64 sys/dingjia@192.168.87.205/orcl as sysdba
选项
在运行中输入h,可以显示下面的内容:
oratop: Release 14.1.2 Interactive Keys: [default] d : toggle between [Cumulative (C)] & Real-Time (RT) (section 3) k : toggle between [EVENT/LATCH] & object FILE#:BLOCK# (proc section 4) m : Toggle between [USERNAME/PROGRAM] & MODULE/ACTION (proc section 4) s : switch to SQL mode (section 4) f : toggle between [standard] & detailed format (long) p : switch to [process] mode (section 4) t : tablespace information a : ASM diskgroup information x : basic SQL plan table (requires sql_id input) i : refresh interval, requires value in seconds [5s] q : quit/ exit program (also, { Q | Esc | function keys }) Abbreviations: [N/B]: count(N)/ Byte(B) - (k)illo, (M)ega, (G)iga, (T)erra, [PEZY] [T] : Time - (u)micro, (m)illi, (s)econd, (h)our, (d)ay, (y)ear [m/s]: stats interval size, (m) 1 minute, (s) 15s, else, Real Time [c] : database service centric Acronym Help Menu: Section 1 - DATABASE .. [1] Section 2 - INSTANCE .. [2] Section 3 - DB WAIT EVENTS .. [3] Section 4 - PROCESS .. [4] Quit Help .. (q|Q) Section 1 - database Global Database information Version : Oracle major version db name : db_unique_name time [s]: time as of the most recent stats (hh24:mi:ss) up [T]: database uptime ins [N]: total number of instance(s) sn [c,N]: total user sessions (active/inactive) us [c,N]: number of distinct users mt [s,N]: global database memory total (sga+pga) % db [s,N]: database time as %(dbtime/cpu) (red if > 99%) Enter selection Number:
很有用的选项的x,t,a(显示asm的磁盘信息)
dataguard中的ar表示apply rate很有用。
使用-b(batch)方式可以输出到文件:
[oracle@rhel69 oratop]$ ./oratop.RDBMS_11.2_LINUX.X64 -bn1 sys/dingjia as sysdba Cycle 1 - oratop: Release 14.1.2 Production on Wed Mar 18 20:00:54 2020 Oracle 11g - orc 20:00:54 up: 8.4d, 1 ins, 0 sn, 0 us, 841M mt, 0.1% db ID %CPU LOAD %DCU AAS ASC ASI ASW AST IOPS %FR PGA UTPS UCPS SSRT %DBT ------------------------------------------------------------------------------- 1 0 0 0 0 0 0 0 0 3 12 92M 1 0 184u 100 EVENT (C) TOT WAITS TIME(s) AVG_MS PCT WAIT_CLASS ------------------------------------------------------------------------------- DB CPU 1804 49 control file parallel write 259524 659 2.5 18 System I/O control file sequential read 575086 491 0.9 13 System I/O os thread startup 28364 489 17.3 13 Concurrency log file parallel write 139777 244 1.8 7 System I/O ID SID SPID USR PROG S PGA SQLID/BLOCKER OPN E/T STA STE EVENT/*LA W/T ------------------------------------------------------------------------------- 1 70 22975 SYS orat D 4.0M 7qj5jsdnpsn1a SEL 0 ACT CPU cpu runqu 1u