windows统计数据库连接数批处理及find和findstr查找命令使用--笔记
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
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。