使用oracle的osw工具,可以对系统的CPU和内存,磁盘等进行图形化的展示,对于把握和了解整体的资源使用情况,具有直观的效果。OS
1. 概述
--------------
使用Oracle的osw工具,可以对系统的CPU和内存,磁盘等进行图形化的展示,对于把握和了解整体的资源使用情况,具有直观的效果。
OSW工具由一系列shell脚本构成,
OSWatcher.sh是主调程序,派生出许多单个的shell进程,使用unix的操作系统诊断工具,来收集特定类型的数据
OSW调用特定的操作系统工具,每个工具作为一个特定的后台进程,进行数据收集。
一般而言支持下述工具:
ps
top
mpstat
iostat
netstat
traceroute
vmstat
输出结果可以进行图形化的展示,当然,也可以使用shell脚本对收集的archive信息进行处理。
--------------
2. 支持平台
--------------
OSW可以运行于下述平台之上:
AIX
Tru64
Solaris
HP-UX
Linux
这个工具要去METLINKE上下载 不过可以到LinuxIDC.COM的ftp资源上下载
下载在Linux公社的1号FTP服务器里,,下载地址:
FTP地址:ftp://www.linuxidc.com
用户名:
密码:
在 2012年LinuxIDC.com\9月\Oracle OS Watcher 安装与错误处理
下载方法见
这个工具可以在Oracle用户下安装,不必要在root下
Oracle] tar -xvf osw301.tar
>cd osw
4. 启动与停止
--------------
./startOSW.sh 60 10
./stopOSW.sh
nohup ./startOSW.sh 60 10 &
60:数据收集的间隔,以秒为单位
10: 数据收集多长时间,以小时为单位
5. 图形化输出展示
[oracle@node1 osw]$ java -jar oswg.jar -i archive/
Warning: -jar not understood. Ignoring.
Exception in thread "main" java.lang.NoClassDefFoundError: oswg.jar
at gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.5.0.0)
at _Jv_ThreadRun(java.lang.Thread) (/usr/lib/libgcj.so.5.0.0)
at _Jv_RunMain(java.lang.Class, byte const, int, byte const, boolean) (/usr/lib/libgcj.so.5.0.0)
at __gcj_personality_v0 (/opt/oracle/database/admin/dbsrcipt/osw/java.version=1.4.2)
at __libc_start_main (/lib/tls/libc-2.3.4.so)
at _Jv_RegisterClasses (/opt/oracle/database/admin/dbsrcipt/osw/java.version=1.4.2)
先要检查JAVA版本
# java -version
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2)
Classic VM (build 1.4.2, J2RE 1.4.2 IBM AIX build ca142-20050609 (JIT enabled: jitc))
[oracle@node11g ~]$ which java
/usr/bin/java
----10g运行前执行:
[oracle@node10g ~]$ export PATH=$ORACLE_HOME/jre/1.4.2/bin:$PATH
----11g运行前执行:
[oracle@node11g ~]$ export PATH=$ORACLE_HOME/jdk/jre/bin:$PATH
[oracle@node1 osw]$ java -jar oswg.jar -iarchive/
Starting OSWg V3.0.1
OSWatcher Graph Written by Oracle Centerof Expertise
Copyright (c) 2008 by Oracle Corporation
Parsing Data. Please Wait...
Parsing file node1_vmstat_12.09.28.1100.dat...
Invalid data found on line 8
Parsing file node1_vmstat_12.09.28.1700.dat...
Parsing Completed.
Enter 1 to Display CPU Process Queue Graphs
Enter 2 to Display CPU Utilization Graphs
Enter 3 to Display CPU Other Graphs
Enter 4 to Display Memory Graphs
Enter 6 to Generate All CPU Gif Files
Enter 7 to Generate All Memory Gif Files
Enter L to Specify Alternate Location ofGif Directory
Enter T to Specify Different Time Scale
Enter D to Return to Default Time Scale
Enter R to Remove Currently DisplayedGraphs
Enter P to Generate A Profile
Enter Q to Quit Program
Please Select an Option:6
Xlib: connection to ":0.0"refused by server
Xlib: No protocol specified
Exception in thread "main"java.lang.InternalError: Can't connect to X11 window server using ':0.0' as thevalue of the DISPLAY variable.
at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at sun.awt.X11GraphicsEnvironment.
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(UnknownSource)
at java.awt.Window.init(Unknown Source)
at java.awt.Window.
at java.awt.Frame.
at java.awt.Frame.
at OSWGraph.GraphObject.graphMetric(GraphObject.java:145)
at OSWGraph.OSWGraph.main(OSWGraph.java:616)
编辑环境变量
[root@node1 ~]# vi /home/oracle/.bash_profile
export DISPLAY=192.168.30.42:0.0 --指客户端IP
[root@node1 ~]# source /home/oracle/.bash_profile
[root@node1 ~]# su - oracle
[oracle@node1 osw]$ java -jar oswg.jar -iarchive/
Starting OSWg V3.0.1
OSWatcher Graph Written by Oracle Centerof Expertise
Copyright (c) 2008 by Oracle Corporation
Parsing Data. Please Wait...
Parsing file node1_vmstat_12.09.28.1100.dat...
Invalid data found on line 8
Parsing file node1_vmstat_12.09.28.1700.dat...
Parsing Completed.
--输入参数 分别输出不同类型的GIF
Enter 1 to Display CPU Process Queue Graphs
Enter 2 to Display CPU Utilization Graphs
Enter 3 to Display CPU Other Graphs
Enter 4 to Display Memory Graphs
Enter 6 to Generate All CPU Gif Files
Enter 7 to Generate All Memory Gif Files
Enter L to Specify Alternate Location ofGif Directory
Enter T to Specify Different Time Scale
Enter D to Return to Default Time Scale
Enter R to Remove Currently DisplayedGraphs
Enter P to Generate A Profile
Enter Q to Quit Program
Please Select an Option:6
Generating filegif/Sep28171028_1348827319/OSWg_OS_Run_Queue.gif
Generating filegif/Sep28171028_1348827319/OSWg_OS_Block_Queue.gif
Generating filegif/Sep28171028_1348827319/OSWg_OS_Cpu_Idle.gif
Generating filegif/Sep28171028_1348827319/OSWg_OS_Cpu_System.gif
Generating filegif/Sep28171028_1348827319/OSWg_OS_Cpu_User.gif
Generating filegif/Sep28171028_1348827319/OSWg_OS_Cpu_Interrupts.gif
Generating filegif/Sep28171028_1348827319/OSWg_OS_Context_Switches.gif
在GIF目录下生成了GIF图形 要拖到WINDOWS来看
Enter 1 to Display CPU Process Queue Graphs
Enter 2 to Display CPU Utilization Graphs
Enter 3 to Display CPU Other Graphs
Enter 4 to Display Memory Graphs
Enter 6 to Generate All CPU Gif Files
Enter 7 to Generate All Memory Gif Files
Enter L to Specify Alternate Location ofGif Directory
Enter T to Specify Different Time Scale
Enter D to Return to Default Time Scale
Enter R to Remove Currently DisplayedGraphs
Enter P to Generate A Profile
Enter Q to Quit Program

