c 语言写的高级Oracle®数据库调优及监控工具

http://www.lab128.com.cn/lab128_why.html

 

 

###另外一款ORALCE Monitor tool freee

 

https://www.myorasql.com/

需要注意的是 执行时候需要 ojdbc6.jar或者ojdbc5.jar copy ( $ORACLE_HOME下有)到这个执行文件的目录 。就可以了 。

 

展示如下 : 

https://www.myorasql.com/screenshots.html

 

 

####more info about db monitor

 

https://dba.stackexchange.com/questions/7430/tools-to-monitor-oracle-database-performance-on-standard-edition
###############0   (notest)

W-ASH is free, works on Standard Edition as well as Enterprise (i.e. it doesn't need Oracle's v$active_session_history) and runs in a web browser window.

http://www.oraclerealworld.com/web-ash-w-ash/

monitor

I'm the creator of W-ASH. I'm also the principal designer of Enterprise Managers performance screens. The "Top Activity" screen has been called the "Kyle Screen". I designed Embarcadero's DB Optimizer with similar interface and I've advised on Lab128 for free just because I think it's a super cool tool. I worked at Quest and tried to gear Spotlight more like Top Activity but Quest disagreed, so I went to Oracle and created Top Activity. I also have a free tool in TCL/TK called ASHMON

 

###########1  (no free) 

MindArray IPM by MindArray Systems

Pros:

Response time analysis

Server Based

RAC support

Free Version for basic info

Allows a specific time range selection

Easy To Use

Cons:

Not a Open Source  


##################2    (OK  test )

https://sourceforge.net/p/ashv/code/HEAD/tree/trunk/ashv/
ASHViewer is a free alternative. Description from the readme:

ASH Viewer provides graphical Top Activity, similar Top Activity analysis and Drilldown of Oracle Enterprise Manager performance page. ASH Viewer store ASH data locally using embedded database Oracle Berkeley DB Java Edition.

ASHViewer Screenshot

It may seem that an application called ASH Viewer wouldn't work with Standard Edition because it does not have the Diagnostic pack and therefore does not have v$Active_Session_History, but it does. When a new connection is created it asks whether the target is Standard Edition or Enterprise Edition. If Standard Edition is selected it does not use v$Active_Session_History. This can be demonstrated by querying the view with control_management_pack_access set to NONE, which among other things causes the view to return no records.

Pros:

Free
Allows a specific time range selection (OEM can't do this)
Cons:

Not server based (Statistics collection is repeated for each user)
No web interface
Requires the equivalent of System level privileges
Interface isn't very polished (Font stretching, OS integration, etc.)
Not RAC aware (must run separately for each instance)

-> Only pl/sql unit no details sql .


--install guide

Running ASH Viewer
----------------
1) Unpack the archive, eg:
unzip ashv-<<version>>-bin.zip

2) A directory called "ashv-<<version>>-bin" will be created.

3) Download JDBC driver ojdbc14.jar/ ojdbc6.jar from http://otn.oracle.com and put it to ashv-<<version>>-bin/lib directory.

4) Make sure JAVA_HOME is set to the location of your JDK,
see run.cmd/run.sh (on Windows/Unix platform).

5) Run run.cmd/run.sh (on Window/Unix).

 

##########2   (NO free)

 

Ignite by Confio Softwar.e From their website:

Ignite for Oracle is the one Oracle database performance monitoring solution that identifies, analyzes and resolves all of the performance problems affecting applications and users depending on an Oracle database.

Ignite doesn’t just show health metrics, it correlates the most important performance data to build a complete picture of Oracle database performance for the DBA, Developer and DBA manager. Response time, queries, sessions and server resources, are all analyzed by Ignite Performance Intelligence to show both historical and real-time conditions affecting database applications.

enter image description here

Pros:

Response Time Analysis
Agentless
Server Based
Web interface
Free Version for basic info
Can be RAC and/or VMWare aware
Cons:

Drilldowns not as in depth as OEM
Users must be maintained independently
Cost
shareimprove th

 


