[sJOB].[job_id] AS [JobID] , [sJOB].[name] AS [JobName] , CASE WHEN [sJOBH].[run_date] IS NULL OR [sJOBH].[run_time] IS NULL THEN NULL ELSE CAST( CAST([sJOBH].[run_date] AS CHAR(8))+''+STUFF( STUFF(RIGHT('000000'+ CAST([sJOBH].[run_time] AS VARCHAR(6))...
SQL Agent Job History Tables and Query The main job history table ismsdb.dbo.sysjobhistory. Every time a SQL Server Agent job is executed there is a row placed in this table for each step of the job that executes. Each history row is identified by the job_id and step_id ...
selectj.nameas'JobName',run_date,run_time,msdb.dbo.agent_datetime(run_date,run_time)as'RunDateTime'Frommsdb.dbo.sysjobs jINNERJOINmsdb.dbo.sysjobhistory hONj.job_id=h.job_idwherej.enabled=1--Only Enabled JobsorderbyJobName,RunDateTimedesc Below are the results that this query produces and...
operator_id_pagedintID of the operator notified by pager when the job completed. retries_attemptedintNumber of retry attempts for the job or step. serversysnameName of the server where the job was executed. Examples The following Transact-SQL query converts therun_dateandrun_timecolumns into a...
When you need to reuse a SQL query for a new job, you can load it and execute it in theSQL Editor. You can use theSQL Historyview of Streaming SQL Console. You can view the full submitted statement by hovering the mouse over the items. You can load the query to the editor by simp...
The following query is a good starting point if you want to export the SQL Server Agent job history to a file and you're still using Enterprise Manager from SQL Server 2000. In SQL Server Management Studio from SQL Server 2005 there's already a command available to do this in the Log ...
One Query Provides Useful Information Below is a simple script that interrogates the MSDB SQL Agent Job and JobHistory tables and returns useful information to help determine what each job is executing at each step, how frequently the jobs runs each day and what is the average duration. Notice...
2. It is a simple job that inserts a number into a table along with a WAITFORDELAY of 25 seconds 3. Set the Schedule of the job to run every 10 seconds (which is lesser than our WAITFORDELAY value) 4. Once the job is enabled and is running, You c...
3.通过hive.query.string属性过滤查看a.xml文件 通过获取接口获取运行中Hive作业可以查看到Hive的SQL语句,该信息对应到HDFS的/user/$USER/.staging/$JOBID/job.xml文件中。 4.如果作业执行完成将接口改为JobHistory的API接口执行 curl -H "Accept: application/json" -X \ ...
--- 使用慢查询获取慢SQL 慢查询的相关参数 slow_query_log 是否开启了慢查询 默认关闭 mysql> show variables like 'slow_query_log';...SQL执行时间的阈值 单位为秒 。...10.000000 | +---+---+ 1 row in set (0.02 sec) --- log_queries_not_using_indexes 是否记录未使用索引的...因为慢...