oracle tuning 工具
工欲善其事, 必先利其器.
?
oracle 調優方面有很多工具, 目前 UI 個人只打算使用 Toad.
?
重要文件
一. alert log file. (位置 parameter BACKGROUND_DUMP_DEST)
?? 這個文件中有很多重要的內容, 可以通過調整 LOG_CHECKPOINTS_TO_ALERT 這個參數, 將 checkpoint 內容寫到這個文件中.
?? 使用方法 :
?? 1. 可以搜索帶 ORA 開頭的內容, 例如使用 vi 工具的 /ORA, 這樣可以快速定位錯誤的內容加以判斷.
?? 2. 那些可以影響到 database structure and parameters and statements的操作, 例如 create database, startup, shutdown, archivelog and recover.
?? 3. instance start 時那些不是默認的是否正確
二. User Trace file
?? 這個文件包含了 sql statement 執行的一些統計信息, 可以是 session 級別的, 也可以是instance 級別的(全部session都包括), 一般我們使用 session 級別的.
?? instance 級別, 設置方法是將 sql_trace 這個參數設置為 true. 注意: 這樣會造成 user trace file 這個文件很大.
?? session 級別, 即只針對某些特殊的 session 來進行 trace file 確認. 設置方法: execute dbms_system.set_sql_trace_in_session(8, 12, true);
?? 以上設置的參數分別的, 8 是 system identifier , 12 是 serial number, true 表示接下來的 sql statement 可以寫到 trace file.
?? 也可以使用 alter session set sql_trace= true? -- 只針對當前 session 來設置的 sql_trace.
三. 動態視圖和數據字典(也不知道這些視圖等是否能用上, 先羅列吧)
?? 這里有很多動態視圖和數據字典, 下面一一道來:
數據字典:
dba_tables
dba_tab_columns
dba_clusters
dba_indexes
index_stats
index_histogram
dba_tab_histograms
動態視圖: 其中 P 表示 performance tuning, T 表示 Troubleshooting
wait event (這個也是 oracle 一個動態視圖, wait events provides information on the sessions that had to wait or must wait for different reasons)
v$event_name
v$session_event: waits for an event for each session that had to wait.
v$session_wait: waits for an event for current active session that are waiting
v$system_event: total waits for an event, all session together.
另外, 還有一些參數可以設置你搜集統計信息的級別:
STATISTICS_LEVEL
TIMED_STATISTICS
TIMED_OS_STATISTICS
DB_CACHE_ADVICE
?
重要工具 STATSPACK(目前看來這個工具可以得到上面視圖一樣的內容, 而且更方便)
statspack 必看文檔 rdbms/admin/spdoc.txt
statspack 是一個用戶, snapshop 快照存儲在表里, 因為 statspack 在執行快照時保存的數據大, 所以最好要創建表空間為 statspack, 然后將所有的 statspack里的所有表都存放在這個表空間里.
1. 安裝 statspack: 調用腳本 spcreate.sql
2. 收集統計信息, execute statspack.snap
3. 自動收集統計信息, 調用腳本 spauto.sql
4. 生成report: spreport.sql
5. 有關時間的統計信息, 將參數 TIMED_STATISTICS 設置為 ture.
下面看看 statspack 都能輸出哪些我們想要的信息: (注意, 以上的動態視圖等也是得到我們想要的信息)
- database and instance name
- time at which the snapshots were taken
- Current sizes of the cache
- load profile
- efficiency percentages of the instance top five wait events
- complete list of wait events
- information on SQL statements currently in the pool
- instance activity statistics
- tablespace and file I/O
- buffer pool statistics
- rollback or undo segment statistics
- latch activity
- dictionary cache statistics
- library cache statistics
- SGA statistics
- startup values for init.ora parameters
看到上邊的內容, 基本可以判斷, statspack 輸出了我們想要的所有內容.?????
總結
以上是生活随笔為你收集整理的oracle tuning 工具的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 轻用其芒,动即有伤,是为凶器;深藏若拙,
- 下一篇: Android控件系列之RadioBut