<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>SQLServer Support France</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/support_sql_france/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/support_sql_france/feed.xml</link>
    <description>Le blog de l&amp;#039;équipe de support francophone des technologies de base de données Microsoft : SQL Server, Reporting Services (SSRS), Integration Services (SSIS), Analysis Services (SSAS). Echanges, bonnes pratiques, retours d&amp;#039;expérience...</description>
    <lastBuildDate>Tue, 16 Apr 2019 05:32:21 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>New installation of SQL Server 2017 failing with 'VS Shell installation has failed with exit code 1638'</title>
      <link>https://docs.microsoft.com/archive/blogs/support_sql_france/new-installation-of-sql-server-2017-failing-with-vs-shell-installation-has-failed-with-exit-code-1638</link>
      <pubDate>Mon, 26 Mar 2018 14:20:37 GMT</pubDate>
      <dc:creator><![CDATA[Guillaume Fourrat [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/support_sql_france/?p=335</guid>
      <description><![CDATA[Dear all,

As I am myself exploring our new Microsoft SQL Server 2017, I encountered this error...]]></description>
      <content:encoded><![CDATA[Dear all,

As I am myself exploring our new Microsoft SQL Server 2017, I encountered this error when installing a <em>second</em> instance of SQL Server.
<pre style="padding-left: 60px">TITLE: Microsoft SQL Server 2017 Setup
------------------------------

The following error has occurred:

VS Shell installation has failed with exit code 1638.</pre>
What was more surprising is that the 1st instance installation went perfectly well. I suspect my interleave of SSMS installation between both might have been the cause.

Anyway, the important thing is that situation is covered by KB <a href="https://support.microsoft.com/en-us/help/4092997/vc-2015-redistributable-install-error-1638-when-newer-version-present">4092997</a> and as indicated in the KB, a simple Repair of 'Microsoft Visual C++ 2015 Redistributable (x64)' followed by a server restart cleared the problem for me. We're working on making the interactive link of the pop-up message a bit more useful than it is today.

Thanks,

Guillaume Fourrat

Escalation Engineer]]></content:encoded>
    </item>
    <item>
      <title>Some more info on message 17890 'A significant part of sql server process memory has been paged out'</title>
      <link>https://docs.microsoft.com/archive/blogs/support_sql_france/some-more-info-on-message-17890-a-significant-part-of-sql-server-process-memory-has-been-paged-out</link>
      <pubDate>Tue, 06 Jun 2017 12:52:20 GMT</pubDate>
      <dc:creator><![CDATA[Guillaume Fourrat [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/support_sql_france/?p=316</guid>
      <description><![CDATA[Hi All,

This message, which has error ID 17890  is a rather common troublemaker, as the number of...]]></description>
      <content:encoded><![CDATA[Hi All,

This message, which has error ID 17890  is a rather common troublemaker, as the number of web search hits against it will show.

Example :
<pre>A significant part of sql server process memory has been paged out. This may result in a performance degradation. Duration: 7215 seconds. Working set (KB): 7901284, committed (KB): 17040596, memory utilization: 46%.</pre>
Some previous blog <a href="https://blogs.msdn.microsoft.com/karthick_pk/2012/06/22/a-significant-part-of-sql-server-process-memory-has-been-paged-out/">posts </a>have already given a good kit to understand and address the situation. This blog post's purpose is to give a clear explanation on the last value : <strong>'memory utilization'</strong>, which is often misunderstood : is it the total server memory payload ? Is it the percentage of RAM used by SQL Server ?

The answer is <strong>this value is simply the ratio of the Working set vs the Committed Bytes</strong> (ie. both values reported just before in the same error message).

So here : 7'901'284*100/17'040'596 = 46.37  ≈ 46%.

In other words, it represents how much of the process' committed virtual memory is actually in physical RAM for the <em>current</em> SQL Server instance, so this is fully specific to SQL Server process/instance, it doesn't directly reflect any system-wide information. To make it clear, lower percentages are obviously less desirable, and 100% would mean our process is fully in physical memory, <em>not</em> that we use 100% of system RAM (see the other two values for actual memory consumption information). T<strong>he message 17890 is generated when the ratio is below 50%</strong>.

Also, after the first occurence, the message appears at intervals if the condition is still in place, so repeated messages would likely indicate a persisting situation, not an 'oscillating' one. And there would therefore not be any correlated point-in-time event to be found at system level for later occurences (since they would only be driven by SQL Server's internal timer). Oh and the interval is not fixed, it will dynamically increase by steps from 5 minutes to a full day such as not to flood the errorlog if the situation remains the same for long, so keep that in mind when trying to establish if and when the situation was alleviated. I usually see the max interval being reached on low utilization instances like Windows Internal Databases (WID).

Finally, while this may appear like a clear-cut situation, the definition of Working Set can introduce some subtleties which in some rare cases could lead this message to appear outside actual memory stress conditions, so confirming if there is indeed a system-wide memory stress is the main priority when dealing with 17890. WID are again good candidates here, as they are likely to run on large hardware where SQL Server (WID) activity is very limited and not the main payload by far. But that is beyond the scope of this current post.

Hope this helps !

&nbsp;

Guillaume Fourrat

Escalation Engineer]]></content:encoded>
    </item>
    <item>
      <title>Detecting Possible Parameter Sniffing Occurences with DMV</title>
      <link>https://docs.microsoft.com/archive/blogs/support_sql_france/detecting-possible-parameter-sniffing-occurences-with-dmv</link>
      <pubDate>Mon, 05 Sep 2016 12:56:34 GMT</pubDate>
      <dc:creator><![CDATA[Guillaume Fourrat [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/support_sql_france/?p=295</guid>
      <description><![CDATA[Hi All,

Parameter Sniffing is a scenario which most DBAs had to handle at some point. Usually the...]]></description>
      <content:encoded><![CDATA[Hi All,

Parameter Sniffing is a scenario which most DBAs had to handle at some point. Usually the main challenge is to detect it, as the toolkit to address it is well known and documented. To help in the detection phase, here's a rather simple query that will just report queries which have a large gap between their minimum and maximum resource consumption values (100 by default). Although not guaranteed parameter sniffing occurences, the content of the short list the query will return should receive a quick review : that means that a given plan has been executed with massively different resource usage, and one could assume that one same plan shouldn't be optimal over that whole range of situation.

By enabling the filter for Duration and resource consumption (CPU, IO or both) one can filter out the impact of blocking (which <em>doesn'</em>t increase resource consumption).

Looking at resultset's rowcount variance is advised, but TOP and Aggregates queries will have a stable rowcount that may mask a vastly different amount of data accessed to produce the result, so a lack of difference is not a reliable indicator (a large difference, on the other hand, is a further confirmation).

The 100 factor can easily be tweaked for finer or coarser grain detection depending on environments.
<blockquote><span style="color: #0000ff;font-family: Consolas;font-size: small">declare</span><span style="font-family: Consolas;font-size: small"> @cpufactor </span><span style="color: #0000ff;font-family: Consolas;font-size: small">int</span>

<span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small">declare</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> @iofactor </span></span><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small">int</span></span></span>

<span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small">declare</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> @durationfactor </span></span><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small">int</span></span></span>

/* parameter sniffing will usually lead to large CPU, IO and Duration increases.

checking duration only might fail to distinguish it from blocking problems*/

<span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small">set</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> @cpufactor</span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">=</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small">100 </span></span><span style="color: #008000;font-family: Consolas;font-size: small"><span style="color: #008000;font-family: Consolas;font-size: small"><span style="color: #008000;font-family: Consolas;font-size: small">/* 0 disables*/</span></span></span>

<span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small">set</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> @iofactor</span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">=</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small">100 </span></span><span style="color: #008000;font-family: Consolas;font-size: small"><span style="color: #008000;font-family: Consolas;font-size: small"><span style="color: #008000;font-family: Consolas;font-size: small">/* 0 disables*/</span></span></span>

<span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small">set</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> @durationfactor </span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">=</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> 100 </span></span><span style="color: #008000;font-family: Consolas;font-size: small"><span style="color: #008000;font-family: Consolas;font-size: small"><span style="color: #008000;font-family: Consolas;font-size: small">/* 0 disables*/</span></span></span>

<span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small">select</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> </span></span>

<span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> </span></span><span style="color: #ff00ff;font-family: Consolas;font-size: small"><span style="color: #ff00ff;font-family: Consolas;font-size: small"><span style="color: #ff00ff;font-family: Consolas;font-size: small">SUBSTRING</span></span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">(</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small">ST</span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">.</span></span></span><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small">text</span></span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">,</span></span></span><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small"> </span></span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">(</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small">QS</span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">.</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small">statement_start_offset</span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">/</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small">2</span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">)</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> </span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">+</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> 1</span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">,</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> </span></span>

<span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small"> </span></span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">((</span></span></span><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small">CASE</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> statement_end_offset </span></span>

<span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> </span></span><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small">WHEN</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> </span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">-</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small">1 </span></span><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small">THEN</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> </span></span><span style="color: #ff00ff;font-family: Consolas;font-size: small"><span style="color: #ff00ff;font-family: Consolas;font-size: small"><span style="color: #ff00ff;font-family: Consolas;font-size: small">DATALENGTH</span></span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">(</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small">ST</span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">.</span></span></span><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small">text</span></span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">)</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> </span></span>

<span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> </span></span><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small">ELSE</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> QS</span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">.</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small">statement_end_offset </span></span><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small">END</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> </span></span>

<span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> </span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">-</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> QS</span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">.</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small">statement_start_offset</span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">)/</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small">2</span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">)</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> </span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">+</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> 1</span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">)</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> </span></span><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small">AS</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> statement_text </span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">,</span></span></span>

<span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> ST</span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">.</span></span></span><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small">text</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> </span></span><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small">as</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> </span></span><span style="color: #ff0000;font-family: Consolas;font-size: small"><span style="color: #ff0000;font-family: Consolas;font-size: small"><span style="color: #ff0000;font-family: Consolas;font-size: small">'full batch'</span></span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">,</span></span></span>

<span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> query_hash</span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">,</span></span></span>

<span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> query_plan_hash</span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">,</span></span></span>

<span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> </span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">*</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> </span></span>

<span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small">from</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> </span></span><span style="color: #00ff00;font-family: Consolas;font-size: small"><span style="color: #00ff00;font-family: Consolas;font-size: small"><span style="color: #00ff00;font-family: Consolas;font-size: small">sys</span></span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">.</span></span></span><span style="color: #00ff00;font-family: Consolas;font-size: small"><span style="color: #00ff00;font-family: Consolas;font-size: small"><span style="color: #00ff00;font-family: Consolas;font-size: small">dm_exec_query_stats</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> </span></span><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small">AS</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> QS </span></span>

<span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">CROSS</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> </span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">APPLY</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> </span></span><span style="color: #00ff00;font-family: Consolas;font-size: small"><span style="color: #00ff00;font-family: Consolas;font-size: small"><span style="color: #00ff00;font-family: Consolas;font-size: small">sys</span></span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">.</span></span></span><span style="color: #00ff00;font-family: Consolas;font-size: small"><span style="color: #00ff00;font-family: Consolas;font-size: small"><span style="color: #00ff00;font-family: Consolas;font-size: small">dm_exec_sql_text</span></span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">(</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small">QS</span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">.</span></span></span><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small">sql_handle</span></span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">)</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> </span></span><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small"><span style="color: #0000ff;font-family: Consolas;font-size: small">as</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> ST</span></span>

where

<span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> </span></span><span style="color: #008000;font-family: Consolas;font-size: small"><span style="color: #008000;font-family: Consolas;font-size: small"><span style="color: #008000;font-family: Consolas;font-size: small">/*'strictly smaller than' will rule out any 0 values from resultset*/</span></span></span>

<span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> @cpufactor </span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">*</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> min_worker_time </span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">&lt;</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> max_worker_time</span></span>

<span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> </span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">and</span></span></span>

<span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> @iofactor </span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">*</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> min_logical_reads </span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">&lt;</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> max_logical_reads</span></span>

<span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> </span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">and</span></span></span>

<span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> @durationfactor </span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">*</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> min_elapsed_time </span></span><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small"><span style="color: #808080;font-family: Consolas;font-size: small">&lt;</span></span></span><span style="font-family: Consolas;font-size: small"><span style="font-family: Consolas;font-size: small"> max_elapsed_time</span></span></blockquote>
&nbsp;

&nbsp;

&nbsp;

Thanks,

Guillaume Fourrat

Escalation Engineer]]></content:encoded>
    </item>
    <item>
      <title>Service Broker - Upgrade</title>
      <link>https://docs.microsoft.com/archive/blogs/support_sql_france/service-broker-upgrade</link>
      <pubDate>Mon, 09 May 2016 13:22:33 GMT</pubDate>
      <dc:creator><![CDATA[Romain Casteres]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/support_sql_france/?p=286</guid>
      <description><![CDATA[&nbsp;
Avec la fin du support de SQL Server 2005 (12 Avril 2016) un grand nombre d’instances chez...]]></description>
      <content:encoded><![CDATA[&nbsp;
<p style="text-align: justify">Avec la fin du support de SQL Server 2005 (<strong>12 Avril 2016</strong>) un grand nombre d’instances chez les clients doivent être migrées.</p>
<a href="https://www.PulsWeb.fr/wp-content/uploads/2016/05/SQLServer_2005.png"><img class="aligncenter size-large wp-image-4437" src="https://www.PulsWeb.fr/wp-content/uploads/2016/05/SQLServer_2005-1024x339.png" alt="SQLServer_2005" width="670" height="222" /></a>
<p style="text-align: center"><a href="https://www.microsoft.com/en-us/server-cloud/products/sql-server-2005/" target="_blank">https://www.microsoft.com/en-us/server-cloud/products/sql-server-2005/</a></p>
&nbsp;
<p style="text-align: justify">Il existe plusieurs livres blancs et articles sur la migration de SQL Server mais peu d’entre eux évoquent le sujet tant redouté, … Service Broker !</p>
<p style="text-align: justify">SQL Server Service Broker (SSB) fournit la prise en charge native des applications de messagerie et de mise en file d'attente dans le Moteur de base de données. Construit autour des fonctions de base d'envoi et de réception de messages, il permet entre autres de traiter une file de traitement en asynchrone.</p>
<p style="text-align: justify"><span style="text-decoration: underline">Exemples d’utilisation :</span></p>
- Envoi de messages de traitement de paiements à une file d'attente qui sera traité durant la nuit lorsque le serveur aura une charge d’utilisation inférieure.
- Envoi de messages sur plusieurs serveurs / processus / Threads pour maximiser la façon dont votre file d'attente est traitée.
- …
<br>
<p style="text-align: justify">Bref, l’utilité de Service Broker n’est plus à démontrer. Il est d’ailleurs utilisé dans de nombreux produits Microsoft comme <a href="https://www.microsoft.com/fr-fr/server-cloud/products/system-center-2012-r2-configuration-manager/overview.aspx" target="_blank">SCCM</a>, <a href="https://C:\Users\romainca\OneDrive\ARTICLES\ServiceBroker\SharePoint" target="_blank">SharePoint</a>, <a href="https://msdn.microsoft.com/en-us/library/ff487003.aspx" target="_blank">MDS</a>, ...</p>
<p style="text-align: justify">Dans cet article, j’évoquerai pourquoi il est important de suivre le cycle de supportabilité des versions de SQL Server, je présenterai les nouveautés du service au fil des versions. Pour finir nous verrons les difficultés de la migration du service à travers un exemple concret : La migration d’une base de données SQL Server 2005 à SQL Server 2014 et reprise de la communication Service Broker à partir d’une base de données SQL Server 2016.</p>
<a href="https://www.PulsWeb.fr/wp-content/uploads/2016/05/ServiceBroker.png"><img class="aligncenter size-full wp-image-4438" src="https://www.PulsWeb.fr/wp-content/uploads/2016/05/ServiceBroker.png" alt="ServiceBroker" width="353" height="290" /></a>
<p style="text-align: justify"><span style="text-decoration: underline">Remarque : Dans la suite de l’article j’utiliserai les abréviations suivantes.</span></p>
- Serveur A : Serveur local avec SQL Server 2016 et la base de données « DatabaseA ».
- Serveur B : VM avec SQL Server 2005 et la base de données « DatabaseB ».
- Serveur C : VM avec SQL Server 2014 et la base de données « DatabaseB » une fois migrée.


&nbsp;
<h4><span style="color: #993300">1 - Actualisation</span></h4>
<p style="text-align: justify">La fin de support se réfère à la date à laquelle Microsoft ne fournit plus de corrections, de mise à jour ou encore d’assistances techniques en ligne. Il est donc plus que risqué de ne pas tenir compte de la supportabilité des versions.</p>
<p style="text-align: justify"><span style="text-decoration: underline">Microsoft Support Life Cycle de SQL Server :</span></p>
<a href="https://www.PulsWeb.fr/wp-content/uploads/2016/05/SQLServer_Support.jpg"><img class="aligncenter size-full wp-image-4439" src="https://www.PulsWeb.fr/wp-content/uploads/2016/05/SQLServer_Support.jpg" alt="SQLServer_Support" width="600" height="150" /></a>

&nbsp;
<p style="text-align: justify">La politique d’actualisation de SQL Server a été mi-à jour récemment, il est dorénavant fortement conseillé d’installer les CUs au même titre que les SP : <a href="https://blogs.msdn.microsoft.com/sqlreleaseservices/announcing-updates-to-the-sql-server-incremental-servicing-model-ism/" target="_blank">Announcing updates to the SQL Server Incremental Servicing Model (ISM)</a>.</p>
<p style="text-align: justify"><span style="text-decoration: underline">Il existe deux stratégies principales pour la mise à niveau :</span></p>
- Mise à niveau sur place (In Place) : Utilisez le programme d'installation de SQL Server 2014 pour mettre à jour directement une instance de SQL Server 2005, 2008, 2008 R2, ou 2012. L'ancienne instance de SQL Server est remplacée.
- Mise à niveau sur une nouvelle instance (Side-by-side) : Effectuez les étapes pour déplacer tout ou partie des données à partir d'une instance vers une autre. L’instance peut être sur le même serveur ou sur un serveur distant.

<a href="https://www.PulsWeb.fr/wp-content/uploads/2016/05/SQLServer_Upgrade.png"><img class="aligncenter wp-image-4442" src="https://www.PulsWeb.fr/wp-content/uploads/2016/05/SQLServer_Upgrade.png" alt="SQLServer_Upgrade" width="651" height="262" /></a>
<p style="text-align: justify">Remarque : Je ne présenterai pas les inconvénients, avantages des deux modes d’upgrade dans cet article.</p>
&nbsp;
<h4><span style="color: #993300">2 – Service Broker : Présentation</span></h4>
<p style="text-align: justify">SQL Server Service Broker (SSB) a été introduit avec SQL Server 2005, et permet d’envoyer et de recevoir des messages afin de déporter leurs traitements dans une application tierce ou sur une autre base de données d’une même instance ou d’une instance distante.</p>
<a href="https://www.PulsWeb.fr/wp-content/uploads/2016/05/Service_Broker.png"><img class="aligncenter wp-image-4443" src="https://www.PulsWeb.fr/wp-content/uploads/2016/05/Service_Broker.png" alt="Service_Broker" width="501" height="327" /></a>
<p style="text-align: justify"><span style="text-decoration: underline">Un Service Broker se compose des quatre objets suivants :</span></p>
<p style="text-align: justify">1. Le type de message : En anglais « <em>Message types</em> », définit le type de données que contient un message (Empty, None, Valid_XML, Well_Formed_XML).</p>

<pre>CREATE MESSAGE TYPE SenderMessageType VALIDATION=NONE
CREATE Message TYPE ReceiverMessageType VALIDATION=NONE</pre>
<p style="text-align: justify">2. Un contrat : En anglais « <em>Contracts </em>», definit les types de messages d’un service Service Broker. C’est un accord entre deux services Service Broker (Un contrat par base de données qui participe à une conversation).</p>

<pre>CREATE Contract SampleContract (
SenderMessageType SENT BY INITIATOR,
ReceiverMessageType SENT BY TARGET
)</pre>
<p style="text-align: justify">3. Une queue : En anglais « <em>Queue </em>», est une file d’attente pour les messages reçus. Lorsque Service Broker reçoit un message, il l’insère dans la file d’attente associée au service cible après l’avoir validé.</p>

<pre>CREATE Queue InitiatorQueue WITH status = ON</pre>
<p style="text-align: justify">4. Un programme de service : En anglais « <em>Service program</em> », traite les messages entrants à partir d’une file d’attente.</p>

<pre>CREATE Service SenderService ON QUEUE InitiatorQueue (SampleContract)</pre>
<p style="text-align: justify">5. Une route, un itinéraire : En anglais « <em>Route </em>», spécifie le réseau sur lequel l'adresse d'un service Service Broker est située.</p>

<pre>CREATE Route RouteA WITH
SERVICE_NAME = 'ReceiverService',
-- BROKER_INSTANCE = 'F6186F80-7DDA-4A7D-B08A-9931A02379D4',
ADDRESS = 'TCP://WIN-ADINKEGG0ER:4022'
GO</pre>
<p style="text-align: justify">Dans la Route ci-dessus, ReceiverService est le service cible du serveur B. Si on ne spécifie par de « BROKER_INSTANCE » alors le service avec un nom similaire sera choisi au hasard par le serveur. Il est donc préférable de spécifier le « service_broker_guid » de la base de données cible (Depuis le serveur B SELECT service_broker_guid FROM sys.databases WHERE name = 'DatabaseA').</p>
&nbsp;
<p style="text-align: justify"><span style="text-decoration: underline">Voici les différentes étapes d’un dialogue :</span></p>
<p style="text-align: justify">De l'initiation d'un dialogue a la réception en passant par les ou les accusés de réception...</p>
<a href="https://www.PulsWeb.fr/wp-content/uploads/2016/05/ServiceBroker_Contract.png"><img class="aligncenter wp-image-4445" src="https://www.PulsWeb.fr/wp-content/uploads/2016/05/ServiceBroker_Contract.png" alt="ServiceBroker_Contract" width="600" height="396" /></a>

&nbsp;
<h4><span style="color: #993300">3 – Service Broker : Sécurité</span></h4>
<p style="text-align: justify">Service Broker fournit deux types de sécurité, la compréhension de ces deux types de sécurité et la façon dont ils travaillent ensemble est primordiale pour concevoir, déployer et administrer des applications Service Broker :</p>
• Transport security : Etablit une connexion réseau authentifiée entre deux instances SQL Server.
• Dialog security : Etablit une communication encryptée entre deux services Service Broker.

&nbsp;

<a href="https://www.PulsWeb.fr/wp-content/uploads/2016/05/SQLServer_SSB.gif"><img class="aligncenter size-full wp-image-4446" src="https://www.PulsWeb.fr/wp-content/uploads/2016/05/SQLServer_SSB.gif" alt="SQLServer_SSB" width="503" height="330" /></a>

&nbsp;
<p style="text-align: justify"><span style="text-decoration: underline">Pour mettre en place la sûreté du transport, depuis la base de données « Master » :</span></p>

<pre>USE master
GO

-- 1. Create a master key for master database.
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'Romain.Casteres_PulsWeb.fr'
GO

-- 2. Create certificate and End Point that support certificate based authentication 
CREATE Certificate EndPointCertificateA
WITH Subject = 'A.Server.Local',
    START_DATE = '01/01/2006',
    EXPIRY_DATE = '01/01/2018'
    ACTIVE FOR BEGIN_DIALOG = ON;
GO

-- 3. Take a backup of the certificate created and install it into the remote instance by physically copying this certificate to Other Server.
BACKUP CERTIFICATE EndPointCertificateA TO FILE = 'C:\temp\EndPointCertificateA.cer';
GO

-- 4. Create certificate from the certificate backup file copied from the other server.
CREATE CERTIFICATE EndPointCertificateB From FILE = 'C:\temp\EndPointCertificateB.cer';
GO

-- 5. Create login from the certificate in remote server in the current server.
CREATE LOGIN sbLogin FROM CERTIFICATE EndPointCertificateB;
GO

-- 6. Grant the login, connect permissions on the end point.
GRANT CONNECT ON ENDPOINT::ServiceBrokerEndPoint To sbLogin
GO
</pre>
<p style="text-align: justify"><span style="text-decoration: underline">Pour mettre en place la sûreté du dialogue, depuis la base de données « DatabaseA » :</span></p>

<pre>Use DatabaseA
GO

-- 1. Create a master key for master DatabaseA.
CREATE Master Key Encryption BY Password = 'Romain.Casteres@PulsWeb.fr'
GO

-- 2. Create a user certificate. 
CREATE Certificate UserCertificateA
 WITH Subject = 'A.Server.Local',
    START_DATE = '01/01/2006',
    EXPIRY_DATE = '01/01/2018'
    ACTIVE FOR BEGIN_DIALOG = ON;
GO

-- 3. Take a backup of the user certificate created and install it into the remote instance.
BACKUP CERTIFICATE UserCertificateA TO FILE='C:\temp\UserCertificateA.cer';
GO

-- 4. Create a user with the same name as the user who has access rights on the other Database.
CREATE User UserB WITHOUT LOGIN
GO

-- 5. Create a user certificate from the user certificate backup file copied from the other server, with authorization to the user created in Step 4.
CREATE CERTIFICATE UserCertificateB 
	AUTHORIZATION UserB
	FROM FILE = 'C:\temp\UserCertificateB.cer';
GO

-- 6. Grant connect permissions to the user.
GRANT CONNECT TO UserB;

-- 7. Grant send permissions to the user on the local service.
GRANT SEND ON SERVICE::SenderService To UserB;
GO

-- 8)Create a Remote Service Binding with the user created.
CREATE REMOTE SERVICE BINDING ServiceBindingB TO SERVICE 'ReceiverService' WITH USER = UserB
</pre>
<p style="text-align: justify">Remarques : Si communication entre deux bases de données d'une même instance la sécurité du transport n'est pas nécessaire.</p>
&nbsp;
<h4><span style="color: #993300">3 – Service Broker : Nouveautés</span></h4>
<p style="text-align: justify"><span style="text-decoration: underline">Voici les nouveautés du Service Broker par versions de SQL Server :</span></p>
- SQL Server 2008 :
o GUI
o Priorities Service Broker messages and diagnostic tool
o Allow disabling poison message handling but this can result in an infinite loop of failures and it is not recommended
- SQL Server 2012 :
o Service Broker Statistics Reports
o Messages can be sent to multiple target services (multicast) : The syntax of the SEND (Transact-SQL) statement has been extended to enable multicast by supporting multiple conversation handles.
o Queues expose the message enqueued time : Queues have a new column, message_enqueue_time, that shows how long a message has been in the queue.
o Poison message handling can be disabled : The CREATE QUEUE (Transact-SQL) and ALTER QUEUE (Transact-SQL) statements now have the ability to enable or disable poison message handling by adding the clause, POISON_MESSAGE_HANDLING (STATUS = ON | OFF). The catalog view sys.service_queues now has the column is_poison_message_handling_enabled to indicate whether poison message is enabled or disabled.
o AlwaysOn support in Service Broker : For more information, see Service Broker with AlwaysOn Availability Groups (SQL Server).
- SQL Server 2014 :
o More detailed support in SQL Server Management Studio (SSMS)
o Windows System Monitor objects and counters
o Tutorials to help you get started with Service Broker
o More flexible activation options
o SQL Server 2014 no longer supports the Itanium-based architecture.


&nbsp;
<h4><span style="color: #993300">4 – Service Broker : Upgrade Démo</span></h4>
<p style="text-align: justify">Voici le scénario de la démonstration : La base de données « DatabaseB » du serveur B situé dans l’instance SQL Server 2005 doit être migrée sur une autre instance SQL Server 2014 du serveur C. Après la migration, le serveur A doit pouvoir communiquer avec la base de données restaurée.</p>
<a href="https://www.PulsWeb.fr/wp-content/uploads/2016/05/ServiceBroker.png"><img class="aligncenter size-full wp-image-4438" src="https://www.PulsWeb.fr/wp-content/uploads/2016/05/ServiceBroker.png" alt="ServiceBroker" width="353" height="290" /></a>
<p style="text-align: justify"><span style="text-decoration: underline">Définitions des différentes étapes :</span></p>
- Initialisation.
- Backup Database "DatabaseB" depuis l’instance SQL Server 2005 et restauration sur l’instance SQL Server 2014.
- Configuration de la sécurité (Transport security et Dialog security).
- Test de la communication.

&nbsp;
<p style="text-align: justify"><strong>4.1 - Initialisation</strong></p>
<p style="text-align: justify"><span style="text-decoration: underline">Étapes pour créer une application Service Broker Distribué :</span></p>

<p style="text-align: justify">1. Création des bases du Service Broker (messages types, contracts, services, queues).</p>

<p style="text-align: justify">2. Création du Transport Security:</p>
a. Création de la Master Key de la base de données Master
b. Création du certificat et de l’End Point prennent en charge l'authentification basée sur les certificats.
c. Backup du certificat créé et installation de celui ci sur l’instance distante.
d. Création d’un certificat à partir du backup copié de l’autre instance.
e. Création d’un Login à partir du certificat créé à l’étape précédente
f. Grant des permissions Connect sur le End Point
Certaines étapes sont à effectuer sur les deux serveurs.

<p style="text-align: justify">3. Set up Dialog Security:</p>
a. Création d’une Master Key sur la base donnée utilisateur (celle utilisée par votre application)
b. Création d’un certificat utilisateur
c. Création d’un Backup du certificate utilisateur et installation de celui-ci sur l’instance distante.
d. Créez un utilisateur avec le même nom que l'utilisateur qui a des droits d'accès sur l'autre base de données.
e. Create a user with the same name as the user who has access rights on the other Database.
f. Créer un certificat à partir du fichier de sauvegarde de certificat utilisateur copié sur l'autre serveur. (Cela permet l'autorisation de l'utilisateur créé à l'étape précédente)
g. Grant Connect autorisations à l'utilisateur.
h. Grant Send des autorisations à l'utilisateur sur le service local
i. Créer un service distant avec l'utilisateur créé.
<p style="text-align: justify">Certaines étapes sont à effectuer sur les deux serveurs.</p>

<p style="text-align: justify">4. Send Messages &amp; Receive Messages</p>

<p style="text-align: justify">Voici les deux scripts T-SQL pour initier l’architecture : <a href="https://onedrive.live.com/redir?resid=122632F975E9E8E1!177858&amp;authkey=!AIo_ZenwI8evoAs&amp;ithint=file%2czip" target="_blank">Lien</a>.</p>

&nbsp;
<p style="text-align: justify"><strong>4.2 – Backup &amp; Restore</strong></p>
<p style="text-align: justify">Après avoir finalisé toutes les discussions en cours, effectuer un backup de la base de données DatabaseB :</p>

<pre>SELECT * FROM sys.transmission_queue
SELECT * FROM sys.conversation_endpoints

ALTER DATABASE DatabaseB SET DISABLE_BROKER WITH ROLLBACK IMMEDIATE;
	
BACKUP DATABASE [DatabaseB] TO  DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\DatabaseB.bak' WITH NOFORMAT, NOINIT,  NAME = N'DatabaseB-Full Database Backup', SKIP, NOREWIND, NOUNLOAD,  STATS = 10
</pre>
<p style="text-align: justify">Sur l’instance cible, le serveur C sous SQL Server 2014 :</p>

<pre>USE [master]
GO

RESTORE DATABASE [DatabaseB] FROM  DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Backup\DatabaseB.bak' WITH  FILE = 2,  MOVE N'DatabaseB' TO N'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\DatabaseB.mdf',  MOVE N'DatabaseB_log' TO N'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\DatabaseB_log.LDF',  NOUNLOAD,  STATS = 5</pre>
<a href="https://www.PulsWeb.fr/wp-content/uploads/2016/05/DB_ServiceBroker.png"><img class="alignright wp-image-4456" src="https://www.PulsWeb.fr/wp-content/uploads/2016/05/DB_ServiceBroker.png" alt="DB_ServiceBroker" width="167" height="368" /></a>

<p style="text-align: justify"><span style="text-decoration: underline">Remarques :</span></p>
- La configuration du Service Broker dans la base de données « DatabaseB » est conservée après sa restauration, pas besoin de recréer les Messages Types, les Contracts, les Queues, les Services, les Routes ou encore le Bindings.
- Le Service Broker Guid de la base de données n’a pas changé.

<pre>SELECT service_broker_guid FROM sys.databases WHERE name = 'DatabaseB'</pre>

&nbsp;

&nbsp;
<p style="text-align: justify"><strong>4.3 - Transportation Security</strong></p>
<p style="text-align: justify">Pour reconfigurer le Transportation Security, il faut :</p>
<p style="text-align: justify">- Sur l’instance A :</p>
o Actualiser la Route
o Importer un certificat de la nouvelle instance
o Re-Créer le Login à partir du certificat
o Autoriser celui sur le Endpoint

<pre>ALTER DATABASE DatabaseA SET DISABLE_BROKER WITH ROLLBACK IMMEDIATE;
ALTER ROUTE RouteA WITH ADDRESS = 'TCP://192.168.0.39:4022';
ALTER DATABASE DatabaseA SET ENABLE_BROKER WITH ROLLBACK IMMEDIATE;

USE [master];
GO

DROP LOGIN sbLogin
DROP CERTIFICATE EndPointCertificateB

CREATE CERTIFICATE EndPointCertificateB From FILE = 'C:\temp\EndPointCertificateB.cer';
GO

CREATE LOGIN sbLogin FROM CERTIFICATE EndPointCertificateB;
GO

GRANT CONNECT ON ENDPOINT::ServiceBrokerEndPoint To sbLogin
GO
</pre>
<p style="text-align: justify">- Sur l’instance B :</p>
o Créer un certificat et le Backuper
o Créer le Endpoint
o Restaurer le certificat de l’instance A
o Créer le Login à partir du certificat
o Autoriser celui sur le Endpoint
<pre>USE [master];
GO

Create Certificate EndPointCertificateB
WITH Subject = 'B.Server.Local',
START_DATE = '01/01/2006',
EXPIRY_DATE = '01/01/2018'
ACTIVE FOR BEGIN_DIALOG = ON;
GO

CREATE ENDPOINT ServiceBrokerEndPoint
STATE=STARTED
AS TCP (LISTENER_PORT = 4022)
FOR SERVICE_BROKER (
AUTHENTICATION = CERTIFICATE EndPointCertificateB,
ENCRYPTION =DISABLED
);

BACKUP CERTIFICATE EndPointCertificateB TO FILE = 'C:\Temp\EndPointCertificateB.cer'

CREATE CERTIFICATE EndPointCertificateA FROM FILE = 'C:\Temp\EndPointCertificateA.cer';
GO

CREATE LOGIN sbLogin FROM CERTIFICATE EndPointCertificateA;
GO

GRANT CONNECT ON ENDPOINT::ServiceBrokerEndPoint To sbLogin
GO

SELECT * FROM sys.certificates;
SELECT * FROM sys.services;
SELECT * FROM sys.endpoints;
</pre>
<p style="text-align: justify">Remarque : Pour une restauration de la base de données sur une même instance, la Transportation Security n’est pas à actualiser. Seul le Dialog Security est à reconfigurer.</p>
&nbsp;
<p style="text-align: justify"><strong>4.4 - Dialog Security</strong></p>
<p style="text-align: justify">Lors de la restauration d’une base de données le service broker de celle-ci est désactivé. Pour le réactiver :</p>

<pre>ALTER DATABASE DatabaseB SET ENABLE_BROKER WITH ROLLBACK IMMEDIATE;</pre>
<p style="text-align: justify">Pour réencrypter les certificats avec la Master Key de la nouvelle instance :</p>

<pre>USE DatabaseB
GO

OPEN MASTER KEY DECRYPTION BY PASSWORD = '45Gme*3^&amp;fwu';
ALTER MASTER KEY ADD ENCRYPTION BY SERVICE MASTER KEY;
CLOSE MASTER KEY;
</pre>
&nbsp;
<p style="text-align: justify"><strong>4.5 - Test</strong></p>
<p style="text-align: justify">Voici un script de test permettant d’envoyer un message et de le recevoir.</p>
<p style="text-align: justify"><span style="text-decoration: underline">Depuis l’instance A :</span></p>

<pre>-- Send Messages
DECLARE @InitDlgHandle UNIQUEIDENTIFIER;
DECLARE @RequestMsg NVARCHAR(100);
BEGIN TRANSACTION;
BEGIN DIALOG @InitDlgHandle FROM SERVICE SenderService TO SERVICE 'ReceiverService' ON CONTRACT SampleContract WITH ENCRYPTION = OFF;
SELECT @RequestMsg = N'Message for Target service.';
SEND ON CONVERSATION @InitDlgHandle MESSAGE TYPE SenderMessageType (@RequestMsg);
SELECT @RequestMsg AS SentRequestMsg;
COMMIT TRANSACTION;
GO

-- Receive Response
DECLARE @RecvReplyMsg NVARCHAR(100);
DECLARE @RecvReplyDlgHandle UNIQUEIDENTIFIER;
BEGIN TRANSACTION;
WAITFOR
( RECEIVE TOP(1)
    @RecvReplyDlgHandle = conversation_handle,
    @RecvReplyMsg = message_body
  FROM InitiatorQueue
), TIMEOUT 1000;
END CONVERSATION @RecvReplyDlgHandle;
SELECT @RecvReplyMsg AS ReceivedReplyMsg;
COMMIT TRANSACTION;
GO

SELECT * FROM sys.transmission_queue
SELECT * FROM sys.conversation_endpoints
</pre>
<p style="text-align: justify"><span style="text-decoration: underline">Depuis l’instance B :</span></p>

<pre>-- Send Response
DECLARE @RecvReqDlgHandle UNIQUEIDENTIFIER;
DECLARE @RecvReqMsg NVARCHAR(max);
DECLARE @RecvReqMsgName sysname;
BEGIN TRANSACTION;
Print 'Started Receiving ';
WAITFOR
( RECEIVE TOP(1)
    @RecvReqDlgHandle = conversation_handle,
    @RecvReqMsg = message_body,
    @RecvReqMsgName = message_type_name
  FROM TargetQueue
), TIMEOUT 1000;
SELECT @RecvReqMsg AS ReceivedRequestMsg;
IF @RecvReqMsgName = 'SenderMessageType'
BEGIN
     DECLARE @ReplyMsg NVARCHAR(100);
     SELECT @ReplyMsg = N'Message is received';
     SEND ON CONVERSATION @RecvReqDlgHandle MESSAGE TYPE ReceiverMessageType (@ReplyMsg);
     END CONVERSATION @RecvReqDlgHandle;
END
SELECT @ReplyMsg AS SentReplyMsg;
COMMIT TRANSACTION;
GO

SELECT * FROM sys.transmission_queue
SELECT * FROM sys.conversation_endpoints
</pre>
&nbsp;
<h4><span style="color: #993300">5 – Troobleshooting</span></h4>
<p style="text-align: justify">Et parce que rien n’est toujours aussi simple que dans un article… Voici quelques outils pour le Troubleshooting :</p>
- SQL Server Profiler : Il permet d’analyser un certain nombre d’événements (Catégorie d'événements Broker : <a href="https://technet.microsoft.com/fr-fr/library/ms186347(v=sql.120).aspx" target="_blank">https://technet.microsoft.com/fr-fr/library/ms186347(v=sql.120).aspx</a>)

<a href="https://www.PulsWeb.fr/wp-content/uploads/2016/05/SQLServer_Profiler.png"><img class="aligncenter size-large wp-image-4449" src="https://www.PulsWeb.fr/wp-content/uploads/2016/05/SQLServer_Profiler-1024x462.png" alt="SQLServer_Profiler" width="670" height="302" /></a>

- Quelques DMV SQL Server : sys.dm_broker_activated_tasks, sys.dm_broker_connections, sys.dm_broker_forwarded_messages, sys.dm_broker_queue_monitors, …

- Compteur de performances : Service Broker a plusieurs compteurs de performance que vous pouvez capturer pour surveiller la santé et la performance de vos applications. Pour plus de détails : <a href="https://msdn.microsoft.com/en-us/library/ms190382.aspx" target="_blank">https://msdn.microsoft.com/en-us/library/ms190382.aspx</a>

<a href="https://www.PulsWeb.fr/wp-content/uploads/2016/05/SQLServerProfiler.png"><img class="aligncenter wp-image-4450" src="https://www.PulsWeb.fr/wp-content/uploads/2016/05/SQLServerProfiler.png" alt="SQLServerProfiler" width="650" height="466" /></a>

- Utilitaire ssbdiagnose : Disponible depuis SQL Server 2008, il permet de résoudre des problèmes dans la conversation ou dans la configuration entre deux services Service Broker : <a href="https://msdn.microsoft.com/en-us/library/bb934450.aspx" target="_blank">https://msdn.microsoft.com/en-us/library/bb934450.aspx</a>

Exemple, depuis une fenêtre de commande DOS :
<pre>ssbdiagnose -E CONFIGURATION FROM SERVICE SenderService -S ROMAINCA -d DatabaseA TO SERVICE ReceiverService -S 192.168.0.39 -d ECHO ON CONTRACT SampleContract</pre>
- Les dernières erreurs de SQL Server :
<pre>EXEC xp_ReadErrorLog 0, 1, NULL, NULL, NULL, NULL, 'DESC'</pre>

- Redemarrage de l’Endpoint :
<pre>USE master
GO
ALTER ENDPOINT ServiceBrokerEndPoint STATE = STOPPED;
GO
ALTER ENDPOINT ServiceBrokerEndPoint STATE = STARTED;
GO
</pre>

- Script T-SQL de suppression de toutes les conversations : [A UTILISER AVEC PRECAUTION !]
<pre>declare @conversation uniqueidentifier
while exists (select 1 from sys.transmission_queue )
begin
	set @conversation = (select top 1 conversation_handle from sys.transmission_queue )
	end conversation @conversation with cleanup
end

declare @conversationHandle uniqueidentifier
select top 1 @conversationHandle = conversation_handle from sys.conversation_endpoints
while @@rowcount = 1
begin
     end conversation @conversationHandle with cleanup
     select top 1 @conversationHandle = conversation_handle from sys.conversation_endpoints
end 
</pre>
&nbsp;
<h4><span style="color: #993300">6 – Conclusion</span></h4>
<p style="text-align: justify">En conclusion, Service Broker permet de créer une couche asynchrone pour vos applications et/ou permet de déporter le traitement de données dans une autre application. La migration du service peut s’avérer compliquée, mais elle ne doit pas être un frein à l’évolution de version de vos plateformes. En respectant certaines étapes listées dans cet article, vos migrations « devraient » bien se passer !</p>
<p style="text-align: justify"><span style="text-decoration: underline">Voici quelques liens et ressources complémentaires :</span></p>
- An Introduction to SQL Server Service Broker: <a href="https://msdn.microsoft.com/en-us/library/ms345108.aspx" target="_blank">https://msdn.microsoft.com/en-us/library/ms345108.aspx</a>
- Le livre le plus complet sur Service Broker “<a href="https://www.apress.com/9781590599990" target="_blank">Pro SQL Server 2008 Service Broker</a>” ecrit par by Klaus Aschenbrenner
- Building Reliable, Asynchronous Database Applications Using Service Broker: <a href="https://msdn.microsoft.com/en-us/library/ms345113.aspx" target="_blank">https://msdn.microsoft.com/en-us/library/ms345113.aspx</a>
- SQL Server Service Broker : <a href="https://msdn.microsoft.com/library/bb522893.aspx" target="_blank">https://msdn.microsoft.com/library/bb522893.aspx</a>
- <a href="https://download.microsoft.com/download/7/1/5/715BDFA7-51B6-4D7B-AF17-61E78C7E538F/SQL_Server_2014_Upgrade_technical_guide.pdf" target="_blank">SQL Server 2014 Upgrade technical guide</a>
- Supported Version and Edition Upgrades : <a href="https://msdn.microsoft.com/en-us/library/ms143393(v=sql.120).aspx" title="Supported Version and Edition Upgrades" target="_blank">https://msdn.microsoft.com/en-us/library/ms143393(v=sql.120).aspx
</a>
- How to troubleshoot Service Broker problems : <a href="https://www.sqlteam.com/article/how-to-troubleshoot-service-broker-problems" title="troubleshoot-service-broker-problems" target="_blank">https://www.sqlteam.com/article/how-to-troubleshoot-service-broker-problems</a>
- Service Broker: Performance and Scalability Techniques : <a href="https://msdn.microsoft.com/en-us/library/dd576261.aspx" target="_blank">https://msdn.microsoft.com/en-us/library/dd576261.aspx</a>
- SQL Server: Service Broker Tips and Tricks : <a href="https://myadventuresincoding.wordpress.com/2007/11/22/sql-server-service-broker-tips-and-tricks/" target="_blank">https://myadventuresincoding.wordpress.com/2007/11/22/sql-server-service-broker-tips-and-tricks/</a>
- Understanding SQL Server Service Broker Authentication : <a href="https://www.databasejournal.com/features/mssql/understanding-sql-server-service-broker-authentication.html" target="_blank">https://www.databasejournal.com/features/mssql/understanding-sql-server-service-broker-authentication.html</a>
- Using multiple routes in Service Broker : <a href="https://blogs.msdn.microsoft.com/sql_service_broker/2008/07/14/using-multiple-routes-in-service-broker/" target="_blank">https://blogs.msdn.microsoft.com/sql_service_broker/2008/07/14/using-multiple-routes-in-service-broker/</a>
- Blog de Dave Wentzel : <a href="https://www.davewentzel.com/taxonomy/term/343" target="_blank">https://www.davewentzel.com/taxonomy/term/343</a>
- Script de Troubleshooting Service Broker (SSB) : <a href="https://www.sqlservercentral.com/scripts/Maintenance+and+Management/31867/" target="_blank">https://www.sqlservercentral.com/scripts/Maintenance+and+Management/31867/</a>
- SQL Server Service Broker Team Blog : <a href="https://blogs.msdn.microsoft.com/sql_service_broker/" target="_blank">https://blogs.msdn.microsoft.com/sql_service_broker/</a>
[/list]
<p style="text-align: justify">Je tiens à remercier <strong>Nicolas Soukoff</strong> (PFE SQL Server), <strong>Olivier Aupetit</strong> (Support Escalade Eng.) et <strong>Sarah Bessard</strong> (DBA chez DCube) pour leurs aides sur le sujet. Merci à <strong>Érik Delepeleire</strong> (PFE SQL Server) pour la relecture de cet article.</p>

<br>
<p style="text-align: right"><strong>Romain Casteres</strong></p>
<p style="text-align: right">Premier Field Engineer &ndash; SQL &amp; BI &amp; Big Data&nbsp;</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>SQL Server's SPN autoregistration and ListenAll IP setting</title>
      <link>https://docs.microsoft.com/archive/blogs/support_sql_france/sql-servers-spn-autoregistration-and-listenall-ip-setting</link>
      <pubDate>Fri, 09 Oct 2015 02:40:07 GMT</pubDate>
      <dc:creator><![CDATA[Guillaume Fourrat [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/support_sql_france/2015/10/09/sql-servers-spn-autoregistration-and-listenall-ip-setting/</guid>
      <description><![CDATA[Hi Everyone !
Today we&rsquo;ll look at a the ListenAll settings of the SQL Server server-side...]]></description>
      <content:encoded><![CDATA[<p>Hi Everyone !</p>
<p>Today we&rsquo;ll look at a the ListenAll settings of the SQL Server server-side protocol.</p>
<p>When active, this setting will have SQL Server bind all available &nbsp;IPs of the server, and use the same listening port for all of them.</p>
<p><br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/2364.listenall.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/2364.listenall.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/2364.listenall.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/2364.listenall.jpg" alt="" border="0" /></a></p>
<p>Disabling ListenAll allows to manually select which IPs the SQL Server instance will bind, and also change the listening port for each those IPs.</p>
<p>For exemple, using the following settings (I used the loopback adapter as it was readily available)</p>
<p><br /> <a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/7711.indiv_ip.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/7711.indiv_5F00_ip.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/7711.indiv_ip.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/7711.indiv_5F00_ip.jpg" alt="" border="0" /></a></p>
<p>Will lead to :</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="614">
<p>2015-10-09 10:59:25.57 spid18s&nbsp;&nbsp;&nbsp;&nbsp; Server is listening on [ 127.0.0.1&nbsp; &lt;ipv4&gt; 1455].</p>
<p>2015-10-09 10:59:25.57 spid18s&nbsp;&nbsp;&nbsp;&nbsp; Server is listening on [ x.x.x.110&nbsp; &lt;ipv4&gt; 1433].</p>
</td>
</tr>
</tbody>
</table>
<p>&nbsp;Notice the different ports for the loopback adapter and the main IP.</p>
<p>However, using this option has a side consequence. You will notice that after you disable ListenAll, the errorlog will show that SQL Server no longer autoregisters the <strong><em>TCP</em></strong> SPN for the instance.</p>
<p>With ListenAll <strong>active :</strong>&nbsp;</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="614">
<p>2015-09-25 16:42:03.55 Server&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The SQL Server Network Interface library successfully registered the Service Principal Name (SPN) [ MSSQLSvc/servername.domain.com ] for the SQL Server service.</p>
<p>2015-09-25 16:42:03.56 Server&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The SQL Server Network Interface library successfully registered the Service Principal Name (SPN) [ MSSQLSvc/ servername.domain.com:1433&nbsp; ] for the SQL Server service.</p>
</td>
</tr>
</tbody>
</table>
<p>&nbsp;The first SPN is named pipe based, and the second one with the port is the TCP one.</p>
<p>(Of course, this is provided the SQL Service account has the required privileges to register SPN in the first place)</p>
<p>With Listen All <strong>disabled :</strong></p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="614">
<p>2015-10-09 10:59:25.63 Server&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The SQL Server Network Interface&nbsp;library successfully registered the Service Principal Name (SPN) [ MSSQLSvc/ servername.domain.com] for the SQL Server service.</p>
</td>
</tr>
</tbody>
</table>
<p>&nbsp;Only the NamedPipes SPN is auto registered.</p>
<p><span style="font-size: large;"><em><strong>Why ?</strong></em></span></p>
<p>Well the short answer is that his is by design, and that the code behaves as it is expected to.</p>
<p>But if we look at it more in details, it makes sense.</p>
<p>When using the listenall option, there will be a single TCP port for all the IP that are bound by SQL. Registering the TCP SPN &ndash;which includes the port - is therefore straightforward. Just use the listenall port !</p>
<p>But if listenall is disabled, that means that&nbsp;each IP may have a <em>different</em> TCP port. It becomes clear why a single port-based TCP SPN registration is not possible anymore : which port value to select ?</p>
<p>Now there is the scenario where the listenall option is disabled to avoid that SQL Server binds all IP, yet all the individual IPs enabled for SQL still use the same manual value for the port. In that case the SPN auto registration would be possible, but this would need some sizeable added logic within SQL Server to detect this situation.</p>
<p>The decision was thus made to only do TCP SPN autoregistration when listenall is active. Any other situation will require the DBA to manage the TCP SPN registration manually.</p>
<p>Hope that helps !</p>
<p>&nbsp;</p>
<p><em>Guillaume Fourrat</em></p>
<p><em>Escalation Engineer</em></p>
<p><em>Microsoft France</em></p>]]></content:encoded>
    </item>
    <item>
      <title>Rétro documentation SSRS et analyse des liens morts entre les rapports</title>
      <link>https://docs.microsoft.com/archive/blogs/support_sql_france/rtro-documentation-ssrs-et-analyse-des-liens-morts-entre-les-rapports</link>
      <pubDate>Tue, 15 Sep 2015 10:16:00 GMT</pubDate>
      <dc:creator><![CDATA[Romain Casteres]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/support_sql_france/2015/09/15/rtro-documentation-ssrs-et-analyse-des-liens-morts-entre-les-rapports/</guid>
      <description><![CDATA[Le nombre de rapports SSRS ne cesse d&rsquo;augmenter dans les diff&eacute;rentes...]]></description>
      <content:encoded><![CDATA[<p>Le nombre de rapports SSRS ne cesse d&rsquo;augmenter dans les diff&eacute;rentes soci&eacute;t&eacute;s que je rencontre, cependant le nombre de projets document&eacute;s reste tr&egrave;s limit&eacute;.</p>
<p>L&rsquo;objet de cet article est de vous fournir un certain nombre de requ&ecirc;tes vous permettant de g&eacute;n&eacute;rer une documentation sur vos projets Reporting Services.</p>
<p>L&rsquo;id&eacute;e de cet article m&rsquo;est venue en analysant les N rapports d&rsquo;un projet. Voici les quelques probl&eacute;matiques&nbsp;auxquelles j'ai &eacute;t&eacute; confront&eacute;es&nbsp;: Retrouver les liens morts entre les diff&eacute;rents rapports, documenter la solution et simplifier les d&eacute;ploiements ainsi que la configuration des rapports.</p>
<p>&nbsp;</p>
<h1>1 - Introduction</h1>
<p><span style="line-height: 107%; font-family: 'Calibri',sans-serif; font-size: 11pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-fareast-language: EN-US; mso-ansi-language: FR; mso-bidi-language: AR-SA;">A l&rsquo;installation de Reporting Services, deux bases de donn&eacute;es sont install&eacute;es&nbsp;ReportServer&nbsp;et ReportServerTempDB.</span></p>
<p><span style="text-decoration: underline;">La base de donn&eacute;es ReportServer&nbsp;stocke le contenu suivant :</span></p>
<ul>
<li>Les objets g&eacute;r&eacute;s par le serveur comme les rapports, les rapports li&eacute;s, les sources de donn&eacute;es, les mod&egrave;les de rapports, les dossiers &hellip; ainsi que toutes les propri&eacute;t&eacute;s et les param&egrave;tres de s&eacute;curit&eacute; associ&eacute;s &agrave; ces &eacute;l&eacute;ments.</li>
<li>Les d&eacute;finitions des souscriptions et leurs planifications.</li>
<li>Les Snapchots et l&rsquo;historique des rapports</li>
<li>Les propri&eacute;t&eacute;s du syst&egrave;me et les param&egrave;tres de s&eacute;curit&eacute;</li>
<li>Les logs d&rsquo;ex&eacute;cution</li>
<li>Les cl&eacute;s sym&eacute;triques et connexions crypt&eacute;es ainsi que les r&eacute;f&eacute;rences des sources de donn&eacute;es</li>
</ul>
<p>La base de donn&eacute;es ReportServerTempDB quant &agrave; elle g&egrave;re les donn&eacute;es temporaires li&eacute;es aux sessions, au cache des donn&eacute;es, les tables de travail temporaires. Un processus automatique s&rsquo;occupe de supprimer les anciens &eacute;l&eacute;ments inutilis&eacute;s de cette base.</p>
<p>Afin de documenter l&rsquo;environnement SSRS, sa configuration, les diff&eacute;rents rapports publi&eacute;s ainsi que les souscriptions nous effectuerons des requi&ecirc;tes&nbsp;sur les diff&eacute;rentes tables de la base ReportServer.</p>
<p style="text-align: center;"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/0334.SSRS_Architecture.gif" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/0334.SSRS_5F00_Architecture.gif"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/0334.SSRS_Architecture.gif" original-url="https://blogs.msdn.com/resized-image.ashx/__size/300x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/0334.SSRS_5F00_Architecture.gif" alt="" border="0" /></a></p>
<p>&nbsp;</p>
<h1>2 - Informations sur l&rsquo;instance SSRS</h1>
<h3><strong>2.1 - Informations sur l&rsquo;instance</strong></h3>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="601">
<p>SELECT</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MachineName,<br />&nbsp;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InstanceName,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Client</p>
<p>FROM dbo.Keys</p>
<p>WHERE MachineName IS NOT NULL</p>
</td>
</tr>
</tbody>
</table>
<p><span style="text-decoration: underline;">Remarque&nbsp;:</span> La table Keys contient aussi les informations sur les cl&eacute;s de chiffrement et sur l&rsquo;installation de l&rsquo;instance.</p>
<h3><strong>2.2 - Informations sur la configuration de l&rsquo;instance</strong></h3>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="601">
<p>SELECT</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Name,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Value</p>
<p>FROM dbo.ConfigurationInfo</p>
</td>
</tr>
</tbody>
</table>
<p><span style="text-decoration: underline;">R&eacute;sultat :</span></p>
<p><span style="text-decoration: underline;"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/8132.SSRS_CONFIG.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/8132.SSRS_5F00_CONFIG.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/8132.SSRS_CONFIG.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/250x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/8132.SSRS_5F00_CONFIG.png" alt="" border="0" /></a></span></p>
<p><br />Voici la liste des diff&eacute;rents param&egrave;tres&nbsp;: <a href="https://msdn.microsoft.com/en-us/library/bb934303.aspx">https://msdn.microsoft.com/en-us/library/bb934303.aspx</a>&nbsp;</p>
<h3><strong>2.3 - Informations sur les utilisateurs et leurs r&ocirc;les</strong></h3>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="601">
<p>SELECT</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CAT.name&nbsp; AS ReportName,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; USR.username&nbsp; AS UserName,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; USR.authtype&nbsp; AS AuthType,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ROL.rolename&nbsp; AS RoleName,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ROL.Description AS Description</p>
<p>FROM dbo.users USR</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INNER JOIN dbo.policyuserrole&nbsp;PLU ON USR.userid = PLU.userid</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INNER JOIN dbo.policies POL ON POL.policyid = PLU.policyid</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INNER JOIN dbo.roles ROL ON ROL.roleid = PLU.roleid</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INNER JOIN dbo.catalog CAT ON CAT.policyid = POL.policyid</p>
<p>WHERE CAT.TYPE = 2</p>
</td>
</tr>
</tbody>
</table>
<p><span style="text-decoration: underline;">R&eacute;sultat :</span></p>
<p><span style="text-decoration: underline;"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/2112.SSRS_UserRole.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/2112.SSRS_5F00_UserRole.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/2112.SSRS_UserRole.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/500x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/2112.SSRS_5F00_UserRole.png" alt="" border="0" /></a></span></p>
<h3><strong>2.4 &ndash; Informations sur l&rsquo;utilisation du cache</strong></h3>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="601">
<p>SELECT</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CAT.name AS ReportName,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CAC.cacheexpiration AS CacheExpiration,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CAC.expirationflags AS ExpirationFlags,</p>
<p>FROM&nbsp;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dbo.cachepolicy CAC</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INNER JOIN dbo.catalog CAT ON CAT.itemid = CAC.reportid</p>
</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<h3><strong><strong>2.5 &ndash; Informations sur les souscriptions et leurs planifications</strong></strong></h3>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="601">
<p>SELECT</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CAT.Name AS ReportName,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SUB.Description AS SubscriptionName,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SUB.EventType AS EventType,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SUB.LastStatus AS LastStatus,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SUB.LastRunTime AS LastRunTime,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SUB.Parameters AS Parameters,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SCH.Name AS ScheduleName,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SCH.Type AS ScheduleType,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SCH.EventType AS ScheduleEventType</p>
<p>FROM</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dbo.Subscriptions SUB</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INNER JOIN Catalog CAT ON SUB.Report_OID = CAT.ItemID</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INNER JOIN ReportSchedule RSC ON RSC.ReportID = CAT.ItemID AND RSC.SubscriptionID = SUB.SubscriptionID</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INNER JOIN Schedule SCH ON RSC.ScheduleID = SCH.ScheduleID</p>
</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<h1>3 - Informations sur les rapports</h1>
<h3><strong>3.1 - Liste des rapports&nbsp;et leurs param&egrave;tres</strong></h3>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="601">
<p>SELECT</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Name AS ReportName,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Path AS ReportPath,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CreationDate AS CreationDate,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ModifiedDate AS ModifiedDate,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Property AS Property,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Hidden AS Hidden,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Parameter AS Parameter,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Convert(XML,(Convert(VARBINARY(MAX),Content))) AS XMLRdl</p>
<p>FROM dbo.Catalog</p>
<p>WHERE Type = 2</p>
</td>
</tr>
</tbody>
</table>
<p><span style="text-decoration: underline;">R&eacute;sultat :</span></p>
<p><span style="text-decoration: underline;"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/2311.SSRS_ReportsList.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/2311.SSRS_5F00_ReportsList.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/2311.SSRS_ReportsList.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/500x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/2311.SSRS_5F00_ReportsList.png" alt="" border="0" /></a></span></p>
<p><span style="text-decoration: underline;">Remarques&nbsp;:</span></p>
<ul>
<li>Le champ XMLRdl affiche l&rsquo;ensemble du .RDL au format XML</li>
<li>Le champ Path d&eacute;termine l&rsquo;emplacement du rapport par rapport au dossier racine</li>
<li>Le champ Hidden d&eacute;termine si le rapport sera cach&eacute; ou non dans la liste des objets dans Report manager</li>
</ul>
<p>En effet il est possible de cacher &agrave; l&rsquo;utilisateur des objets dans Report manager&nbsp;:</p>
<p><span style="text-decoration: underline;"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/1031.SSRS_HideReport.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/1031.SSRS_5F00_HideReport.png"><img style="margin-right: auto; margin-left: auto; display: block;" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/1031.SSRS_HideReport.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/300x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/1031.SSRS_5F00_HideReport.png" alt="" border="0" /></a></span></p>
<h3><strong>3.2 &ndash; Liens morts entre les rapports</strong></h3>
<p>Une probl&eacute;matique r&eacute;currente &agrave; SSRS&nbsp;: &laquo;&nbsp;J&rsquo;ai une centaine de rapports dans mon projet, certains rapports ont chang&eacute;s de noms, &hellip; Comment retrouver les liens morts entre les diff&eacute;rents rapports ?&nbsp;&raquo;</p>
<p><span style="text-decoration: underline;">Voici la solution&nbsp;:</span></p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="601">
<p>;WITH XMLNAMESPACES (</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DEFAULT 'https://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition', &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'https://schemas.microsoft.com/SQLServer/reporting/reportdesigner'&nbsp;AS rd</p>
<p>), ReportInfo AS (</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CAT.Path AS ReportPath,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CAT.name AS ReportName,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TAB.value('data(ReportName)[1]', 'varchar(255)') AS Link,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; REPLACE(CAT.Path, CAT.name, '') + TAB.value('data(ReportName)[1]', 'varchar(255)') AS PathLink</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FROM&nbsp;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dbo.catalog CAT</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CROSS APPLY (SELECT CONVERT(XML, CONVERT(VARBINARY(MAX), content))) AS REP (reportxml)</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CROSS APPLY&nbsp;REP.reportxml.nodes('//*:Textbox/ActionInfo/Actions/Action/Drillthrough') NOD (TAB)</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHERE&nbsp;CAT.Type = 2</p>
<p>)</p>
<p>SELECT</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ReportPath,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ReportName,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Link,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PathLink,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COUNT(1) AS NbLinks&nbsp;</p>
<p>FROM ReportInfo</p>
<p>WHERE PathLink NOT IN (SELECT path FROM dbo.catalog)</p>
<p>GROUP BY</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reportpath,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reportname,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Link,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PathLink</p>
<p>ORDER BY reportpath</p>
</td>
</tr>
</tbody>
</table>
<p><span style="text-decoration: underline;">R&eacute;sultat :</span></p>
<p><span style="text-decoration: underline;"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/1050.SSRS_Links.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/1050.SSRS_5F00_Links.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/1050.SSRS_Links.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/1050.SSRS_5F00_Links.png" alt="" border="0" /></a></span></p>
<p><span style="text-decoration: underline;">Remarques&nbsp;:</span> Ici le rapport &laquo;&nbsp;Product Line Sales&nbsp;&raquo; contient un lien (NbLinks) vers le rapport &laquo;&nbsp;Employee Sales Summary SQL2008R2&nbsp;&raquo; situ&eacute; dans le dossier &laquo;&nbsp;/AdventureWorks Sample Reports/&nbsp;&raquo; qui n&rsquo;existe pas ou plus.</p>
<p>L&rsquo;Addin Excel <a title="nodexl" href="https://nodexl.codeplex.com/">NodeXL</a> (Excel 2007 &agrave; 2016) n&rsquo;est plus&nbsp;&agrave; pr&eacute;senter, il permet d&rsquo;analyser sous forme de graph tout type de donn&eacute;es. (Mon article de pr&eacute;sentation de NodeXL&nbsp;: <a href="https://www.pulsweb.fr/nodexl/">https://www.pulsweb.fr/nodexl/</a>).</p>
<p><span style="text-decoration: underline;">Voici le r&eacute;sultat d&rsquo;une analyse sur une partie des rapports d&rsquo;un projet SSRS&nbsp;:</span></p>
<p><span style="text-decoration: underline;"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/2577.SSRS_NodeXL.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/2577.SSRS_5F00_NodeXL.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/2577.SSRS_NodeXL.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/2577.SSRS_5F00_NodeXL.png" alt="" border="0" /></a></span></p>
<p><br /><span style="text-decoration: underline;">Analyse&nbsp;:</span></p>
<ul>
<li>Vertex 1 correspond au rapport contenant le lien vers le rapport Vertex 2</li>
<li>La grosseur du lien correspond au nombre de liens pr&eacute;sents dans le rapport. Exemple le rapport &laquo;&nbsp;CM-Main&nbsp;&raquo; contient 8 liens vers le rapport &laquo;&nbsp;CM-Dashboard Hierarchy all Levels &ndash; Summary&nbsp;&raquo;.</li>
<li>La direction de la fl&egrave;che indique le lien entre les rapports. Exemple le rapport &laquo;&nbsp;CM-main&nbsp;&raquo; contient un lien vers le rapport &laquo;&nbsp;CM-Dashboard SQL&nbsp;&raquo; et vice versa.</li>
<li>Le format de la fl&egrave;che en&nbsp;continue ou en pointill&eacute; d&eacute;pend de l&rsquo;existence du rapport. Exemple le rapport &laquo;&nbsp;CM-Main&nbsp;&raquo; contient un lien vers le rapport &laquo;&nbsp;CM-Bad&nbsp;&raquo;&nbsp;or celui-ci n&rsquo;existe pas.</li>
</ul>
<p><span style="text-decoration: underline;"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/8551.SSRS_NodeXL2.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/8551.SSRS_5F00_NodeXL2.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/8551.SSRS_NodeXL2.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/450x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/8551.SSRS_5F00_NodeXL2.png" alt="" border="0" /></a></span></p>
<p>&nbsp;</p>
<p>Combiner le r&eacute;sultat de la pr&eacute;c&eacute;dente requ&ecirc;te avec NodeXL permet d&rsquo;avoir une vision compl&egrave;te des relations entre les diff&eacute;rents rapports d&rsquo;un projet, de v&eacute;rifier qu&rsquo;il n&rsquo;y a pas de rapport isol&eacute; (sans aucun lien allant vers celui-ci), d&rsquo;analyser les liens morts, &hellip;</p>
<p>&nbsp;</p>
<h3><span style="text-decoration: underline;"><strong>3.3 &ndash; Informations sur les param&egrave;tres d&rsquo;un rapport</strong></span></h3>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="601">
<p>WITH TMP AS (</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CAT.Name,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CONVERT(XML,CAT.Parameter) AS XMLParameter</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FROM&nbsp;dbo.Catalog&nbsp;CAT</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHERE&nbsp;CAT.Type&nbsp; = 2 AND CAT.Name = 'Product Line Sales'</p>
<p>)</p>
<p>SELECT&nbsp;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VAL.value('Name[1]', 'VARCHAR(250)') AS ParameterName,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VAL.value('Type[1]', 'VARCHAR(250)') AS ParameterType,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VAL.value('Nullable[1]', 'VARCHAR(250)') AS ParameterNull,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VAL.value('AllowBlank[1]', 'VARCHAR(250)') AS ParameterBlank,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VAL.value('MultiValue[1]', 'VARCHAR(250)') AS&nbsp;ParameterMultiValue,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VAL.value('UsedInQuery[1]', 'VARCHAR(250)') AS ParameterInQuery,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VAL.value('Prompt[1]', 'VARCHAR(250)') AS ParameterPrompt,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VAL.value('DynamicPrompt[1]', 'VARCHAR(250)') AS ParameterDynamic,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VAL.value('PromptUser[1]', 'VARCHAR(250)') AS ParameterPromptUser,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VAL.value('State[1]', 'VARCHAR(250)') AS ParameterState</p>
<p>FROM TMP</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CROSS APPLY XMLParameter.nodes('//Parameters/Parameter') PARAMXML (VAL)</p>
</td>
</tr>
</tbody>
</table>
<p><span style="text-decoration: underline;">R&eacute;sultat :</span></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/3000.SSRS_Parameters.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/3000.SSRS_5F00_Parameters.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/3000.SSRS_Parameters.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/3000.SSRS_5F00_Parameters.png" alt="" border="0" /></a></p>
<p>&nbsp;</p>
<h3><strong>3.4 - Liste des Data Sources et leurs rapports</strong></h3>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="601">
<p>SELECT</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DSR.Name AS DataSourceName,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CASE</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHEN DSR.Name IS NOT NULL THEN CAT.Name</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ELSE 'Shared Data Source'</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; END AS DataSourceType,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLink.Name AS DataSource,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CAT.Name AS ReportName</p>
<p>FROM</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dbo.DataSource DSR</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INNER JOIN dbo.Catalog CAT ON DSR.ItemID = CAT.ItemID</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LEFT JOIN dbo.Catalog CLink ON Clink.ItemID = DSR.Link</p>
</td>
</tr>
</tbody>
</table>
<p><span style="text-decoration: underline;">R&eacute;sultat :</span></p>
<p><span style="text-decoration: underline;"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/3833.SSRS_DataSource.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/3833.SSRS_5F00_DataSource.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/3833.SSRS_DataSource.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/3833.SSRS_5F00_DataSource.png" alt="" border="0" /></a></span></p>
<h3><span style="text-decoration: underline;"><strong>3.5 - Liste des sous rapports</strong></span></h3>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="601">
<p>WITH XMLNAMESPACES ('https://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition'&nbsp;as rdl),</p>
<p>TMP AS (</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CAT.Path,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CONVERT(XML, CONVERT(VARBINARY(MAX), CAT.Content)) AS XMLColumn</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FROM dbo.Catalog CAT</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHERE CAT.Type&nbsp; = 2</p>
<p>)</p>
<p>SELECT</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Path as ReportPath,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; n.x.value('(//rdl:ReportName)[1]', 'nvarchar(256)')&nbsp;AS ReferencedReport</p>
<p>FROM TMP</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CROSS APPLY xmlColumn.nodes('//rdl:Subreport') n(x)</p>
</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<h1>4 &ndash; Analyse des Logs</h1>
<p>A partir de SQL Server 2008 R2, la vue ExecutionLog3 permet d&rsquo;avoir des informations concernant l&rsquo;utilisation des rapports SSRS.</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="601">
<p>SELECT</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ItemPath,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; UserName,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Format,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ItemAction,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TimeStart,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TimeEnd,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Status,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SUM(TimeDataRetrieval) AS TimeDataRetrieval,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SUM(TimeProcessing) AS TimeProcessing,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SUM(TimeRendering) AS TimeRendering,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SUM(ByteCount) AS ByteCount,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SUM([RowCount]) AS [RowCount]</p>
<p>FROM dbo.ExecutionLog3</p>
<p>GROUP BY</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ItemPath,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; UserName,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Format,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ItemAction,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TimeStart,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TimeEnd,</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Status</p>
<p>ORDER BY TimeStart DESC</p>
</td>
</tr>
</tbody>
</table>
<p><span style="text-decoration: underline;">R&eacute;sultat :</span></p>
<p><span style="text-decoration: underline;"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/3240.SSRS_LOG.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/3240.SSRS_5F00_LOG.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/3240.SSRS_LOG.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/3240.SSRS_5F00_LOG.png" alt="" border="0" /></a></span></p>
<p>Plus d&rsquo;informations sur la vue ExecutionLog3&nbsp;: <a href="https://msdn.microsoft.com/en-us/library/ms159110(v=sql.105).aspx">https://msdn.microsoft.com/en-us/library/ms159110(v=sql.105).aspx</a></p>
<p>&nbsp;</p>
<h1>5&nbsp;&ndash; D&eacute;ploiement</h1>
<p>Il existe plusieurs solutions pour d&eacute;ployer des rapports SSRS&nbsp;: SSDT (BIDS auparavant), Report Manager ou encore l&rsquo;utilitaire RS.exe.</p>
<p>Lorsque plusieurs rapports sont &agrave; d&eacute;ployer, SSDT est bien pratique, mais celui-ci n&rsquo;est pas toujours install&eacute; sur l&rsquo;environnement cible ou un environnement ayant acc&egrave;s &agrave; l&rsquo;environnement cible. Report Manager quant &agrave; lui ne permet pas l&rsquo;Upload de plusieurs rapports en une fois&nbsp;! La solution est alors d&rsquo;utiliser RS.exe.</p>
<p>Le script RSS suivant&nbsp;permet d&rsquo;uploader les rapports d&rsquo;un dossier local : <a href="https://onedrive.live.com/?cid=0363B73C0DA07C62&amp;id=363B73C0DA07C62%21159">OneDrive</a></p>
<p><span style="text-decoration: underline;">Apr&egrave;s avoir t&eacute;l&eacute;charg&eacute; le .RSS, il faut cr&eacute;er et modifier le .Bat :</span></p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="601">
<p>rem Source : https://www.sqlblogspot.com/2014/03/ssrs-deploymentcomplete-automation2012.html</p>
<p>rem 1 - Create a folder named &ldquo;ProjectName&rdquo; under this new folder</p>
<p>rem 2 - copy all the reports, datasource and dataset into the &ldquo;ProjectName&rdquo; folder</p>
<p>rem 3 - Modify 'ProjectName' Folder (Destination)</p>
<p>rem 4 - Modify 'C:\ProjectName' Reports path</p>
<p>set varServerPath=https://localhost/reportserver</p>
<p>set varReportFolder=ProjectName</p>
<p>set varDatasetFolder=ProjectName</p>
<p>set varDataSourceFolder=ProjectName</p>
<p>set varDataSourcePath=ProjectName</p>
<p>set varReportName=</p>
<p>set varReportFilePath=C:\ProjectName</p>
<p>rs.exe -i<br />&nbsp; Commonscript.rss -s %varServerPath% -v<br />&nbsp; ReportFolder="%varReportFolder%" -v DataSetFolder="%varDatasetFolder%"<br />&nbsp; -v DataSourceFolder="%varDataSourceFolder%" -v<br />&nbsp; DataSourcePath="%varDataSourcePath%" -v<br />&nbsp; ReportName="%varReportName%"&nbsp;<br />&nbsp; -v filePath="%varReportFilePath%" -e Mgmt2010</p>
</td>
</tr>
</tbody>
</table>
<p>Le script RSS a &eacute;t&eacute; r&eacute;alis&eacute; par&nbsp;<a href="https://www.blogger.com/profile/03151449590672654447">Nishar</a>,&nbsp;plus d&rsquo;informations sur celui-ci&nbsp;&agrave; l&rsquo;adresse suivante&nbsp;: <a href="https://www.sqlblogspot.com/2014/03/ssrs-deploymentcomplete-automation2012.html">SSRS Deployment&ndash;Complete Automation&ndash;2012 &amp; 2008</a>.</p>
<p>&nbsp;</p>
<h1>6&nbsp;&ndash; Conclusion</h1>
<p>Dans cet article nous avons vu quelques requ&ecirc;tes T-SQL permettant de documenter une instance Reporting Services, ses rapports et sa configuration.</p>
<p>Nous avons aussi vu une requ&ecirc;te basique permettant d&rsquo;auditer l&rsquo;utilisation des rapports, leurs temps d&rsquo;ex&eacute;cution &hellip;</p>
<p>Enfin le script de d&eacute;ploiement pr&eacute;sent&eacute; permet de gagner du temps sur l&rsquo;Upload d&rsquo;une solution.</p>
<p>Sans oublier le fait qu&rsquo;avec quelques requ&ecirc;tes T-SQL et NodeXL, il est possible d&rsquo;avoir une vision compl&egrave;te sur les diff&eacute;rents liens entre les rapports SSRS&nbsp;!</p>
<p style="text-align: center;"><span style="text-decoration: underline;"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/8473.SSRS_NodeXL3.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/8473.SSRS_5F00_NodeXL3.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/8473.SSRS_NodeXL3.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/8473.SSRS_5F00_NodeXL3.png" alt="" border="0" /></a></span></p>
<p style="text-align: right;"><strong>Romain Casteres</strong></p>
<p style="text-align: right;">Premier Field Engineer &ndash; SQL &amp; BI &amp; Big Data&nbsp;</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Evaluer le Resource Governor de SQL Server</title>
      <link>https://docs.microsoft.com/archive/blogs/support_sql_france/evaluer-le-resource-governor-de-sql-server</link>
      <pubDate>Fri, 20 Mar 2015 07:46:26 GMT</pubDate>
      <dc:creator><![CDATA[Guillaume Fourrat [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/support_sql_france/2015/03/20/evaluer-le-resource-governor-de-sql-server/</guid>
      <description><![CDATA[Bonjour &agrave; tous,
Les versions r&eacute;centes de SQL Server offrent la possibilit&eacute;...]]></description>
      <content:encoded><![CDATA[<p>Bonjour &agrave; tous,</p>
<p>Les versions r&eacute;centes de SQL Server offrent la possibilit&eacute; d'introduire des notions de Qualit&eacute; de Service vis &agrave; vis de certaines ressources : IO, RAM, CPU, par la fonctionnalit&eacute; 'Resource Governor'.</p>
<p>La cr&eacute;ation d'un algorithme g&eacute;rant l'allocation ou non de ces ressources n'est pas aussi triviale qu'il n'y parait (je vous laisse d&eacute;couvrir son petit monde de complexit&eacute; sur le Web).</p>
<p>Dans le contexte de SQL Server, cet algorithme doit de plus s'int&eacute;grer au contexte&nbsp;du scheduling coop&eacute;ratif qui pr&eacute;side &agrave; l'ex&eacute;cution des worker threads : en gros l'algoritme ne peut pas se contenter d'interrompre tout SPID qui a d&eacute;pass&eacute; son quota car il n'est pas pr&eacute;-emptif. Au lieu de &ccedil;a, il agit &agrave; des 'checkpoints' et doit d&eacute;cider &agrave; ce moment si le thread peut continuer ou pas sur la base d'une <em>estimation</em> de sa consommation future en ressource pendant le prochain cycle (jusqu'au prochain checkpoint, qui est d&eacute;cid&eacute; par le code qu'ex&eacute;cute le thread et non pas par l'algorithme, qui de plus n'a aucune visibilit&eacute; sur cette &eacute;ch&eacute;ance). Multiplions &ccedil;a par n threads travaillant dans plusieurs groupes diff&eacute;rents avec des quotas hauts et bas diff&eacute;rents. Tout de suite moins simple, n'est-ce-pas ? :)</p>
<p>Sans rentrer plus dans les d&eacute;tails, le fait est que les algorithmes impl&eacute;ment&eacute;s vont <em>'tendre'</em> vers les valeurs cibles configur&eacute;es par le DBA dans le resource governor. Cependant ils pourront d'autant plus s'en rapprocher qu'ils brasseront une quantit&eacute; importante de SPID &agrave; activit&eacute;s vari&eacute;es. Si tr&egrave;s peu de SPID sont actifs &agrave; un instant t, il y a des chances qu'il soit impossible d'obtenir la granularit&eacute; qui permette de s'approcher de mani&egrave;re fiable des valeurs cibles.</p>
<p>Un peu comme si vous deviez remplir un car de 50 places sans pouvoir s&eacute;parer les groupes de passagers :&nbsp; c'est plus facile&nbsp;en travaillant avec de nombreuses&nbsp;familles de tailles diverses qu'avec 3 ou 4 colonies de vacances compl&egrave;tes.</p>
<p>Cet &eacute;l&eacute;ment &eacute;tabli, revenons dans le contexte d'un DBA d&eacute;couvrant cette fonctionnalit&eacute;. Son premier reflexe sera de la tester afin de voir si elle r&eacute;pond &agrave; ses besoins. Et ce test consistera tr&egrave;s certainement a cr&eacute;er 2 groupes, puis <em>un</em> SPID dans chacun ayant une activit&eacute; lourde vis &agrave; vis de la ressource arbitr&eacute;e. Et donc de prendre compl&egrave;tement &agrave; revers l'algorithme :)&nbsp;Vous ne serez donc pas &eacute;tonn&eacute;s si je vous dis que les r&eacute;sultats d'un tel test risquent d'&ecirc;tre d&eacute;cevants, avec des groupes de ressources ne se conformant pas aux limites mises en place. Avec un peu de malchance une des activit&eacute;s fera un usage artificiellement pouss&eacute;&nbsp;de fonctions intensives qui rendent plus rarement&nbsp;la main au scheduleur que le SPID lambda, ce qui scellera le verdict.</p>
<p>Donc, amis DBA, si vous d&eacute;cidiez d'explorer le Resource Governor de SQL Server, &eacute;vitez les colonies de vacances et&nbsp;assurez-vous de cr&eacute;er un jeu de test repr&eacute;sentatif d'un serveur actif, c'est &agrave; dire comprenant un nombre cons&eacute;quent de SPID associ&eacute;s &agrave; des t&acirc;ches vari&eacute;es, ce qui donnera aux algorithmes assez de mat&eacute;riau pour produire un comportement conforme &agrave; vos attentes.</p>
<p>A bient&ocirc;t,</p>
<p>Guillaume Fourrat</p>
<p>Ing&eacute;nieur d'Escalade</p>
<p>Microsoft France</p>]]></content:encoded>
    </item>
    <item>
      <title>SetFileIoOverlappedRange messages in SQL Server Errorlogs</title>
      <link>https://docs.microsoft.com/archive/blogs/support_sql_france/setfileiooverlappedrange-messages-in-sql-server-errorlogs</link>
      <pubDate>Mon, 13 Oct 2014 09:10:00 GMT</pubDate>
      <dc:creator><![CDATA[Guillaume Fourrat [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/support_sql_france/2014/10/13/setfileiooverlappedrange-messages-in-sql-server-errorlogs/</guid>
      <description><![CDATA[Hi Everyone,
I had recently to understand why a SQL Server had repeated occurences of...]]></description>
      <content:encoded><![CDATA[<p>Hi Everyone,</p>
<p>I had recently to understand why a SQL Server had repeated occurences of "SetFileIoOverlappedRange failed, GetLastError is 1314" in its errorlog.</p>
<p>Because the web lookup of the main keyword would likely lead to <a href="https://support2.microsoft.com/kb/2679255/en-us">https://support2.microsoft.com/kb/2679255/en-us,</a> that (rightfully) would make the DBA worried about what could possibly be happening on the Server.</p>
<p>Because Os error 1314 is ERROR_PRIVILEGE_NOT_HELD, other research would also lead to double checking SeLockMemoryPrivilege&nbsp; as specified in&nbsp;<a href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa365540(v=vs.85).aspx">https://msdn.microsoft.com/en-us/library/windows/desktop/aa365540(v=vs.85).aspx</a>, only to find out that the privilege is set for SQL Server Service Account (telltale item is the entry 'Using locked pages in the memory manager.' in startup section of errorlog).</p>
<p>Finally, testing would show that attaching&nbsp;a Database would generate three of those messages at every try :</p>
<p>2014-10-13 17:24:09.48 spid53&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SetFileIoOverlappedRange failed, GetLastError is 1314<br />2014-10-13 17:24:09.54 spid53&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Starting up database 'dummy'.<br />2014-10-13 17:24:09.55 spid53&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SetFileIoOverlappedRange failed, GetLastError is 1314<br />2014-10-13 17:24:09.55 spid53&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SetFileIoOverlappedRange failed, GetLastError is 1314</p>
<p>So what have we got&nbsp;here ?</p>
<p>Well the thing is, during the attach operations, some part of the file operations will be done under the <em>client's</em> security context.</p>
<p>But if SQL Server was started with SeLockMemoryPrivilege, then it would attempt to generate IOs that use SetFileIoOverlappedRange API, including the IOs that take place under the client's context during special 'attach' code.</p>
<p>If the Client's account does NOT have SeLockMemoryPrivilege&nbsp;enabled, then the attempt by SQL to use the API would fail and generate the messages&nbsp;previously described&nbsp;in the Errorlog.</p>
<p>Conversely :</p>
<ul>
<li>If SQL Server account doesn't have SeLockMemoryPrivilege, then the situation is avoided.</li>
<li>If both SQL Server Account and the Client's (user) interactive account have SeLockMemoryPrivilege, then the situation is avoided too.</li>
<ul>
<li>note that this would likely require to start SSMS 'as administrator'. Failing that, the message will appear</li>
<li>also note that enabling the privilege requires a log out/log in to activate.</li>
</ul>
</ul>
<p>&nbsp;</p>
<p>So the main thing to remember is that this error message in this context (attach DB) can safely be ignored and is <span style="text-decoration: underline;">not</span> related to the scribbler issues described in <a href="https://support2.microsoft.com/kb/2679255/en-us">https://support2.microsoft.com/kb/2679255/en-us,</a></p>
<p>The only possible consequence can be a de-activation of SetFileIoOverlappedRange API for the DB until the SQL Service is restarted. This should have a very limited impact, and can be easily mitigated by&nbsp;restarting the DB (put it offline and online again)&nbsp;right after an attach.</p>
<p>Hope this helps removing a bit of confusion on the topic :)</p>
<p>&nbsp;</p>
<p>Regards,</p>
<p><strong></strong>&nbsp;</p>
<p><strong>Guillaume Fourrat</strong></p>
<p>Escalation Engineer</p>
<p><strong>Microsoft France</strong></p>]]></content:encoded>
    </item>
    <item>
      <title>Les Statistiques Incrémentales de SQL 2014</title>
      <link>https://docs.microsoft.com/archive/blogs/support_sql_france/les-statistiques-incrmentales-de-sql-2014</link>
      <pubDate>Wed, 25 Jun 2014 07:09:05 GMT</pubDate>
      <dc:creator><![CDATA[fredep1]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/support_sql_france/2014/06/25/les-statistiques-incrmentales-de-sql-2014/</guid>
      <description><![CDATA[Les Statistiques dans SQL Server
&nbsp;Les statistiques sont utilis&eacute;es par l'optimiseur pour...]]></description>
      <content:encoded><![CDATA[<h3>Les Statistiques dans SQL Server</h3>
<p style="text-align: left;">&nbsp;Les statistiques sont utilis&eacute;es par l'optimiseur pour &eacute;valuer la s&eacute;lectivit&eacute; des expressions, et donc la taille des r&eacute;sultats interm&eacute;diaires et finaux.</p>
<p style="text-align: left;">Elles peuvent &ecirc;tre:</p>
<ul>
<li>Cr&eacute;es automatiquement ou manuellement.</li>
<li>Mises &agrave; jour automatiquement ou manuellement.</li>
<li>Mises &agrave; jour en synchrone ou en asynchrone</li>
<li>Bas&eacute;es sur un &eacute;chantillonnage de valeurs ou toutes les valeurs</li>
</ul>
<p>&nbsp;</p>
<p>Le plus elles sont &agrave; jour, le meilleur c&rsquo;est. Il faut donc s&rsquo;appuyer sur la mise &agrave; jour automatique ou les faire manuellement. La mise &agrave; jour automatique est d&eacute;clench&eacute;e quand au moins 500 + 20% des donn&eacute;es de la table ont &eacute;volu&eacute;es.</p>
<h3>Probl&egrave;me sur les grosses tables</h3>
<p>Pour une tables avec des millions de lignes, il peut prendre des jours voir des mois avant d&rsquo;atteindre le seuil de 20%.</p>
<p>Si une nouvelle partition est ajout&eacute;e &agrave; la table et que &ccedil;a ne modifie pas 20% du total de celle-ci, les statistiques ne sont pas mises &agrave; jour et il n&rsquo;y a pas d&rsquo;information sur cette nouvelle partition.</p>
<p>Une mise &agrave; jour manuelle des statistiques peut &ecirc;tre d&eacute;clench&eacute; mais elle va &eacute;chantillonner toute la table ce qui peut &ecirc;tre trop long.</p>
<h3>Les Statistiques Incr&eacute;mentales de SQL 2014</h3>
<p>Objectif:</p>
<ul>
<li>Mise &agrave; jour plus rapide sur des tables avec de larges partitions</li>
<li>Des mises &agrave; jour automatiques plus fr&eacute;quentes<br />&nbsp;</li>
</ul>
<p>Les statistiques incr&eacute;mentales ne sont disponible que pour tables partitionn&eacute;es. Une page de statistique est cr&eacute;&eacute;e par partition, puis un merge&nbsp;est effectu&eacute; en chaque pages deux a deux jusqu&rsquo;&agrave; la page globale de la table. L&rsquo;ensemble des pages sont persistante sur disque. Lors de l&rsquo;ajout d&rsquo;une partition une nouvelle branche est cr&eacute;&eacute;e.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/2235.Partition.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/2235.Partition.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/2235.Partition.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/2235.Partition.jpg" alt="" border="0" /></a></p>
<p>La mise &agrave; jour automatique se d&eacute;clenche avec un nouveau seuil:</p>
<ul>
<li><span style="background-color: #ffff00;">500 + 20% de la <strong>taille moyenne des partitions</strong> en ne prenant en compte que les partitions non vides et en <strong>enlevant la plus petite et la plus grosse</strong>.</span></li>
<li><span style="background-color: #ffff00;">Seules les partitions avec 20% de modification sont mises &agrave; jour.</span></li>
</ul>
<p>&nbsp;</p>
<h3>Prenons un exemple&nbsp;:</h3>
<ul>
<li>Une table avec 6 partitions, 10000 rows</li>
</ul>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/6403.Partition.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/6403.Partition.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/6403.Partition.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/6403.Partition.jpg" alt="" width="692" height="132" border="0" /></a>&nbsp;</p>
<ul>
<li>L&rsquo;ancien seuil de mise &agrave; jour est&nbsp;: 500 + 20% * 10000 = <strong>2500</strong></li>
</ul>
<p><strong></strong>&nbsp;</p>
<ul>
<li>Auto Stat avec 900 enregistrements modifi&eacute;s&nbsp;:
<ul>
<li>Le nouveau seuil est&nbsp;:
<ul>
<li>Moyenne des partitions non vide en &eacute;liminant la plus petite et la plus grande&nbsp;: (2000 + 2000 + 2000) /3 = 2000</li>
<li>Seuil&nbsp;: 500 + 20% * 2000 = <strong>900</strong></li>
</ul>
</li>
</ul>
<p><strong></strong>&nbsp;</p>
<ul>
<li>Les partitions mises &agrave; jour&nbsp;:
<ul>
<li>Partition 2 = 2000*20% = 400 (autostat)</li>
<li>Partition 4 = 1000*20% = 200 (autostat)</li>
<li>Partition 5 = 3000*20% = 600 (no autostat)</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>&nbsp;Script:</p>
<p><span style="font-family: arial,helvetica,sans-serif;"></span></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/53/72/81/Increment_Stats.sql" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-53-72-81/Increment_5F00_Stats.sql">Increment_Stats.sql</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Exploration de la gestion de l'UTF16 avec SQL Server</title>
      <link>https://docs.microsoft.com/archive/blogs/support_sql_france/exploration-de-la-gestion-de-lutf16-avec-sql-server</link>
      <pubDate>Wed, 28 May 2014 04:39:00 GMT</pubDate>
      <dc:creator><![CDATA[Guillaume Fourrat [MSFT]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/support_sql_france/2014/05/28/exploration-de-la-gestion-de-lutf16-avec-sql-server/</guid>
      <description><![CDATA[Bonjour &agrave; tous,
J'ai r&eacute;cemment eu &agrave; me pencher sur le d&eacute;tail de...]]></description>
      <content:encoded><![CDATA[<div class="WordSection1">
<p><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">Bonjour &agrave; tous,</span></p>
<p><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">J'ai r&eacute;cemment eu &agrave; me pencher sur le d&eacute;tail de l'impl&eacute;mentation de la gestion de l'encodage Unicode UTF16 dans SQL Server.</span></p>
<p><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">La documentation existante (Microsoft ou tierce partie, avec un bon point de d&eacute;part ici&nbsp;: </span><a href="https://www.unicode.org/standard/principles.html"><span style="font-family: 'Arial','sans-serif'; font-size: 9pt;">https://www.unicode.org/standard/principles.html</span></a><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">) &nbsp;est plus que compl&egrave;te, le but est ici d'avoir un exemple simple, facile &agrave; d&eacute;ployer, et qui permet de se confronter aux m&eacute;canismes en jeu sur notre SGBD pr&eacute;f&eacute;r&eacute;.</span></p>
<p><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">NB : &nbsp;L'utilisation de caract&egrave;res Unicode avanc&eacute;s met par contre &agrave; mal la (rustique) chaine de publication de ce blog, j'utiliserai donc des captures d'&eacute;crans des requ&ecirc;tes et r&eacute;sultats, et j'attacherai le script au blog.</span></p>
<p><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">&nbsp;</span></p>
<p><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">Cr&eacute;ation du kit de test :</span></p>
<p><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/6622.query_pic.jpg" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/6622.query_5F00_pic.jpg"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/6622.query_pic.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/6622.query_5F00_pic.jpg" alt="" border="0" /></a></span></p>
<p><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">&nbsp;(Ce site a &eacute;t&eacute; pratique pour recueillir du texte 'exotique' : </span><span style="font-family: 'Arial','sans-serif'; font-size: 9pt;"><a href="https://www.i18nguy.com/unicode/plane1-utf-16.html">https://www.i18nguy.com/unicode/plane1-utf-16.html</a></span> )</p>
<p><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">&nbsp;Notre script insert donc des donn&eacute;es unicode &lsquo;avanc&eacute;es&rsquo; dans deux tables SQL distinctes : </span></p>
<p style="text-indent: -18pt; margin-left: 36pt;"><span style="color: black; font-family: Symbol; font-size: 9pt;">&middot;<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">La table &lsquo;t_nosc&rsquo; qui utilise une collation 'classique' </span></p>
<p style="text-indent: -18pt; margin-left: 36pt;"><span style="color: black; font-family: Symbol; font-size: 9pt;">&middot;<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">La table &lsquo;t&rsquo; utilisant les nouvelles collations 'surrogate chars' &nbsp;apport&eacute;es par SQL Server 2012 (comme d&eacute;crit ici </span><a href="https://msdn.microsoft.com/en-us/library/ms143726(v=sql.110).aspx"><span style="font-family: 'Arial','sans-serif'; font-size: 9pt;">https://msdn.microsoft.com/en-us/library/ms143726(v=sql.110).aspx</span></a><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;"> )</span></p>
<p><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">&nbsp;</span></p>
<p><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">&nbsp;On remarquera au passage que Management Studio (l&rsquo;application cliente utilis&eacute;e pour les tests) et plus g&eacute;n&eacute;ralement l&rsquo;environnement Windows a dans mon cas tr&egrave;s bien g&eacute;r&eacute; le copier/coller depuis le site pr&eacute;cit&eacute; ouvert dans Internet Explorer vers une fen&ecirc;tre de requ&ecirc;te SSMS&nbsp;: les valeurs unicodes ont bien &eacute;t&eacute; r&eacute;cup&eacute;r&eacute;es et SSMS a affich&eacute; les caract&egrave;res sp&eacute;ciaux sans action particuli&egrave;re. Dans ce contexte il faut vraiment garder &agrave; l&rsquo;esprit que l&rsquo;affichage du caract&egrave;re (et donc l&rsquo;existence d&rsquo;une repr&eacute;sentation graphique pertinente) et son stockage sont distinct. Si votre client ne sait pas afficher un caract&egrave;re donn&eacute;, vous aurez droit aux points d&rsquo;interrogation ou aux carr&eacute;s blancs typiques, mais cela n&rsquo;implique pas obligatoirement que les donn&eacute;es unicodes sont invalides. Le script SQL est attach&eacute; &agrave; cet article, je vous invite &agrave; utiliser SSMS pour l'ouvrir.</span></p>
<p><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">Le SELECT vient ensuite requ&ecirc;ter les donn&eacute;es fraichement ins&eacute;r&eacute;es, en y ajoutant quelques appels &agrave; des fonctions de chaines usuelles (LEN, SUBSTRING), et r&eacute;cup&egrave;re diff&eacute;rents niveaux d&rsquo;encodage de la chaine&nbsp;: le &lsquo;codepoint&rsquo; unicode, et le flux binaire &lsquo;brut&rsquo;.</span></p>
<p><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">Voici les r&eacute;sultats sur les deux tables&nbsp;:</span></p>
<p><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">Table sans collation SC&nbsp;:</span></p>
<p>&nbsp;</p>
<p><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/1464.result_nonSC.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/1464.result_5F00_nonSC.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/1464.result_nonSC.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/1464.result_5F00_nonSC.png" alt="" width="824" height="112" border="0" /></a></span></p>
<p><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">Table avec collation SC&nbsp;:</span></p>
<p><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/6675.result_SC.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/6675.result_5F00_SC.png"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/29/81/6675.result_SC.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-29-81/6675.result_5F00_SC.png" alt="" width="828" height="116" border="0" /></a></span></p>
<p><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">Voyons ce que cela nous permet de conclure&nbsp;:</span></p>
<p style="text-indent: -18pt; margin-left: 36pt;"><span style="color: black; font-family: Symbol; font-size: 9pt;">&middot;<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">La 1&egrave;re colonne nous montre que nous r&eacute;cup&eacute;rons bien les chaines d&rsquo;origine dans les deux cas&nbsp;! Pas de caract&egrave;re invalide ou mal interpr&eacute;t&eacute;. Or nous savons que les caract&egrave;res choisis ont un encodage UTF16, SQL Server est donc capable de stocker et de restituer des chaines UTF16 nativement, sans besoin d&rsquo;utiliser des collations particuli&egrave;res&nbsp;! Il faut bien s&ucirc;r utiliser des types de colonnes unicode &hellip;</span></p>
<p style="text-indent: -18pt; margin-left: 36pt;"><span style="color: black; font-family: Symbol; font-size: 9pt;">&middot;<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">La &nbsp;2<sup>&egrave;me</sup> colonne permet par contre de constater que les fonctions de manipulations de chaine sont impact&eacute;es par nos caract&egrave;res &lsquo;exotiques&rsquo; UTF16&nbsp;: par exemple la ligne 3 nous indique 10 caract&egrave;res de long dans le premier cas, car SQL Server voit 5 fois 2 caract&egrave;res UCS2 (2 octets) alors que la collation SC g&egrave;re correctement les 4 octets par caract&egrave;res et affiche comme longueur 5. Cet aspect est attendu et document&eacute; (cf fin de&nbsp;</span><a href="https://msdn.microsoft.com/en-us/library/ms143726.aspx"><span style="font-family: 'Arial','sans-serif'; font-size: 9pt;">https://msdn.microsoft.com/en-us/library/ms143726.aspx</span></a><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">) </span></p>
<p style="text-indent: -18pt; margin-left: 36pt;"><span style="color: black; font-family: Symbol; font-size: 9pt;">&middot;<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">De la m&ecirc;me mani&egrave;re, la 3<sup>&egrave;me</sup> colonne / ligne 3 ne donne qu&rsquo;un seul caract&egrave;re alors que la demande est un SUBSTRING de <em>deux</em> caract&egrave;res de long. Cette op&eacute;ration illustre bien comment SQL Server peut par d&eacute;faut permettre &agrave; ses clients full UTF16 de fonctionner parfaitement&nbsp;sans &ecirc;tre capable de &lsquo;comprendre&rsquo; l&rsquo;UTF16 lui-m&ecirc;me : SQL Server croit &eacute;mettre 2 caract&egrave;res distincts, et le client d&eacute;tecte que ce sont 2 paires relatives au m&ecirc;me caract&egrave;re UTF16 &agrave; 4 octets, et les &lsquo;r&eacute;unit&rsquo; pour ne former qu&rsquo;un seul caract&egrave;re &agrave; l&rsquo;affichage. </span></p>
<p style="text-indent: -18pt; margin-left: 36pt;"><span style="color: black; font-family: Symbol; font-size: 9pt;">&middot;<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">La 4&egrave;me colonne illustre le cas o&ugrave; un caract&egrave;re &agrave; 4 octets (une surrogate pair) va &ecirc;tre coup&eacute; en deux&nbsp;: la premi&egrave;re table non-SC nous donne des caract&egrave;res invalides, car une moiti&eacute; (2octets) isol&eacute;e de caract&egrave;re &agrave; 4 octets n&rsquo;a aucune signification. Et c&rsquo;est en fait une bonne chose, car on pourrait imaginer que les 2 moiti&eacute;s &agrave; 2 octets d&rsquo;un caract&egrave;re &agrave; 4 octet aient une autre signification possible quand elles sont isol&eacute;es que quand elles sont group&eacute;es. Cela induirait un remplacement silencieux d&rsquo;un caract&egrave;re par deux autres (valides, mais non attendus) si d&rsquo;aventure une &lsquo;surrogate pair&rsquo; UTF16 &eacute;tait scind&eacute;e et g&eacute;r&eacute;e comme deux caract&egrave;res &agrave; 2 octets. Bien dangereux et insidieux non&nbsp;? Comme nous le verrons plus bas, l&rsquo;encodage UTF16 n&rsquo;autorise pas cela, et nous avons donc quand une moiti&eacute; de surrogate pair est trait&eacute;e de mani&egrave;re isol&eacute;e un caract&egrave;re invalide permettant de d&eacute;tecter le probl&egrave;me. Dans le cas de la table avec SC, ce sont bien les 2 moiti&eacute;s de la surrogate pair qui sont consomm&eacute;es pour nous fournir le caract&egrave;re stock&eacute;.</span></p>
<p style="text-indent: -18pt; margin-left: 36pt;"><span style="color: black; font-family: Symbol; font-size: 9pt;">&middot;<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">Les &nbsp;5<sup>&egrave;me</sup> et 6<sup>&egrave;me</sup> colonnes nous indiquent le &lsquo;codepoint&rsquo; unicode de la colonne pr&eacute;c&eacute;dente. On note des valeurs &lsquo;basses&rsquo; pour nos caract&egrave;res latins habituels, associ&eacute;e au &lsquo;Basic Multilingual Plane&rsquo; ou BMP, par contre les caract&egrave;res exotiques sont associ&eacute;s &agrave; des valeurs &eacute;lev&eacute;es. Sur la table non SC, on voit la valeur 0xD800 (55296) r&eacute;p&eacute;t&eacute;e pour des caract&egrave;res diff&eacute;rents. Cela est li&eacute; au fait que SQL Server regarde une moiti&eacute; seulement de la Surrogate Pair des caract&egrave;res exotiques et cette moiti&eacute; a la m&ecirc;me valeur unicode pour les caract&egrave;res du script d&rsquo;exemple (la variabilit&eacute; est sur la 2<sup>&egrave;me</sup> paire, il est facile de la faire apparaitre en changeant l&rsquo;offset du substring). On verra plus bas le pourquoi de cette valeur D800.&nbsp;La table &laquo;&nbsp;SC&nbsp;&raquo; par contre fait apparaitre des valeurs distinctes, et &gt;65536 ou 0xFFFF, impliquant plus de 2 octets d&rsquo;encodage. </span></p>
<p style="text-indent: -18pt; margin-left: 36pt;"><span style="color: black; font-family: Symbol; font-size: 9pt;">&middot;<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">La 6<sup>&egrave;me</sup>&nbsp; colonne fait apparaitre le flux binaire brut correspondant au stockage de la chaine unicode dans SQL Server. Un &eacute;l&eacute;ment important est d&rsquo;observer que pour les caract&egrave;res du BMP (typiquement, nos caract&egrave;res latins), l&rsquo;encodage binaire et le codepoint unicode ont la m&ecirc;me valeur (ex&nbsp;: 0x0061 pour le &lsquo;a&rsquo;). Cette colonne permet &eacute;galement de visualiser directement la taille d&rsquo;encodage doubl&eacute;e pour nos chaines exotiques. Vous constaterez &eacute;galement que le flux binaire est strictement identique pour la table t_nosc et t&nbsp;: l&rsquo;utilisation des collations SC ne modifie pas l&rsquo;encodage, et &agrave; nouveau, on voit que SQL Server a bien stock&eacute; 4 octets par caract&egrave;re m&ecirc;me dans la collation par d&eacute;faut. Enfin, on voit que les caract&egrave;res exotiques ont visiblement un encodage qui n&rsquo;est pas &lsquo;juste&rsquo; le codepoint unicode, ce sera l&rsquo;objet de notre exploration ci-dessous. </span></p>
<p><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">Nous allons maintenant nous int&eacute;resser &agrave; l&rsquo;encodage d&rsquo;un caract&egrave;re UTF16 &agrave; 4 octets (donc une &lsquo;surrogate pair&rsquo;) dans SQL Server.</span></p>
<p><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">Notre cobaye sera le caract&egrave;re de la ligne 5, que nous pouvons retrouver en tapant son codepoint 1031E&nbsp; sur </span><a href="https://www.unicode.org/charts/charindex.html"><span style="font-family: 'Arial','sans-serif'; font-size: 9pt;">https://www.unicode.org/charts/charindex.html</span></a><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">. Comment arriver de cette valeur &agrave; l&rsquo;encodage binaire de la derni&egrave;re colonne&nbsp;?</span></p>
<p><a href="https://www.unicode.org/faq/utf_bom.html#utf16-3"><span style="font-family: 'Arial','sans-serif'; font-size: 9pt;">https://www.unicode.org/faq/utf_bom.html#utf16-3</span></a><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;"> Nous indique un algorithme de conversion mais qui est peu lisible pour un humain, voyons les &eacute;tapes successives&nbsp;:</span></p>
<p style="text-indent: -18pt; margin-left: 36pt;"><span style="color: black; font-family: Symbol; font-size: 9pt;">&middot;<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">Codepoint Unicode <strong>0x0001031E</strong></span></p>
<p style="text-indent: -18pt; margin-left: 36pt;"><span style="color: black; font-family: Symbol; font-size: 9pt;">&middot;<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">On retire 0x10000 </span></p>
<p style="text-indent: -18pt; margin-left: 72pt;"><span style="color: black; font-family: 'Courier New'; font-size: 9pt;">o<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp; </span></span><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">0x0001031E - 0x10000 = 0x00031E</span></p>
<p style="text-indent: -18pt; margin-left: 36pt;"><span style="color: black; font-family: Symbol; font-size: 9pt;">&middot;<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">Traitement du 1<sup>er</sup> &eacute;l&eacute;ment de la surrogate pair (&lsquo;lead&rsquo; pair ou &lsquo;high offset)</span></p>
<p style="text-indent: -18pt; margin-left: 72pt;"><span style="color: black; font-family: 'Courier New'; font-size: 9pt;">o<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp; </span></span><span style="color: black; font-family: 'Arial','sans-serif'; font-size: 9pt;">10 bits &lsquo;hauts&rsquo; = Masque 0xFFC00</span></p>
<p class="MsoListParagraphCxSpFirst" style="margin: 0cm 0cm 0pt 72pt; line-height: normal; text-indent: -18pt;"><span style="color: black; font-family: 'Courier New'; font-size: 9pt;" lang="EN-US">o<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp; </span></span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;" lang="EN-US">select</span><span style="font-family: Consolas; font-size: 9.5pt;" lang="EN-US"> <span style="color: fuchsia;">convert</span><span style="color: gray;">(</span><span style="color: blue;">varbinary</span><span style="color: gray;">,</span> <span style="color: fuchsia;">convert</span><span style="color: gray;">(</span><span style="color: blue;">int</span><span style="color: gray;">,</span>0x31E<span style="color: gray;">)</span> <span style="color: gray;">&amp;</span> 0xFFC00<span style="color: gray;">)</span> </span></p>
<p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt; margin-left: 72pt;"><span style="color: black; line-height: 115%; font-family: 'Courier New'; font-size: 9pt;" lang="EN-US">o<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp; </span></span><span style="color: black; line-height: 115%; font-family: 'Arial','sans-serif'; font-size: 9pt;" lang="EN-US">= 0x00000000</span></p>
<p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt; margin-left: 72pt;"><span style="color: black; line-height: 115%; font-family: 'Courier New'; font-size: 9pt;">o<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp; </span></span><span style="color: black; line-height: 115%; font-family: 'Arial','sans-serif'; font-size: 9pt;">Ajout de l&rsquo;offset arbitraire des Lead surrogate : 0xD800</span></p>
<p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt; margin-left: 72pt;"><span style="color: black; line-height: 115%; font-family: 'Courier New'; font-size: 9pt;">o<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp; </span></span><span style="color: black; line-height: 115%; font-family: 'Arial','sans-serif'; font-size: 9pt;">0x0 + 0xD800 = 0xD800</span></p>
<p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt;"><span style="color: black; line-height: 115%; font-family: Symbol; font-size: 9pt;">&middot;<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="color: black; line-height: 115%; font-family: 'Arial','sans-serif'; font-size: 9pt;">Traitement du 2<sup>&egrave;me</sup> &eacute;l&eacute;ment de la surrogate pair (&lsquo;trailing&rsquo; ou &lsquo;low offset&rsquo;)</span></p>
<p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt; margin-left: 72pt;"><span style="color: black; line-height: 115%; font-family: 'Courier New'; font-size: 9pt;">o<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp; </span></span><span style="color: black; line-height: 115%; font-family: 'Arial','sans-serif'; font-size: 9pt;">10 bits &lsquo;bas&rsquo; = Masque 0x003FF</span></p>
<p class="MsoListParagraphCxSpMiddle" style="margin: 0cm 0cm 0pt 72pt; line-height: normal; text-indent: -18pt;"><span style="color: black; font-family: 'Courier New'; font-size: 9pt;" lang="EN-US">o<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp; </span></span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;" lang="EN-US">select</span><span style="font-family: Consolas; font-size: 9.5pt;" lang="EN-US"> <span style="color: fuchsia;">convert</span><span style="color: gray;">(</span><span style="color: blue;">varbinary</span><span style="color: gray;">,</span> <span style="color: fuchsia;">convert</span><span style="color: gray;">(</span><span style="color: blue;">int</span><span style="color: gray;">,</span>0x31E<span style="color: gray;">)</span> <span style="color: gray;">&amp;</span> 0x3FF<span style="color: gray;">)</span> </span></p>
<p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt; margin-left: 72pt;"><span style="color: black; line-height: 115%; font-family: 'Courier New'; font-size: 9pt;" lang="EN-US">o<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp; </span></span><span style="color: black; line-height: 115%; font-family: 'Arial','sans-serif'; font-size: 9pt;" lang="EN-US">= 0x0000031E</span></p>
<p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt; margin-left: 72pt;"><span style="color: black; line-height: 115%; font-family: 'Courier New'; font-size: 9pt;">o<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp; </span></span><span style="color: black; line-height: 115%; font-family: 'Arial','sans-serif'; font-size: 9pt;">Ajout de l&rsquo;offest arbitraire des Trailing Surrogate : 0xDC00</span></p>
<p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt; margin-left: 72pt;"><span style="color: black; line-height: 115%; font-family: 'Courier New'; font-size: 9pt;">o<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp; </span></span><span style="color: black; line-height: 115%; font-family: 'Arial','sans-serif'; font-size: 9pt;" lang="EN-US">0x0000031E+</span><span style="color: black; line-height: 115%; font-family: 'Arial','sans-serif'; font-size: 9pt;">0xDC00 = 0xDF1E</span></p>
<p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt;"><span style="color: black; line-height: 115%; font-family: Symbol; font-size: 9pt;">&middot;<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="color: black; line-height: 115%; font-family: 'Arial','sans-serif'; font-size: 9pt;">La surrogate pair est donc&nbsp;:</span></p>
<p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt; margin-left: 72pt;"><span style="color: black; line-height: 115%; font-family: 'Courier New'; font-size: 9pt;">o<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp; </span></span><strong><span style="color: black; line-height: 115%; font-family: 'Arial','sans-serif'; font-size: 9pt;">0xD800 0xDF1E</span></strong></p>
<p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt;"><span style="color: black; line-height: 115%; font-family: Symbol; font-size: 9pt;">&middot;<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="color: black; line-height: 115%; font-family: 'Arial','sans-serif'; font-size: 9pt;">N&rsquo;oublions pas la convention &lsquo;little endian&rsquo; et appliquons le byteswap&nbsp;:</span></p>
<p class="MsoListParagraphCxSpMiddle" style="text-indent: -18pt; margin-left: 72pt;"><span style="color: black; line-height: 115%; font-family: 'Courier New'; font-size: 9pt;">o<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp; </span></span><strong><span style="color: black; line-height: 115%; font-family: 'Arial','sans-serif'; font-size: 9pt;">0x00D81EDF</span></strong></p>
<p class="MsoListParagraphCxSpLast" style="text-indent: -18pt;"><span style="color: black; line-height: 115%; font-family: Symbol; font-size: 9pt;">&middot;<span style="font: 7pt/normal 'Times New Roman'; font-size-adjust: none; font-stretch: normal;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="color: black; line-height: 115%; font-family: 'Arial','sans-serif'; font-size: 9pt;">Nous retrouvons bien l&rsquo;encodage retourn&eacute; par SQL Server&nbsp;!</span></p>
<p class="MsoNormal"><span style="color: black; line-height: 115%; font-family: 'Arial','sans-serif'; font-size: 9pt;">Comme rapidement &eacute;voqu&eacute; plus haut, les offsets arbitraires utilis&eacute;s pour encoder la lead et trailing pair aboutissent &agrave; des valeurs d&rsquo;encodage pour chaque paire qui sont <em>r&eacute;serv&eacute;es</em> pour des surrogate pairs&nbsp;: si pour une raison donn&eacute;e on se retrouve &agrave; consid&eacute;rer une seule moiti&eacute; de la paire, sa valeur indique sans &eacute;quivoque qu&rsquo;elle est une moiti&eacute; leading ou une trailing et qu&rsquo;elle doit &ecirc;tre n&eacute;cessairement associ&eacute;e &agrave; sa &lsquo;conjointe&rsquo; pour &ecirc;tre d&eacute;cod&eacute;e. Il ne peut pas y avoir de &lsquo;mauvaise interpr&eacute;tation&rsquo; silencieuse d&rsquo;une &lsquo;demi paire&rsquo; UTF16 en tant que caract&egrave;re cod&eacute; sur 2 octets.</span></p>
<p class="MsoNormal"><span style="color: black; line-height: 115%; font-family: 'Arial','sans-serif'; font-size: 9pt;">En pratique le &lsquo;Basic Multilingual Plane&rsquo; a toutes les chances de contenir l&rsquo;ensemble des caract&egrave;res que vous stockerez dans SQL Server, et ces valeurs seront donc encod&eacute;es directement sur 2 octets qui seront nativement g&eacute;r&eacute;s par SQL Server, sans autre r&eacute;glage particulier que d&rsquo;utiliser des types unicodes (nvarchar, nchar..). Quand bien m&ecirc;me un caract&egrave;re rare se glisserait dans votre flux de donn&eacute;es, qui n&eacute;cessiterait un encodage sur 4 octets, nous avons vu que SQL Server pourra le stocker et le restituer sans probl&egrave;me, toujours sans &lsquo;r&eacute;glage&rsquo; suppl&eacute;mentaire. Mais si vous pr&eacute;voyez de faire des manipulations de chaines avanc&eacute;es au sein de SQL Server, <span style="text-decoration: underline;">et</span> que des caract&egrave;res UTF16 sur 4 octets sont pr&eacute;vus, alors dans ce cas l&rsquo;utilisation des collations avanc&eacute;es de SQL Server 2012 semble pertinente.</span></p>
<p class="MsoNormal"><span style="color: black; line-height: 115%; font-family: 'Arial','sans-serif'; font-size: 9pt;">A bient&ocirc;t !</span></p>
<p class="MsoNormal"><span style="color: black; line-height: 115%; font-family: 'Arial','sans-serif'; font-size: 9pt;">Guillaume Fourrat</span></p>
<p class="MsoNormal"><span style="color: black; line-height: 115%; font-family: 'Arial','sans-serif'; font-size: 9pt;">Ing&eacute;nieur d'Escalade</span></p>
</div>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/52/90/38/query.sql" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-52-90-38/query.sql">query.sql</a></p>]]></content:encoded>
    </item>
  </channel>
</rss>