sqlserver数据库系统性能监控步骤
1.部署好环境JDK+tomcat+数据库
①修改数据库连接账号密码db.properties
②修改applicationContext.xml文件,开启任务
<bean id="overtimeCheckNodeServletDoTime" class="org.springframework.scheduling.quartz.CronTriggerBean"><property name="jobDetail">
<ref bean="overtimeCheckNodeServletTask" />
</property>
<!-- cron表达式 -->
<property name="cronExpression">
<!-- 每个月的1-7号执行-->
<value>00 00 11 1-8 * ?</value>
</property>
</bean>
====================================
<!-- 总管理类 如果将lazy-init='false'那么容器启动就会执行调度程序 -->
<bean id="startTask" lazy-init="false" autowire="no"
class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="holidayDoTime" />
<!--
<ref bean="ehrDoTime" />
<ref bean="importRecordDoTime" />
<ref bean="importRecordDoTime2" />
<ref bean="holidayDoTime" />
<ref bean="userModelDoTime" />
<ref bean="abnormalNotifyDoTime" />
<ref bean="overtimeCheckNodeServletDoTime" />
-->
</list>
</property>
</bean>
③只打开error级别错误
# This is the configuring for logging displayed in the Application Serverlog4j.rootLogger=ERROR, stdout
# stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[workAttendance] %p [%t] %c.%M(%L) | %m%n
# rolling file
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.Threshold = ERROR
log4j.appender.R.File=/workAttendancelog/workAttendance.log
log4j.appender.R.MaxFileSize=150MB
log4j.appender.R.MaxBackupIndex=20
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %p [%t] %c{1}.%M()| line:%L | %m%n
# logger
log4j.logger.com.chinasoft.it.attendance=ERROR, R
log4j.logger.com.chinasoft.ro=ERROR, R
#log4j.logger.jdbc.sqlonly=ON
#log4j.logger.jdbc.sqltiming=ON
#log4j.logger.jdbc.audit=ON
#log4j.logger.jdbc.resultset=ON
log4j.logger.jdbc.connection=off
log4j.logger.java.sql.Connection=ERROR, R
log4j.logger.java.sql.Statement=ERROR, R
log4j.logger.java.sql.PreparedStatement=ERROR, R
2.调整系统时间
12月1-6号之间的时间
调整为2015年11月6日
date -s 11/06/2015
时间 19:25:00分
date -s 19:25:003.与考勤计算相关的三张表
CS_MONTH_GATHER_INFO_T 汇总表CS_WINTER_VACATION_T 年假表
CS_TAKE_REST_T 调休表
SELECT COUNT(1) FROM CS_MONTH_GATHER_INFO_T WHERE YEAR_FLAG=2015 AND MONTH_FLAG=12
SELECT COUNT(1) FROM CS_WINTER_VACATION_T WHERE YEAR_FLAG=2015 AND MONTH_FLAG=12
SELECT COUNT(1) FROM CS_TAKE_REST_T WHERE YEAR_FLAG=2015 AND MONTH_FLAG=12
通过sqlserver2008r2自带的profiler工具观测sql语句执行的效率
通过 select DB_ID(数据库名) 找出需要监控数据库的id
select DB_ID('attendance20151115')
选择所有列,所有事件,将databaseid设置等于10