使用Windows工具管理Nt上的Oracle數據庫
2024-08-29 13:29:37
供稿:網友
 
link:
http://www.eygle.com/faq/use.nt.tools.manage.oracle.htm
1.top
top 工具可以監視最消耗系統資源的進程
pid 即process id,windows是多線程服務器,每個進程包含一系列線程,這個與unix不同,unix每個oralce進程獨立存在,在nt上所有線程由oralce進程衍生。
所以只用top工具我們還無法找出每個連接的用戶進程。
 
71% 00000000?1?16384?0?8:52:53.936 no name found0% 00000008?4116?282624?24576?0:00:45.164 system1% 000000b8?27023?991232 2207744?0:03:10.313 csrss.exe0% 00000524?1844 2035712 3137536?0:00:11.726 rundll32.exe0% 0000032c?1002 1765376 1380352?0:00:08.432 aom.exe0% 000004e8?773695 7610368 8146944?0:04:26.533 xdict.exe0% 00000720?583880 5079040 33280000?0:08:29.122 netcaptor.exe23% 000006f4?11882 37056512 79757312?0:00:07.661 oracle.exe0% 00000420?1622 1478656 2420736?0:00:00.170 sqlplus.exe 
如果windows上由于某個進程的sql或其他問題導致資源過度占用或消耗,比如如下這樣一條語句,那么我們怎樣來找到這條問題sql呢?
2.qslice
找到最消耗資源的線程號,本例中為(6ec),為16進制,需要轉換,v$process視圖中的進程id為十進制
使用getsql.sql腳本即可獲得當前正在執行的sql語句:
 
rem getsql.sqlrem author eyglerem 在windows上,已知進程id,得到當前正在執行的語句rem 在windows上,進程id為16進制,需要轉換,在unix直接為10進制select /*+ ordered */ sql_text from v$sqltext a where (a.hash_value, a.address) in ( select decode (sql_hash_value, 0, prev_hash_value, sql_hash_value ), decode (sql_hash_value, 0, prev_sql_addr, sql_address) from v$session b where b.paddr = (select addr from v$process c where c.spid = to_number ('&pid', 'xxxx')))order by piece asc/
運行以上腳本:
 
ok,找到這最消耗資源的問題sql接下來就可以進行針對性調整了.
相關工具下載地址:
http://www.microsoft.com/windows2000/techinfo/reskit/tools/existing/qslice-o.asp