#########5
http://datavirtualizer.com/web-ash-w-ash/    (已经测试,保留7天的数据,linux 部署,定时清理,并且github 提交了2份branch 查看历史数据 )

(调试过程 https://i.cnblogs.com/posts/edit;postId=12981149)


Web ASH : W-ASH
February 23rd, 2014Goto commentsLeave a comment


I’m excited about the ease of creating rich user applications that are web enabled given the state of technology now. JavaScript and JQuery have gone from being disdained as “not a very serious” language to moving towards the limelight of front and center.

Here is a small example.

Download the following file: W-ASH (web enabled ASH, file is wash.tar.gz )

Source is also on github at https://github.com/khailey/wash

Go to your apache web server root, in my case on redhat Linux is

# cd /usr/local/apache2
# gzip -d wash.tar.gz
# tar xvf wash.tar
-rwxr-xr-x 21956 14:08:21 cash.sh
-rw-r--r-- 30881 11:52:10 htdocs/ash.html
drwxr-xr-x 0 15:40:52 htdocs/js/
-rwxr-xr-x 10958 14:04:42 cgi-bin/json_ash.sh
(the directory htdocs/js has a number of files put into it from Highcharts. I edited them out to make the output cleaner)

There are 3 basic files

cash.sh – collect ASH like data from Oracle into a flat file, it runs in a continual loop
ash.html – basic web page using Highcharts
json_ash.sh – cgi to read ASH like data and give it to the web page via JSON
Now you are almost ready to go. You just need to start the data collection with “cash.sh” (collect ASH)

./cash.sh
Usage: usage <username> <password> <host> [sid] [port]
The script “cash.sh” requires “sqlplus” be in the path and that is all. It’s probably easiest to

move/copy cash.sh to an ORACLE_HOME/bin
su oracle
kick it off as in:
nohup cash.sh system change_on_install 172.16.100.250 orcl &
The script “cash.sh” will create a directory in /tmp/MONITOR/day_of_the_week for each day of the week, clearing out any old files, so there are only maximum 7 days of data. (to stop the collection run “rm /tmp/MONITOR/clean/*end” )

To view the data go to your web server address and add “ash.html?q=machine:sid”
For example my web server is on 172.16.100.250
The database I am monitoring is on host 172.16.100.250 with Oracle SID “orcl”

http://172.16.100.250/ash.html?q=172.16.100.250:orcl

 

 

See video at : http://screencast.com/t/sZrFxZkTrmn

 

############7   ( test , no history data )

http://datavirtualizer.com/ash-masters/ashmon/


Unzip ashmon.zip

Run ashmon.bat with ashmon\bin\ as the starting directory

Login as “system” , or user with select any dictionary priviledge, your connect id has to be in tnsnames.ora

Supports 10g or 11can run on earlier versions of Oracle with S-ASH repository S-ASH but need to create some veiws on SASH as well as wait groups

 

Notices

  • 10.1 ASHMON gets errors because v$active_session_history is missing wait_class. workaround
  • if copying ashmon.bat to your desktop or elsewhere, use a “shortcut” instead of moving the file. The file needs to be located in ashmon/bin
  • only connect to Oracle 10g or 11 unless you have set up the S-ASH repository
  • only connect as system or someone who has select on v$ tables unless you have set up the S-ASH repository. script to grant select on v$ views or grant “SELECT_CATALOG_ROLE” to the user.
  • All connect errors return “invalid username/password” in Oratcl, thus to debug connection problems you need to test with sqlplus. If sqlplus connects, then the monitor will connect with the same connection string ie username, password and tnsnames.ora entry
  • ashmon will use the tnsnames.ora located in ORACLE_HOME found in the PATH variable on windows. IE if sqlplus executes C:\oracle\bin\sqlplus then ashmon will use C:\oracle\network\admin\tnsnames.ora
  • ashmon comes with a default oracle client libraries and will use these if it does not find Oracle already installed on the PC, and will use ashmon/oracle/network/admin/tnsnames.ora for tns alias lookups

 

############## more info:

 

http://datavirtualizer.com/best-oracle-performance-tools/

 


Sorry, http://rammpeter.github.io/panorama.html is the right link   ( use , for history data analyst ) 

download:
https://www.dropbox.com/s/dwrks48qymlurd3/Panorama.war?dl=0

installer:

How to run it?

Start running quickly  need java 7 version or higher 

  • Download file Panorama.war
  • Open a terminal window, navigate to the directory containing Panorama.war and type
    java -jar Panorama.war
  • or 
  •    set PANORAMA_VAR_HOME=d:\tmp
  • java -Djava.io.tmpdir=C:\TEMP -jar Panorama.war
  • 
    no matter if your are running Windows, Linux or Mac-OS
  • This starts the embedded Jetty application server within one or two minutes, accessible at port 8080 via 
    http://<your server ip>:8080
  • Now you can connect to Panorama's login screen in your browser via 
    http://<your server ip>:8080/Panorama

 https://github.com/rammpeter/Panorama/issues/1

 

 

Panorama: User is enabled to add personal SQL to dragnet list

 
 
 
In menu ‘Spec. additions’ / ‘Dragnet investigation’ now you have the opportunity to add your own personal SQL-statements to the predefined list of dragnet SQLs.

This SQLs are stored at Panorama’s server instance and are available for your personal browser instance only.

Choose ‘Add personal selection’ from menu ‘≡’ and customize the JSON template for your purpose.

You will get a new menu ‘Personal extensions’ in your list of SQLs then.


If you want to persist this SQLs and provide them to all users of your Panorama instance, you can store them as JSON-array in a file ‘predefined_dragnet_selections.json’ stored at PANORAMA_VAR_HOME.
The content of file ‘predefined_dragnet_selections.json’ is shown in list of dragnet SQLs if it exists in   PANORAMA_VAR_HOME directory.

Click here to show all opportunities for your personal or global extensions to dragnet list.

 

-> In menu ‘Spec. additions’ / ‘Dragnet investigation’ 
########sapmple 0 one instance level need add \ before ", to esacape "
{
name: "Select tablespace_v1",
desc: "Select tablespace_v1",
sql: "SELECT a.tablespace_name ,b.maxbytes/1024/1024/1024 \"maxbyes_GB\",total/1024/1024/1024 \"bytes_GB\",free/1024/1024/1024 \"free_GB\",(total-free) /1024/1024/1024 \"use_GB\",
ROUND((total-free)/total,4)*100 \"use_%\",ROUND((total-free)/b.maxbytes,4)*100 \"maxuse_%\"
FROM
(SELECT tablespace_name,SUM(bytes) free FROM DBA_FREE_SPACE
GROUP BY tablespace_name
) a,
(SELECT tablespace_name,sum(case autoextensible when 'YES' then maxbytes else bytes end) maxbytes,SUM(bytes) total FROM DBA_DATA_FILES
GROUP BY tablespace_name
) b
WHERE a.tablespace_name=b.tablespace_name
order by \"maxuse_%\" desc"
}



#####all instnace level
predefined_dragnet_selections.json
[
{
name: "Name of tablespaec usage in list 2",
desc: "Explanation of selection 2 in right dialog",
sql: "SELECT a.tablespace_name ,b.maxbytes/1024/1024/1024 \"maxbyes_GB\",total/1024/1024/1024 \"bytes_GB\",free/1024/1024/1024 \"free_GB\",(total-free) /1024/1024/1024 \"use_GB\",
ROUND((total-free)/total,4)*100 \"use_%\",ROUND((total-free)/b.maxbytes,4)*100 \"maxuse_%\"
FROM
(SELECT tablespace_name,SUM(bytes) free FROM DBA_FREE_SPACE
GROUP BY tablespace_name
) a,
(SELECT tablespace_name,sum(case autoextensible when 'YES' then maxbytes else bytes end) maxbytes,SUM(bytes) total FROM DBA_DATA_FILES
GROUP BY tablespace_name
) b
WHERE a.tablespace_name=b.tablespace_name
order by \"maxuse_%\" desc"
}
]

 

#######sample 2  : add more statment checking  注意,‘’  的位置

 

[
{
name: "Name of tablespaec usage in list 2",
desc: "Explanation of selection 2 in right dialog",
sql: "SELECT a.tablespace_name ,b.maxbytes/1024/1024/1024 \"maxbyes_GB\",total/1024/1024/1024 \"bytes_GB\",free/1024/1024/1024 \"free_GB\",(total-free) /1024/1024/1024 \"use_GB\",
ROUND((total-free)/total,4)*100 \"use_%\",ROUND((total-free)/b.maxbytes,4)*100 \"maxuse_%\"
FROM
(SELECT tablespace_name,SUM(bytes) free FROM DBA_FREE_SPACE
GROUP BY tablespace_name
) a,
(SELECT tablespace_name,sum(case autoextensible when 'YES' then maxbytes else bytes end) maxbytes,SUM(bytes) total FROM DBA_DATA_FILES
GROUP BY tablespace_name
) b
WHERE a.tablespace_name=b.tablespace_name
order by \"maxuse_%\" desc"
},
{
name: "Name of datafile usage in list 3",
desc: "Explanation of datafile path in right dialog",
sql: "SELECT file_id,file_name,tablespace_name,autoextensible,increment_by,bytes/1024/1024 from dba_data_files where tablespace_name=UPPER(?)",
parameter: [
{
name: "Owner",
title: "Name of tablespace",
size: 30,
default: "SYSAUX"
},
]
},

{
name: "Name of tempfile usage in list 3",
desc: "Explanation of datafile path in right dialog",
sql: " SELECT TMP.NAME FILENAME, BYTES, TS.NAME TABLESPACE FROM V$TEMPFILE TMP, V$TABLESPACE TS WHERE TMP.TS#=TS.TS#"
},

{
name: "Name of frausage usage in list 3",
desc: "Explanation of frausage path in right dialog",
sql: " Select file_type, percent_space_used as used,percent_space_reclaimable as reclaimable,number_of_files as \"number\" from v$flash_recovery_area_usage"
},
{
name: "Name of log usage in list 3",
desc: "Explanation of log path in right dialog",
sql: " select * from v$logfile"
},
{
name: "Name of scn usage in list 3",
desc: "Explanation of scn path in right dialog",
sql: " select to_char(CURRENT_SCN,999999999999999999999999) from v$database"
},
{
name: "Name of scn usage in archivelog in list 3",
desc: "Explanation of scn in archivelog in right dialog",
sql: " select recid,thread#,sequence#,first_change#,next_change# from v$log_history where first_change > (?) and next_change# < (?)"
}
]

 

###awr 趋势分析

https://www.cnblogs.com/wenjiewang/p/6120549.html

Awrcrt的使用方法和技巧

用法和awrrpt类似

sqlplus / as sysdba

@awrcrt.sql

--4个参数

--参数1 显示多少天的awr snap list  

--参数2 开始snap id

--参数3 结束snap id

--参数3 输入80(显示图像相关的)

--参数4实例id

5~60秒后,在当前目录生成一个 AWRCRT*html的报告

 

Tip1:   只支持11.2 以及之后的数据库(由于使了聚合字符串函数)。

Tip2:  一般选择5~7天的snap来出趋势,但是有的库启动时间太长,统计的值特别大,可能导致脚本里面字符串超出最大长度,这个时候,只能缩短区间的,比如5天或者更短

Tip3:为什么我看不到图表?

在报告生成结束后,注意有没有ORA-错误。也可以报告出来以后, cat一下html,看有没有ORA- , 需要确保没有ORA-错误。 老版本的IE支持html5很差,建议用firefox chrome ie10 等浏览器看报告,生成的html报告需要和crt.js放在一个目录才能看到图表报告. 如果仍然看不到图表, 把html发送到valen点wang@oracle点com  我会抽时间看。

Tip4: awrcrt.sql 放在服务器上,如果采用vi 粘贴, 注意检查大小行数, 经常有的环境,copy大文件要丢了字符。最好ftp上去。

Tip5: 没有刻意去处理数据库发生过重启的时间点,也许会看到比较奇怪的数据,注意检查数据库是否重启过

 

posted @ 2017-11-28 17:14  feiyun8616  阅读(467)  评论(0编辑  收藏  举报