PSTOOLS-Windows下的命令行管理工具包
作者 :OoNiceDream【转载时请务必以超链接形式标明文章原始出处和作者信息】
链接:http://www.dbaroad.me/archives/2008/12/windows-pstools.html
链接:http://www.dbaroad.me/archives/2008/12/windows-pstools.html
找到一款不错WINDOWS下的命令行管理的工具包-PsTools,工具挺多的,简介其中两个小工具:
1、pslist:类似于UNIX下的ps命令
C:\Documents and Settings\NiceDream>pslist oracle pslist v1.28 - Sysinternals PsList Copyright ? 2000-2004 Mark Russinovich Sysinternals Process information for OONICEDREAM: Name Pid Pri Thd Hnd Priv CPU Time Elapsed Time oracle 3820 8 10 165 135956 0:00:00.578 0:01:45.093 |
Thd为线程数,当前Oracle进程有10个线程。
显示Oracle进程的详细线程信息:
C:\Documents and Settings\NiceDream>pslist -d oracle pslist v1.28 - Sysinternals PsList Copyright ? 2000-2004 Mark Russinovich Sysinternals Thread detail for OONICEDREAM: oracle 3820: Tid Pri Cswtch State User Time Kernel Time Elapsed Time 2280 8 140 Wait:Executive 0:00:00.000 0:00:00.015 0:02:05.625 2272 8 54 Wait:UserReq 0:00:00.000 0:00:00.000 0:02:04.265 2384 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:02:03.546 3460 9 223 Wait:UserReq 0:00:00.000 0:00:00.015 0:01:22.718 3676 8 108 Wait:UserReq 0:00:00.000 0:00:00.000 0:01:22.406 3680 8 271 Wait:UserReq 0:00:00.000 0:00:00.000 0:01:22.093 3356 9 161 Wait:UserReq 0:00:00.000 0:00:00.015 0:01:21.781 2800 9 137 Wait:UserReq 0:00:00.015 0:00:00.046 0:01:21.453 3484 8 20 Wait:UserReq 0:00:00.000 0:00:00.000 0:01:21.140 3956 9 5 Wait:Queue 0:00:00.000 0:00:00.000 0:01:20.031 |
新开一个ORACLE连接:
sys@SKY>select max(sid) from v$mystat; MAX(SID) ---------- 7 sys@SKY>select spid from v$session a ,v$process b where a.paddr=b.addr and a.sid=7; SPID ------------ 3512 |
显示Oracle进程的详细线程信息,可以看到多了一个线程,线程Tid为3512
C:\Documents and Settings\NiceDream>pslist -d oracle pslist v1.28 - Sysinternals PsList Copyright ? 2000-2004 Mark Russinovich Sysinternals Thread detail for OONICEDREAM: oracle 3820: Tid Pri Cswtch State User Time Kernel Time Elapsed Time 2280 8 140 Wait:Executive 0:00:00.000 0:00:00.015 0:02:41.421 2272 8 54 Wait:UserReq 0:00:00.000 0:00:00.000 0:02:40.062 2384 8 2 Wait:UserReq 0:00:00.000 0:00:00.000 0:02:39.343 3460 8 234 Wait:UserReq 0:00:00.000 0:00:00.015 0:01:58.515 3676 8 120 Wait:UserReq 0:00:00.000 0:00:00.000 0:01:58.203 3680 8 283 Wait:UserReq 0:00:00.000 0:00:00.000 0:01:57.890 3356 9 213 Wait:UserReq 0:00:00.000 0:00:00.015 0:01:57.578 2800 9 137 Wait:UserReq 0:00:00.015 0:00:00.046 0:01:57.250 3484 8 20 Wait:UserReq 0:00:00.000 0:00:00.000 0:01:56.937 3956 9 5 Wait:Queue 0:00:00.000 0:00:00.000 0:01:55.828 3512 9 280 Wait:UserReq 0:00:00.031 0:00:00.046 0:00:25.218 |
可以采用orakill杀掉该线程:
C:\Documents and Settings\NiceDream>orakill Usage: orakill sid thread where sid = the Oracle instance to target thread = the thread id of the thread to kill The thread id should be retrieved from the spid column of a query such as: select spid, osuser, s.program from v$process p, v$session s where p.addr=s.paddr C:\Documents and Settings\NiceDream>orakill SKY 3512 Kill of thread id 3512 in instance SKY successfully signalled. |
2、psservice:用于查询、启动、关闭系统服务
查询以oracle开头的服务:
C:\Documents and Settings\NiceDream>psservice query oracle PsService v2.22 - Service information and configuration utility Copyright (C) 2001-2008 Mark Russinovich Sysinternals - www.sysinternals.com .... .... .... SERVICE_NAME: OracleOraHome92TNSListener DISPLAY_NAME: OracleOraHome92TNSListener TYPE : 10 WIN32_OWN_PROCESS STATE : 1 STOPPED (NOT_STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN) WIN32_EXIT_CODE : 1077 (0x435) SERVICE_EXIT_CODE : 0 (0x0) CHECKPOINT : 0x0 WAIT_HINT : 0x0 SERVICE_NAME: OracleServiceSKY DISPLAY_NAME: OracleServiceSKY TYPE : 10 WIN32_OWN_PROCESS STATE : 4 RUNNING (STOPPABLE,PAUSABLE,ACCEPTS_SHUTDOWN) WIN32_EXIT_CODE : 0 (0x0) SERVICE_EXIT_CODE : 0 (0x0) CHECKPOINT : 0x0 WAIT_HINT : 0x0 |
比较可惜,psservice不支持通配符,要查询包含SKY的服务,就查不到了:
C:\Documents and Settings\NiceDream>psservice query *SKY* PsService v2.22 - Service information and configuration utility Copyright (C) 2001-2008 Mark Russinovich Sysinternals - www.sysinternals.com C:\Documents and Settings\NiceDream> |
PsTools工具包,包含的工具还挺多的
下载地址:点击进入下载页面
大家慢慢研究吧,有新发现不要忘了告诉我 ^_^
— The End —
关键字: 基础知识


不错
[回复]