SQLTeam.com | Weblogs | Forums

Error running ClearTrace


#1

I can't seem to get past this error:

Files to process: 1 ( 19.8 MB )
Clearing Target Tables...
SMO Version: Microsoft.SqlServer.ConnectionInfoExtended, Version=13.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91


Processing: ClearTraceTest.trc


Trace File Read Error in C:\DBA\Temp\ClearTraceTest.trc (Exception has been thrown by the target of an invocation.)
Inner Exception: Exception has been thrown by the target of an invocation.
Inner Exception: Failed to initialize object as reader.
Inner Exception: Could not load file or assembly 'Microsoft.SqlServer.Instapi, Version=13.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
You can visit the support forum at http://forums.sqlteam.com/c/cleartrace
Done.


#2

And you have the full client tools installed?


#3

Also, can you run the following in PowerShell and see post what it returns?

cls
$PSVersionTable.PSVersion
[reflection.assembly]::loadwithpartialname("Microsoft.SqlServer.Instapi")
[reflection.assembly]::Load("Microsoft.SqlServer.Instapi, Version=13.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91");

#4

Major Minor Build Revision


5 0 10586 117

CodeBase : file:///C:/windows/assembly/GAC_MSIL/Microsoft.SqlServer.Instapi/12.0.0.0__89845dcd8080cc91/Microsoft.SqlServer.Instapi.dll
FullName : Microsoft.SqlServer.Instapi, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91
EntryPoint :
DefinedTypes : {AssemblyVersionInfo, Microsoft.SqlServer.InstAPIException, Microsoft.SqlServer.InstAPI, Microsoft.SqlServer.SQL_SVCS...}
Evidence : {<System.Security.Policy.GacInstalled version="1"/>
, <System.Security.Policy.Hash version="2">



</System.Security.Policy.Hash>
,
, <System.Security.Policy.Url version="1">
file:///C:/windows/assembly/GAC_MSIL/Microsoft.SqlServer.Instapi/12.0.0.0__89845dcd8080cc91/Microsoft.SqlServer.Instapi.dll
</System.Security.Policy.Url>
...}
PermissionSet : {}
SecurityRuleSet : Level1
ManifestModule : Microsoft.SqlServer.Instapi.dll
ReflectionOnly : False
Location : C:\windows\assembly\GAC_MSIL\Microsoft.SqlServer.Instapi\12.0.0.0__89845dcd8080cc91\Microsoft.SqlServer.Instapi.dll
ImageRuntimeVersion : v2.0.50727
GlobalAssemblyCache : True
HostContext : 0
IsDynamic : False
EscapedCodeBase : file:///C:/windows/assembly/GAC_MSIL/Microsoft.SqlServer.Instapi/12.0.0.0__89845dcd8080cc91/Microsoft.SqlServer.Instapi.dll
ExportedTypes : {Microsoft.SqlServer.InstAPIException, Microsoft.SqlServer.InstAPI, Microsoft.SqlServer.SQL_SVCS, Microsoft.SqlServer.INST_ID...}
IsFullyTrusted : True
CustomAttributes : {[System.Reflection.AssemblyCopyrightAttribute("Microsoft Corp. All rights reserved.")], [System.Reflection.AssemblyTrademarkAttribute("Microsoft SQL
Server is a registered trademark of Microsoft Corporation.")], [System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows =
True)], [System.Runtime.InteropServices.ComVisibleAttribute((Boolean)True)]...}
Modules : {Microsoft.SqlServer.Instapi.dll}

Exception calling "Load" with "1" argument(s): "Could not load file or assembly 'Microsoft.SqlServer.Instapi, Version=13.0.0.0, Culture=neutral,
PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified."
At line:4 char:1

  • [reflection.assembly]::Load("Microsoft.SqlServer.Instapi, Version=13. ...
  •   + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
      + FullyQualifiedErrorId : FileNotFoundException

#5

My best guess is that the SQL Server 2016 Engine is installed but the SSMS 2016 tools aren't. In SQL Server 2016 they're a separate install. Can you confirm whether SSMS 2016 is installed?

A second option is to replace the contents of ClearTrace.EXE.config with the following.

<?xml version="1.0"?>
<configuration>
    <configSections>
    </configSections>
    <connectionStrings/>
  <startup  useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>




  <!--
  
  Uncommnet the following section to remap the SMO vesions
  This is built with SQL Server 2012 SMO.  It should run
  with most common SMO vesions.
  
  Replace the "newVersion" with the version you'd like 
  to target.
  
  SQL Server 2008     10.0.0.0
  SQL Server 2008 R2  10.0.0.0  (Uses the previous SMO)
  SQL Server 2012     11.0.0.0
  SQL Server 2014     12.0.0.0
  SQL Server 2016     13.0.0.0
  
  -->
  
  
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.SqlServer.Smo"
          publicKeyToken="89845dcd8080cc91"
          culture="neutral" />
         Assembly versions can be redirected in application, 
          publisher policy, or machine configuration files. 
        <bindingRedirect oldVersion="11.0.0.0" newVersion="12.0.0.0" />
      </dependentAssembly>

      <dependentAssembly>
        <assemblyIdentity name="Microsoft.SqlServer.ConnectionInfo"
          publicKeyToken="89845dcd8080cc91"
          culture="neutral" />
         Assembly versions can be redirected in application, 
          publisher policy, or machine configuration files. 
        <bindingRedirect oldVersion="11.0.0.0" newVersion="12.0.0.0" />
      </dependentAssembly>


      <dependentAssembly>
        <assemblyIdentity name="Microsoft.SqlServer.ConnectionInfoExtended"
          publicKeyToken="89845dcd8080cc91"
          culture="neutral" />
         Assembly versions can be redirected in application, 
          publisher policy, or machine configuration files. 
        <bindingRedirect oldVersion="11.0.0.0" newVersion="12.0.0.0" />
      </dependentAssembly>

      <dependentAssembly>
        <assemblyIdentity name="Microsoft.SqlServer.Management.Sdk.Sfc"
          publicKeyToken="89845dcd8080cc91"
          culture="neutral" />
         Assembly versions can be redirected in application, 
          publisher policy, or machine configuration files. 
        <bindingRedirect oldVersion="11.0.0.0" newVersion="12.0.0.0" />
      </dependentAssembly>

      <dependentAssembly>
        <assemblyIdentity name="Microsoft.SqlServer.SmoExtended"
          publicKeyToken="89845dcd8080cc91"
          culture="neutral" />
         Assembly versions can be redirected in application, 
          publisher policy, or machine configuration files. 
        <bindingRedirect oldVersion="11.0.0.0" newVersion="12.0.0.0" />
      </dependentAssembly>


      <dependentAssembly>
        <assemblyIdentity name="Microsoft.SqlServer.SqlEnum"
          publicKeyToken="89845dcd8080cc91"
          culture="neutral" />
         Assembly versions can be redirected in application, 
          publisher policy, or machine configuration files. 
        <bindingRedirect oldVersion="11.0.0.0" newVersion="12.0.0.0" />
      </dependentAssembly>

    </assemblyBinding>
  </runtime>
  
</configuration>

#6

I am getting the same error. Have SQL Server 2016 and SSMS installed. Tried adding the from 12.0.0.0 to 13 but still get the error?

Files to process: 8 ( 3,687.1 MB )
Starting at: 1/19/2017 3:07:51 PM
Clearing Target Tables...


Processing: Untitled - 1.trc


Trace File Read Error in C:\Downloads\DBBackups\Untitled - 1.trc (Exception has been thrown by the target of an invocation.)
Inner Exception: Exception has been thrown by the target of an invocation.
Inner Exception: Failed to initialize object as reader.
Inner Exception: Could not load file or assembly 'Microsoft.SqlServer.Instapi, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
You can visit the support forum at http://forums.sqlteam.com/c/cleartrace
Done.

Here is the config file maybe something is wrong or missing?

<?xml version="1.0"?>
  <dependentAssembly>
    <assemblyIdentity name="Microsoft.SqlServer.Smo"
      publicKeyToken="89845dcd8080cc91"
      culture="neutral" />
     Assembly versions can be redirected in application, 
      publisher policy, or machine configuration files. 
    <bindingRedirect oldVersion="12.0.0.0" newVersion="13.0.0.0" />
  </dependentAssembly>

  <dependentAssembly>
    <assemblyIdentity name="Microsoft.SqlServer.ConnectionInfo"
      publicKeyToken="89845dcd8080cc91"
      culture="neutral" />
     Assembly versions can be redirected in application, 
      publisher policy, or machine configuration files. 
    <bindingRedirect oldVersion="12.0.0.0" newVersion="13.0.0.0" />
  </dependentAssembly>


  <dependentAssembly>
    <assemblyIdentity name="Microsoft.SqlServer.ConnectionInfoExtended"
      publicKeyToken="89845dcd8080cc91"
      culture="neutral" />
     Assembly versions can be redirected in application, 
      publisher policy, or machine configuration files. 
    <bindingRedirect oldVersion="12.0.0.0" newVersion="13.0.0.0" />
  </dependentAssembly>

  <dependentAssembly>
    <assemblyIdentity name="Microsoft.SqlServer.Management.Sdk.Sfc"
      publicKeyToken="89845dcd8080cc91"
      culture="neutral" />
     Assembly versions can be redirected in application, 
      publisher policy, or machine configuration files. 
    <bindingRedirect oldVersion="12.0.0.0" newVersion="13.0.0.0" />
  </dependentAssembly>

  <dependentAssembly>
    <assemblyIdentity name="Microsoft.SqlServer.SmoExtended"
      publicKeyToken="89845dcd8080cc91"
      culture="neutral" />
     Assembly versions can be redirected in application, 
      publisher policy, or machine configuration files. 
    <bindingRedirect oldVersion="12.0.0.0" newVersion="13.0.0.0" />
  </dependentAssembly>


  <dependentAssembly>
    <assemblyIdentity name="Microsoft.SqlServer.SqlEnum"
      publicKeyToken="89845dcd8080cc91"
      culture="neutral" />
     Assembly versions can be redirected in application, 
      publisher policy, or machine configuration files. 
    <bindingRedirect oldVersion="12.0.0.0" newVersion="13.0.0.0" />
  </dependentAssembly>
</assemblyBinding>

#7

Well bummer. Let me do some more testing. I'm not sure exactly what's going on though.