sql 服务器分析器 2014 "failed to open a table"

sql server profiler 2014 "failed to open a table"

我正在尝试重播 SQL 我保存到数据库 table 的 Server 2014 Profiler 跟踪。当我打开时,我收到 "Failed to open a table" 错误消息。 windows 日志中没有任何内容。

我用谷歌搜索了一下,这个错误过去常常在将 SQL Server 2000 系统升级到 64 位系统时发生。这在这里不适用。我 运行 在 Windows Server 2012 上全新安装了 SQL Server 2014。

跟踪是 TSQL_replay 模板。我使用以下代码将其保存到 table。该代码生成了一个 table 并显示了定义。

SELECT * 
INTO myTrace 
FROM ::fn_trace_gettable(N'c:\Logs\sql_trace_events.trc', default)

CREATE TABLE [dbo].[myTrace]
(
    [TextData] [ntext] NULL,
    [BinaryData] [image] NULL,
    [DatabaseID] [int] NULL,
    [TransactionID] [bigint] NULL,
    [LineNumber] [int] NULL,
    [NTUserName] [nvarchar](256) NULL,
    [NTDomainName] [nvarchar](256) NULL,
    [HostName] [nvarchar](256) NULL,
    [ClientProcessID] [int] NULL,
    [ApplicationName] [nvarchar](256) NULL,
    [LoginName] [nvarchar](256) NULL,
    [SPID] [int] NULL,
    [Duration] [bigint] NULL,
    [StartTime] [datetime] NULL,
    [EndTime] [datetime] NULL,
    [Reads] [bigint] NULL,
    [Writes] [bigint] NULL,
    [CPU] [int] NULL,
    [Permissions] [bigint] NULL,
    [Severity] [int] NULL,
    [EventSubClass] [int] NULL,
    [ObjectID] [int] NULL,
    [Success] [int] NULL,
    [IndexID] [int] NULL,
    [IntegerData] [int] NULL,
    [ServerName] [nvarchar](256) NULL,
    [EventClass] [int] NULL,
    [ObjectType] [int] NULL,
    [NestLevel] [int] NULL,
    [State] [int] NULL,
    [Error] [int] NULL,
    [Mode] [int] NULL,
    [Handle] [int] NULL,
    [ObjectName] [nvarchar](256) NULL,
    [DatabaseName] [nvarchar](256) NULL,
    [FileName] [nvarchar](256) NULL,
    [OwnerName] [nvarchar](256) NULL,
    [RoleName] [nvarchar](256) NULL,
    [TargetUserName] [nvarchar](256) NULL,
[DBUserName] [nvarchar](256) NULL,
[LoginSid] [image] NULL,
[TargetLoginName] [nvarchar](256) NULL,
[TargetLoginSid] [image] NULL,
[ColumnPermissions] [int] NULL,
[LinkedServerName] [nvarchar](256) NULL,
[ProviderName] [nvarchar](256) NULL,
[MethodName] [nvarchar](256) NULL,
[RowCounts] [bigint] NULL,
[RequestID] [int] NULL,
[XactSequence] [bigint] NULL,
[EventSequence] [bigint] NULL,
[BigintData1] [bigint] NULL,
[BigintData2] [bigint] NULL,
[GUID] [uniqueidentifier] NULL,
[IntegerData2] [int] NULL,
[ObjectID2] [bigint] NULL,
[Type] [int] NULL,
[OwnerID] [int] NULL,
[ParentName] [nvarchar](256) NULL,
[IsSystem] [int] NULL,
[Offset] [int] NULL,
[SourceDatabaseID] [int] NULL,
[SqlHandle] [image] NULL,
[SessionLoginName] [nvarchar](256) NULL,
[PlanHandle] [image] NULL,
[GroupID] [int] NULL
) 

我尝试了同样的事情,但没有 运行 遇到任何问题。您是否尝试过使用新的跟踪并保存到不同的名称 table?

您必须等待...'replay' 会变灰大约 1 分钟,直到它完全加载脚本。

遇到了同样的问题,结果我试图在不同的 SQL 实例上使用 Profiler 2008 打开 Profiler 2014 中记录的跟踪以回复跟踪。在回放实例上将分析器升级到 2014 解决了这个问题。

您必须首先创建特定结构的 table。尝试从探查器将跟踪导出到 table 并查看它创建的内容。然后只需将列的子集插入 table。这是我在 SQL 2012-2017 年使用的内容:

------- Trace created with Replay template

USE [testdb]

GO 

/****** Object:  Table [dbo].[TraceTable]    Script Date: 29-Oct-18 17:37:07 ******/ 
SET ANSI_NULLS ON 
GO 

SET QUOTED_IDENTIFIER ON

GO 

CREATE TABLE [dbo].[TraceTableSQL1] 
( 
    [RowNumber] [int] IDENTITY ( 0 , 1 ) NOT NULL , 
    [EventClass] [int] NULL , 
    [BinaryData] [image] NULL , 
    [DatabaseID] [int] NULL , 
    [NTUserName] [nvarchar] ( 128 ) NULL , 
    [NTDomainName] [nvarchar] ( 128 ) NULL , 
    [HostName] [nvarchar] ( 128 ) NULL , 
    [ClientProcessID] [int] NULL , 
    [ApplicationName] [nvarchar] ( 128 ) NULL , 
    [LoginName] [nvarchar] ( 128 ) NULL , 
    [SPID] [int] NULL , 
    [StartTime] [datetime] NULL , 
    [EndTime] [datetime] NULL , 
    [Error] [int] NULL , 
    [DatabaseName] [nvarchar] ( 128 ) NULL , 
    [RowCounts] [bigint] NULL , 
    [RequestID] [int] NULL , 
    [EventSequence] [bigint] NULL , 
    [IsSystem] [int] NULL , 
    [ServerName] [nvarchar] ( 128 ) NULL , 
    [TextData] [ntext] NULL , 
    [EventSubClass] [int] NULL , 
    [Handle] [int] NULL , 
    PRIMARY KEY CLUSTERED 
    ( 
        [RowNumber] ASC 
    ) 
    WITH ( PAD_INDEX = OFF , STATISTICS_NORECOMPUTE = OFF , IGNORE_DUP_KEY = OFF , ALLOW_ROW_LOCKS = ON , ALLOW_PAGE_LOCKS = ON ) ON [PRIMARY] 
) 
ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] 
GO 

INSERT [TraceTableSQL1] 
SELECT 
[EventClass] , 
[BinaryData] , 
[DatabaseID] , 
[NTUserName] , 
[NTDomainName] , 
[HostName] , 
[ClientProcessID] , 
[ApplicationName] , 
[LoginName] , 
[SPID] , 
[StartTime] , 
[EndTime] , 
[Error] , 
[DatabaseName] , 
[RowCounts] , 
[RequestID] , 
[EventSequence] , 
[IsSystem] , 
[ServerName] , 
[TextData] , 
[EventSubClass] , 
[Handle] 
FROM sys.fn_trace_gettable ( N'd:\temp\profiler.trc' , DEFAULT )