InnoDB uses redologs and undologs to ensure data consistency and reliability. 1.redologs record data page modification to ensure crash recovery and transaction persistence. 2.undologs records the original data value and supports transaction rollback and MVCC.

Key metrics for EXPLAIN commands include type, key, rows, and Extra. 1) The type reflects the access type of the query. The higher the value, the higher the efficiency, such as const is better than ALL. 2) The key displays the index used, and NULL indicates no index. 3) rows estimates the number of scanned rows, affecting query performance. 4) Extra provides additional information, such as Usingfilesort prompts that it needs to be optimized.

Usingtemporary indicates that the need to create temporary tables in MySQL queries, which are commonly found in ORDERBY using DISTINCT, GROUPBY, or non-indexed columns. You can avoid the occurrence of indexes and rewrite queries and improve query performance. Specifically, when Usingtemporary appears in EXPLAIN output, it means that MySQL needs to create temporary tables to handle queries. This usually occurs when: 1) deduplication or grouping when using DISTINCT or GROUPBY; 2) sort when ORDERBY contains non-index columns; 3) use complex subquery or join operations. Optimization methods include: 1) ORDERBY and GROUPB

MySQL/InnoDB supports four transaction isolation levels: ReadUncommitted, ReadCommitted, RepeatableRead and Serializable. 1.ReadUncommitted allows reading of uncommitted data, which may cause dirty reading. 2. ReadCommitted avoids dirty reading, but non-repeatable reading may occur. 3.RepeatableRead is the default level, avoiding dirty reading and non-repeatable reading, but phantom reading may occur. 4. Serializable avoids all concurrency problems but reduces concurrency. Choosing the appropriate isolation level requires balancing data consistency and performance requirements.

MySQL is suitable for web applications and content management systems and is popular for its open source, high performance and ease of use. 1) Compared with PostgreSQL, MySQL performs better in simple queries and high concurrent read operations. 2) Compared with Oracle, MySQL is more popular among small and medium-sized enterprises because of its open source and low cost. 3) Compared with Microsoft SQL Server, MySQL is more suitable for cross-platform applications. 4) Unlike MongoDB, MySQL is more suitable for structured data and transaction processing.

MySQL index cardinality has a significant impact on query performance: 1. High cardinality index can more effectively narrow the data range and improve query efficiency; 2. Low cardinality index may lead to full table scanning and reduce query performance; 3. In joint index, high cardinality sequences should be placed in front to optimize query.

The MySQL learning path includes basic knowledge, core concepts, usage examples, and optimization techniques. 1) Understand basic concepts such as tables, rows, columns, and SQL queries. 2) Learn the definition, working principles and advantages of MySQL. 3) Master basic CRUD operations and advanced usage, such as indexes and stored procedures. 4) Familiar with common error debugging and performance optimization suggestions, such as rational use of indexes and optimization queries. Through these steps, you will have a full grasp of the use and optimization of MySQL.

MySQL's real-world applications include basic database design and complex query optimization. 1) Basic usage: used to store and manage user data, such as inserting, querying, updating and deleting user information. 2) Advanced usage: Handle complex business logic, such as order and inventory management of e-commerce platforms. 3) Performance optimization: Improve performance by rationally using indexes, partition tables and query caches.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment