首页 > 数据库技术 > 详细

windows统计数据库连接数批处理及find和findstr查找命令使用--笔记

时间:2015-02-25 23:51:02      阅读:695      评论:0      收藏:0      [点我收藏+]

windows统计数据库连接数批处理及find和findstr查找命令并创建批处理bat脚本




@echo on

set   CurDate=%date:~0,10%

set   CurTime=%time%

set   hh=%CurTime:~0,2%

if   /i   %hh%   LSS   10   ( set   hh=0%CurTime:~1,1% )

set   mm=%CurTime:~3,2%

set   ss=%CurTime:~6,2%

set   CurDateTime=%CurDate%_%hh%:%mm%:%ss%

set   CurDateTime


d:

cd \

echo =================================================================== >>mysqlccount.txt

echo 统计数据库连接数 %CurDateTime% >>mysqlccount.txt

echo =================================================================== >>mysqlccount.txt

echo. >>mysqlccount.txt

netstat -an|findstr  /I  "10.10.10.189:3306 127.0.0.1:3306" >>mysqlccount.txt

echo. >>mysqlccount.txt

echo mysql数据库连接数为: >>mysqlccount.txt

netstat -an|findstr  /I  "10.10.10.189:3306 127.0.0.1:3306" |find /v /c "" >>mysqlccount.txt

echo. >>mysqlccount.txt

echo -------------------------------------------------------------------- >>mysqlccount.txt

echo. >>mysqlccount.txt

netstat -an|findstr  /I  "10.10.10.189:1433" >>mysqlccount.txt

echo. >>mysqlccount.txt

echo sqserver数据库连接数为: >>mysqlccount.txt

netstat -an|findstr  /I  "10.10.10.189:1433" |find /v /c "" >>mysqlccount.txt

echo. >>mysqlccount.txt


本文出自 “心愿” 博客,请务必保留此出处http://xinyuan8.blog.51cto.com/677906/1615312

windows统计数据库连接数批处理及find和findstr查找命令使用--笔记

原文:http://xinyuan8.blog.51cto.com/677906/1615312

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!