跟踪(Trace)常被我们用来检查性能问题。通常我们会有针对CPU、Duration、Reads的创建跟踪定义,这一类的脚本一般不会包含太多的事件和列,筛选条件也相对简单。假如某一天你使用GUI定义了一个包含大量事件和列的服务器端跟踪,点击运行后你直接把GUI关掉,而你却没有导出原始定义脚本。此时你想知道定义的筛选条件,或者定义的事件和列,甚至是希望另外创建一个相同的跟踪(你肯定不希望再次打开GUI设置繁琐的事件和列及筛选条件)。其实只要跟踪定义在SQL Server内部创建之后,你可以通过查询多个跟踪目录视图得到运行中的服务器端跟踪定义。
首先我们用Profiler创建一个跟踪,常规属性如下所示:

选择事件和列:

设置过滤条件:

事件选择设置好后,点击运行,此时Profiler如下所示:

查看sys.traces跟踪目录视图:

TraceID=2的是行集提供者跟踪,TraceID=3的是文件提供者跟踪
我们将行集提供者跟踪停止并移除:

--停止跟踪
exec sp_trace_setstatus 2, 0
--移除跟踪
exec sp_trace_setstatus 2, 2

移除后Profiler如下所示:

此时sys.traces跟踪目录视图只包含两条记录:

注意此时写入文件系统上的E:\Perfmon\StandardTrace.trc对应的服务器端跟踪还是在运行的。此时我们可以通过 文件|属性 来看看跟踪的定义,还可以通过 文件|导出|编写跟踪定义的脚本,并选择目标导出跟踪定义:

我们先导出跟踪定义StandardTrace.sql(后期对比),然后将Profiter关闭。
用下面的脚本提取服务器端跟踪定义:

-- 传入需要查看的TraceID
DECLARE @TraceID int
SET @TraceID = 3 SELECT
'/************************************************************
* 功能说明:查询跟踪目录视图得到运行中的服务器端跟踪定义
* 注意事项:如果要运行提取出的跟踪定义,请注意调整筛选条件部分参数赋值的位置
************************************************************/
'
UNION ALL
SELECT
'-- Create a Queue
DECLARE @rc int
,@TraceID int
,@MaxFileSize bigint=50
,@DateTime datetime=dateadd(day,1,getdate()) '
UNION ALL
SELECT 'SET @DateTime = '''+ convert(varchar,stop_time,121)+''''
FROM sys.traces
WHERE ID = @TraceID AND stop_time IS NOT NULL
UNION ALL
SELECT 'SET @MaxFileSize = '+ CAST(max_size as varchar(20))
FROM sys.traces
WHERE ID = @TraceID AND max_size IS NOT NULL
UNION ALL
select 'EXEC @rc = sp_trace_create @TraceID output ,'
+
CASE WHEN [path] like
'\\?\C:\Program Files\Microsoft SQL Server\MSSQL__.MSSQLSERVER\MSSQL\DATA\blackbox%'
THEN '@options = 8'
ELSE
CASE WHEN is_shutdown = 1
AND is_rollover = 1 THEN ''
WHEN is_shutdown = 1 THEN ''
WHEN is_rollover = 1 THEN ''
ELSE ''
END + ',N'''
--+ REVERSE(SUBSTRING(SUBSTRING(REVERSE([path]),5,LEN([path]))
-- ,CHARINDEX('_',SUBSTRING(REVERSE([path]),5,LEN([path])),1)+1
-- ,LEN([path])))
+ CASE WHEN [path] IS NULL THEN 'InsertFileNameHere'
ELSE LEFT([path],LEN([path])-4)+CONVERT(VARCHAR,GETDATE(),112)+REPLACE(CONVERT(VARCHAR,GETDATE(),108),':','')
END
+''', @MaxFileSize, @DateTime'
--+','+ coalesce(''''+convert(varchar(20),stop_time,126)+'''','NULL')
+ CASE WHEN is_rollover = 1
THEN ','+cast(max_files as varchar(20))
ELSE ''
END
END
from sys.traces
WHERE ID = @TraceID
UNION ALL
SELECT 'if (@rc != 0) goto error -- Set the events
DECLARE @on bit = 1
'
UNION ALL
SELECT CASE WHEN [path] like
'\\?\C:\Program Files\Microsoft SQL Server\MSSQL%.MSSQLSERVER\MSSQL\DATA\blackbox%'
THEN ''
ELSE
'EXEC @rc = sp_trace_setevent @TraceID'
+', '+CAST(EventID as varchar(20))
+', '+CAST(columnid as varchar(20))
+', @on'
END
FROM ::fn_trace_geteventinfo(@TraceID) evi
CROSS APPLY sys.traces trc
WHERE trc.id = @TraceID
UNION ALL
SELECT '
-- Set the Filters
DECLARE @Intfilter int
,@BigIntfilter bigint
-- 请将参数的赋值放置到对应筛选表达式的前面(如果有的话)
'
UNION ALL
SELECT CASE WHEN col.type_name = 'int'
THEN 'SET @IntFilter = '
+CAST(CAST(value as int)AS varchar(20))
+'--'+CAST(columnid AS varchar(20))+','+CAST(logical_operator AS varchar(20))+','+CAST(comparison_operator AS varchar(20))
WHEN col.type_name = 'bigint'
THEN 'SET @BigIntFilter = '
+CAST(CAST(value as bigint)AS varchar(20))
+'--'+CAST(columnid AS varchar(20))+','+CAST(logical_operator AS varchar(20))+','+CAST(comparison_operator AS varchar(20))
ELSE ''
END
FROM ::fn_trace_getfilterinfo(@TraceID) fil
JOIN sys.trace_columns col
ON fil.columnid = col.trace_column_id
WHERE CHARINDEX('int',col.type_name)>0 and fil.value is not null
UNION ALL
SELECT 'EXEC @rc = sp_trace_setfilter @TraceID'
+', '+CAST(columnid as varchar(20))
+', '+CAST(logical_operator as varchar(20))
+', '+CAST(comparison_operator as varchar(20))
+', '+CASE WHEN value IS NULL THEN 'null'
WHEN col.type_name = 'int' THEN '@IntFilter'
WHEN col.type_name = 'bigint' THEN '@BigIntFilter'
ELSE 'N'''+CAST(value as varchar(8000))+''''
END
FROM ::fn_trace_getfilterinfo(@TraceID) fil
JOIN sys.trace_columns col
ON fil.columnid = col.trace_column_id
UNION ALL
SELECT
'
-- Set the trace status to start
exec sp_trace_setstatus @TraceID, 1 -- Display trace id for future references
select TraceID=@TraceID
goto finish
'
UNION ALL
SELECT
'
error:
select ErrorCode=@rc finish:
go
'

在我的机器上服务器端跟踪ID为3,因此在脚本的开始设置@TraceID = 3,按Ctrl+T再运行脚本,将结果复制粘贴到新建查询窗口,并删除首行虚线及末行影响行数,得到脚本如下:

 /************************************************************
* 功能说明:查询跟踪目录视图得到运行中的服务器端跟踪定义
* 注意事项:如果要运行提取出的跟踪定义,请注意调整筛选条件部分参数赋值的位置
************************************************************/
-- Create a Queue
DECLARE @rc int
,@TraceID int
,@MaxFileSize bigint
,@DateTime datetime SET @DateTime = '2015-12-05 21:25:30.533'
SET @MaxFileSize = 17
EXEC @rc = sp_trace_create @TraceID output ,2,N'E:\Perfmon\StandardTrace20151205151034', @MaxFileSize, @DateTime,0
if (@rc != 0) goto error -- Set the events
DECLARE @on bit = 1
EXEC @rc = sp_trace_setevent @TraceID,10,1, @on
EXEC @rc = sp_trace_setevent @TraceID,10,8, @on
EXEC @rc = sp_trace_setevent @TraceID,10,9, @on
EXEC @rc = sp_trace_setevent @TraceID,10,10, @on
EXEC @rc = sp_trace_setevent @TraceID,10,11, @on
EXEC @rc = sp_trace_setevent @TraceID,10,12, @on
EXEC @rc = sp_trace_setevent @TraceID,10,13, @on
EXEC @rc = sp_trace_setevent @TraceID,10,14, @on
EXEC @rc = sp_trace_setevent @TraceID,10,15, @on
EXEC @rc = sp_trace_setevent @TraceID,10,16, @on
EXEC @rc = sp_trace_setevent @TraceID,10,17, @on
EXEC @rc = sp_trace_setevent @TraceID,10,18, @on
EXEC @rc = sp_trace_setevent @TraceID,10,31, @on
EXEC @rc = sp_trace_setevent @TraceID,10,35, @on
EXEC @rc = sp_trace_setevent @TraceID,12,1, @on
EXEC @rc = sp_trace_setevent @TraceID,12,8, @on
EXEC @rc = sp_trace_setevent @TraceID,12,9, @on
EXEC @rc = sp_trace_setevent @TraceID,12,10, @on
EXEC @rc = sp_trace_setevent @TraceID,12,11, @on
EXEC @rc = sp_trace_setevent @TraceID,12,12, @on
EXEC @rc = sp_trace_setevent @TraceID,12,13, @on
EXEC @rc = sp_trace_setevent @TraceID,12,14, @on
EXEC @rc = sp_trace_setevent @TraceID,12,15, @on
EXEC @rc = sp_trace_setevent @TraceID,12,16, @on
EXEC @rc = sp_trace_setevent @TraceID,12,17, @on
EXEC @rc = sp_trace_setevent @TraceID,12,18, @on
EXEC @rc = sp_trace_setevent @TraceID,12,31, @on
EXEC @rc = sp_trace_setevent @TraceID,12,35, @on
EXEC @rc = sp_trace_setevent @TraceID,13,1, @on
EXEC @rc = sp_trace_setevent @TraceID,13,8, @on
EXEC @rc = sp_trace_setevent @TraceID,13,9, @on
EXEC @rc = sp_trace_setevent @TraceID,13,10, @on
EXEC @rc = sp_trace_setevent @TraceID,13,11, @on
EXEC @rc = sp_trace_setevent @TraceID,13,12, @on
EXEC @rc = sp_trace_setevent @TraceID,13,14, @on
EXEC @rc = sp_trace_setevent @TraceID,13,35, @on -- Set the Filters
DECLARE @Intfilter int
,@BigIntfilter bigint
-- 请将参数的赋值放置到对应筛选表达式的前面(如果有的话)
SET @BigIntFilter = 2000000--13,0,4
SET @BigIntFilter = 5000000--13,0,5
SET @IntFilter = 33--18,0,4
EXEC @rc = sp_trace_setfilter @TraceID,1,0,7,N'%DBA%'
EXEC @rc = sp_trace_setfilter @TraceID,1,0,1,null
EXEC @rc = sp_trace_setfilter @TraceID,10,0,7,N'SQL Server Profiler - b42ea627-5083-476a-95d1-664e5e74731e'
EXEC @rc = sp_trace_setfilter @TraceID,11,0,6,N'%Debug%'
EXEC @rc = sp_trace_setfilter @TraceID,11,1,6,N'%Client%'
EXEC @rc = sp_trace_setfilter @TraceID,11,0,1,null
EXEC @rc = sp_trace_setfilter @TraceID,13,0,4,@BigIntFilter
EXEC @rc = sp_trace_setfilter @TraceID,13,0,5,@BigIntFilter
EXEC @rc = sp_trace_setfilter @TraceID,13,0,1,null
EXEC @rc = sp_trace_setfilter @TraceID,18,0,4,@IntFilter
EXEC @rc = sp_trace_setfilter @TraceID,18,0,1,null -- Set the trace status to start
exec sp_trace_setstatus @TraceID, 1 -- Display trace id for future references
select TraceID=@TraceID
goto finish error:
select ErrorCode=@rc finish:
go

如果发现注释的中文是乱码,请检查当前数据库的排序规则,或者用[N'中文']。此时的脚本还不能直接运行,我们需要将图中红框中的内容作适当调整:

调整为如下所示:

调整后最终的跟踪定义脚本如下:

 /************************************************************
* 功能说明:查询跟踪目录视图得到运行中的服务器端跟踪定义
* 注意事项:如果要运行提取出的跟踪定义,请注意调整筛选条件部分参数赋值的位置
************************************************************/
-- Create a Queue
DECLARE @rc int
,@TraceID int
,@MaxFileSize bigint
,@DateTime datetime SET @DateTime = '2015-12-05 21:25:30.533'
SET @MaxFileSize = 17
EXEC @rc = sp_trace_create @TraceID output ,2,N'E:\Perfmon\StandardTrace20151205151034', @MaxFileSize, @DateTime,0
if (@rc != 0) goto error -- Set the events
DECLARE @on bit = 1
EXEC @rc = sp_trace_setevent @TraceID,10,1, @on
EXEC @rc = sp_trace_setevent @TraceID,10,8, @on
EXEC @rc = sp_trace_setevent @TraceID,10,9, @on
EXEC @rc = sp_trace_setevent @TraceID,10,10, @on
EXEC @rc = sp_trace_setevent @TraceID,10,11, @on
EXEC @rc = sp_trace_setevent @TraceID,10,12, @on
EXEC @rc = sp_trace_setevent @TraceID,10,13, @on
EXEC @rc = sp_trace_setevent @TraceID,10,14, @on
EXEC @rc = sp_trace_setevent @TraceID,10,15, @on
EXEC @rc = sp_trace_setevent @TraceID,10,16, @on
EXEC @rc = sp_trace_setevent @TraceID,10,17, @on
EXEC @rc = sp_trace_setevent @TraceID,10,18, @on
EXEC @rc = sp_trace_setevent @TraceID,10,31, @on
EXEC @rc = sp_trace_setevent @TraceID,10,35, @on
EXEC @rc = sp_trace_setevent @TraceID,12,1, @on
EXEC @rc = sp_trace_setevent @TraceID,12,8, @on
EXEC @rc = sp_trace_setevent @TraceID,12,9, @on
EXEC @rc = sp_trace_setevent @TraceID,12,10, @on
EXEC @rc = sp_trace_setevent @TraceID,12,11, @on
EXEC @rc = sp_trace_setevent @TraceID,12,12, @on
EXEC @rc = sp_trace_setevent @TraceID,12,13, @on
EXEC @rc = sp_trace_setevent @TraceID,12,14, @on
EXEC @rc = sp_trace_setevent @TraceID,12,15, @on
EXEC @rc = sp_trace_setevent @TraceID,12,16, @on
EXEC @rc = sp_trace_setevent @TraceID,12,17, @on
EXEC @rc = sp_trace_setevent @TraceID,12,18, @on
EXEC @rc = sp_trace_setevent @TraceID,12,31, @on
EXEC @rc = sp_trace_setevent @TraceID,12,35, @on
EXEC @rc = sp_trace_setevent @TraceID,13,1, @on
EXEC @rc = sp_trace_setevent @TraceID,13,8, @on
EXEC @rc = sp_trace_setevent @TraceID,13,9, @on
EXEC @rc = sp_trace_setevent @TraceID,13,10, @on
EXEC @rc = sp_trace_setevent @TraceID,13,11, @on
EXEC @rc = sp_trace_setevent @TraceID,13,12, @on
EXEC @rc = sp_trace_setevent @TraceID,13,14, @on
EXEC @rc = sp_trace_setevent @TraceID,13,35, @on -- Set the Filters
DECLARE @Intfilter int
,@BigIntfilter bigint
-- 请将参数的赋值放置到对应筛选表达式的前面(如果有的话)
EXEC @rc = sp_trace_setfilter @TraceID,1,0,7,N'%DBA%'
EXEC @rc = sp_trace_setfilter @TraceID,1,0,1,null
EXEC @rc = sp_trace_setfilter @TraceID,10,0,7,N'SQL Server Profiler - b42ea627-5083-476a-95d1-664e5e74731e'
EXEC @rc = sp_trace_setfilter @TraceID,11,0,6,N'%Debug%'
EXEC @rc = sp_trace_setfilter @TraceID,11,1,6,N'%Client%'
EXEC @rc = sp_trace_setfilter @TraceID,11,0,1,null
SET @BigIntFilter = 2000000--13,0,4
EXEC @rc = sp_trace_setfilter @TraceID,13,0,4,@BigIntFilter
SET @BigIntFilter = 5000000--13,0,5
EXEC @rc = sp_trace_setfilter @TraceID,13,0,5,@BigIntFilter
EXEC @rc = sp_trace_setfilter @TraceID,13,0,1,null
SET @IntFilter = 33--18,0,4
EXEC @rc = sp_trace_setfilter @TraceID,18,0,4,@IntFilter
EXEC @rc = sp_trace_setfilter @TraceID,18,0,1,null -- Set the trace status to start
exec sp_trace_setstatus @TraceID, 1 -- Display trace id for future references
select TraceID=@TraceID
goto finish error:
select ErrorCode=@rc finish:
go

此时用BCompare比较上述脚本与手动导出的StandardTrace.sql脚本之间的差异:

 /****************************************************/
/* Created by: SQL Server 2008 R2 Profiler */
/* Date: 2015/12/05 14:53:04 */
/****************************************************/ -- Create a Queue
declare @rc int
declare @TraceID int
declare @maxfilesize bigint
declare @DateTime datetime set @DateTime = '2015-12-05 21:25:30.000'
set @maxfilesize = 5
exec @rc = sp_trace_create @TraceID output, 2, N'E:\Perfmon\StandardTrace.trc', @maxfilesize, @Datetime
if (@rc != 0) goto error -- Client side File and Table cannot be scripted -- Set the events
declare @on bit
set @on = 1
exec sp_trace_setevent @TraceID, 10, 15, @on
exec sp_trace_setevent @TraceID, 10, 31, @on
exec sp_trace_setevent @TraceID, 10, 8, @on
exec sp_trace_setevent @TraceID, 10, 16, @on
exec sp_trace_setevent @TraceID, 10, 1, @on
exec sp_trace_setevent @TraceID, 10, 9, @on
exec sp_trace_setevent @TraceID, 10, 17, @on
exec sp_trace_setevent @TraceID, 10, 10, @on
exec sp_trace_setevent @TraceID, 10, 18, @on
exec sp_trace_setevent @TraceID, 10, 11, @on
exec sp_trace_setevent @TraceID, 10, 35, @on
exec sp_trace_setevent @TraceID, 10, 12, @on
exec sp_trace_setevent @TraceID, 10, 13, @on
exec sp_trace_setevent @TraceID, 10, 14, @on
exec sp_trace_setevent @TraceID, 12, 15, @on
exec sp_trace_setevent @TraceID, 12, 31, @on
exec sp_trace_setevent @TraceID, 12, 8, @on
exec sp_trace_setevent @TraceID, 12, 16, @on
exec sp_trace_setevent @TraceID, 12, 1, @on
exec sp_trace_setevent @TraceID, 12, 9, @on
exec sp_trace_setevent @TraceID, 12, 17, @on
exec sp_trace_setevent @TraceID, 12, 10, @on
exec sp_trace_setevent @TraceID, 12, 14, @on
exec sp_trace_setevent @TraceID, 12, 18, @on
exec sp_trace_setevent @TraceID, 12, 11, @on
exec sp_trace_setevent @TraceID, 12, 35, @on
exec sp_trace_setevent @TraceID, 12, 12, @on
exec sp_trace_setevent @TraceID, 12, 13, @on
exec sp_trace_setevent @TraceID, 13, 8, @on
exec sp_trace_setevent @TraceID, 13, 1, @on
exec sp_trace_setevent @TraceID, 13, 9, @on
exec sp_trace_setevent @TraceID, 13, 10, @on
exec sp_trace_setevent @TraceID, 13, 14, @on
exec sp_trace_setevent @TraceID, 13, 11, @on
exec sp_trace_setevent @TraceID, 13, 35, @on
exec sp_trace_setevent @TraceID, 13, 12, @on -- Set the Filters
declare @intfilter int
declare @bigintfilter bigint exec sp_trace_setfilter @TraceID, 1, 0, 7, N'%DBA%'
exec sp_trace_setfilter @TraceID, 1, 0, 1, NULL
exec sp_trace_setfilter @TraceID, 10, 0, 7, N'SQL Server Profiler - b42ea627-5083-476a-95d1-664e5e74731e'
exec sp_trace_setfilter @TraceID, 11, 0, 6, N'%Debug%'
exec sp_trace_setfilter @TraceID, 11, 1, 6, N'%Client%'
exec sp_trace_setfilter @TraceID, 11, 0, 1, NULL
set @bigintfilter = 2000000
exec sp_trace_setfilter @TraceID, 13, 0, 4, @bigintfilter set @bigintfilter = 5000000
exec sp_trace_setfilter @TraceID, 13, 0, 5, @bigintfilter set @bigintfilter = NULL
exec sp_trace_setfilter @TraceID, 13, 0, 1, @bigintfilter set @intfilter = 33
exec sp_trace_setfilter @TraceID, 18, 0, 4, @intfilter set @intfilter = NULL
exec sp_trace_setfilter @TraceID, 18, 0, 1, @intfilter -- Set the trace status to start
exec sp_trace_setstatus @TraceID, 1 -- display trace id for future references
select TraceID=@TraceID
goto finish error:
select ErrorCode=@rc finish:
go


差异集中在事件和列顺序,以及筛选条件对null的处理。实际上两个脚本所定义跟踪完全相同。此时运行脚本,就能创建与StandardTrace.trc相同的跟踪了。
执行后sys.traces跟踪目录视图就会包含三条记录:

补充:有没有不用手动调整筛选部分代码就可以直接得出与原跟踪定义完全相同的脚本。此脚本根据<Professional SQL Server 2008 Internals and Troubleshooting>中10.7.3章节作了部分调整得出。筛选部分用游标写了段代码可以直接得出,但要一次得到整个跟踪定义却不知道如何拼凑,暂时放上筛选部分的获取代码:

 DECLARE @intfilter      INT
,@BigIntfilter bigint
DECLARE GetFilterinfo_Cursor CURSOR FOR
SELECT cast(fil.columnid AS VARCHAR(20)),cast(fil.logical_operator AS VARCHAR(20)),cast(fil.comparison_operator AS VARCHAR(20))
,cast(fil.value AS VARCHAR(8000)),cast(col.[type_name] AS VARCHAR(20))
FROM ::fn_trace_getfilterinfo(3) fil
JOIN sys.trace_columns col
ON fil.columnid = col.trace_column_id
OPEN GetFilterinfo_Cursor
DECLARE @columnid VARCHAR(20),
@logical_operator VARCHAR(20),
@comparison_operator VARCHAR(20),
@value VARCHAR(8000),
@type_name VARCHAR(20)
FETCH FROM GetFilterinfo_Cursor INTO @columnid,@logical_operator,@comparison_operator,@value,@type_name
WHILE @@FETCH_STATUS=0
BEGIN
IF @value IS NULL
BEGIN
SET @value='null'
PRINT 'EXEC @rc = sp_trace_setfilter @traceid,'+@columnid+','+@logical_operator+','+@comparison_operator+','+@value+''
END
ELSE IF @type_name='bigint' and @value is not null
BEGIN
PRINT 'SET @BigIntfilter='+@value--cast(@value AS varchar(20))
PRINT 'EXEC @rc = sp_trace_setfilter @traceid,'+@columnid+','+@logical_operator+','+@comparison_operator+',@BigIntfilter'
END
ELSE IF @type_name='int' and @value is not null
BEGIN
PRINT 'SET @Intfilter='+@value
PRINT 'EXEC @rc = sp_trace_setfilter @traceid,'+@columnid+','+@logical_operator+','+@comparison_operator+',@Intfilter'
END
ELSE
BEGIN
PRINT 'EXEC @rc = sp_trace_setfilter @traceid,'+@columnid+','+@logical_operator+','+@comparison_operator+',N'''+@value+''''
END
FETCH NEXT FROM GetFilterinfo_Cursor INTO @columnid,@logical_operator,@comparison_operator,@value,@type_name
END
CLOSE GetFilterinfo_Cursor;
DEALLOCATE GetFilterinfo_Cursor;
GO

执行此段代码的结果为:

以上两种方式都可以得到已有服务器端跟踪。

Trace-导出已有的服务器端跟踪的更多相关文章

  1. 如何从投票的网站的管理后台导出已投票的邀请码数据至Excel,并且稍修改,再导入到现场抽奖软件中?

    第一步:进入投票网站的管理后台,导出 已投票 的 邀请码 相关信息至Excel中,下图所示: 并且 删除第一行表头汉字信息. 第二步:把第A列 数值 信息 转换 为 文本 信息(注:转换方法详细点击此 ...

  2. 消息 4900,级别 16,状态 2,第 1 行 对表 'XX.XXX' 执行 ALTER TABLE SWITCH 语句失败。对于已启用更改跟踪的表,不可能切换其分区。请先禁用更改跟踪,再使用 ALTER TABLE SWITCH。

    问题描述: 今天处理切换分区数据的时候出现了这个错误: 消息 4900,级别 16,状态 2,第 1 行 对表 'XX.XXX' 执行 ALTER TABLE SWITCH 语句失败.对于已启用更改跟 ...

  3. 【翻译自mos文章】开启dblink的 oracle net trace/tracing --对dblink进行跟踪的方法

    开启dblink的 oracle net trace/tracing --对dblink进行跟踪的方法. 參考原文: DBLINK: How to Enable Oracle Net Tracing ...

  4. [Firefly引擎][学习笔记四][已完结]服务器端与客户端的通讯

    原地址:http://www.9miao.com/question-15-54981.html 传送门:学习笔记一学习笔记二学习笔记三 前言:学习笔记三是模块封装,这个在持续开发中会不断更新, 因为写 ...

  5. 命令行从Android手机中导出已安装APK的方法调研

    一.背景 二.步骤 一.背景 很多时候,APK文件只存在于应用市场,在PC上无法直接下载.用手机下载下来后就直接安装了,也不能保存原始的APK文件. APK安装到手机后,Android系统会保存一份和 ...

  6. Trace-跟踪高消耗的语句需添加哪些事件

    通常接手一台数据库服务器后,我们会开启Profiler跟踪来了解SQL Server的繁忙情况.我们首先会想到的是监控CPU或Duration超过某一阈值的语句/过程.那么所创建的Trace添加哪些事 ...

  7. 【译】The Accidental DBA:Troubleshooting Performance

    最近重新翻看The Accidental DBA,将Troubleshooting Performance部分稍作整理,方便以后查阅.此篇是Part 2Part 1:The Accidental DB ...

  8. SQL Server中关于跟踪(Trace)那点事

    前言 一提到跟踪俩字,很多人想到警匪片中的场景,同样在我们的SQL Server数据库中“跟踪”也是无处不在的,如果我们利用好了跟踪技巧,就可以针对某些特定的场景做定向分析,找出充足的证据来破案. 简 ...

  9. 【转】SQL Server中关于跟踪(Trace)那点事

    前言 一提到跟踪俩字,很多人想到警匪片中的场景,同样在我们的SQL Server数据库中“跟踪”也是无处不在的,如果我们利用好了跟踪技巧,就可以针对某些特定的场景做定向分析,找出充足的证据来破案. 简 ...

随机推荐

  1. Shrink磁盘

      30857(分区的总容量) =  10160(可修改的这个10610表示Shrink之后的空闲分区) + 20697(Shrink之后分区中占用掉的容量)

  2. 【iHMI43 4.3寸液晶模块】demo例程(版本1.00)发布

    ============================== 技术论坛:http://www.eeschool.org 博客地址:http://xiaomagee.cnblogs.com 官方网店:h ...

  3. 配置SMarty解析

    在 common/main.php中配置 View 组件 'view' => [ 'renderers' => [ 'tpl' => [ 'class' => 'yii\sma ...

  4. 用ultraISO 制作一个MSdos启动软盘镜像

    见过软盘,但是没用过,在虚拟机里试试. 磁带,软盘,光盘,硬盘…… 储存介质一代代更新,看到的img.iso文件都是叫做镜像文件(image file ).image 即图片照片,所谓的image f ...

  5. POJ 2299 树状数组+离散化求逆序对

    给出一个序列 相邻的两个数可以进行交换 问最少交换多少次可以让他变成递增序列 每个数都是独一无二的 其实就是问冒泡往后 最多多少次 但是按普通冒泡记录次数一定会超时 冒泡记录次数的本质是每个数的逆序数 ...

  6. PHP 错误与异常 笔记与总结(7)将错误日志以邮件方式发送

    当系统发生了很严重的问题,需要立刻发送给管理员.可以通过 error_log() 将错误以邮件形式发送到邮箱. 在 php.ini 中设置: sendmail_from = 472323087@qq. ...

  7. web-content和web-info目录问题

    1.资源文件只能放在WebContent下面,如 CSS,JS,image等.放在WEB-INF下引用不了. 2.页面放在WEB-INF目录下面,这样可以限制访问,提高安全性.如JSP,html 3. ...

  8. PHP抓取采集类snoopy介绍

    PHP抓取采集类snoopy介绍 一个PHP的抓取方案 在 2011年07月04日 那天写的     已经有 10270 次阅读了 感谢 参考或原文   服务器君一共花费了14.288 ms进行了2次 ...

  9. SQL搜索下划线,like中不能匹配下划线的问题

    最近在检测天气预报15天查询网 站(http://tqybw.net)时的URL时,发现页面中有很些404页,分析发现,是请求地址的能参数中多了下划线“_”,而rewrite规 则中并没有配这样的规则 ...

  10. go liteIDE

    go  liteIDE 1 COMM FILE package pricetable import ( "fmt" "math" "os" ...