<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.8.4">Jekyll</generator><link href="https://mycomputeradventures.foxinnovations.be/feed.xml" rel="self" type="application/atom+xml" /><link href="https://mycomputeradventures.foxinnovations.be/" rel="alternate" type="text/html" /><updated>2026-06-07T07:10:07+00:00</updated><id>https://mycomputeradventures.foxinnovations.be/feed.xml</id><title type="html">My Computer Adventures</title><subtitle>A blog about programming and system administration on Linux and Windows.</subtitle><entry><title type="html">DBFImport</title><link href="https://mycomputeradventures.foxinnovations.be/2018/10/31/import-dbf-files-into-sql-server/" rel="alternate" type="text/html" title="DBFImport" /><published>2018-10-31T00:00:00+00:00</published><updated>2018-10-31T00:00:00+00:00</updated><id>https://mycomputeradventures.foxinnovations.be/2018/10/31/import-dbf-files-into-sql-server</id><content type="html" xml:base="https://mycomputeradventures.foxinnovations.be/2018/10/31/import-dbf-files-into-sql-server/">&lt;p&gt;A simple cross-platform tool to import old DBF files into SQL Server.&lt;/p&gt;

&lt;!--more--&gt;

&lt;h1 id=&quot;dbfimport&quot;&gt;DBFImport&lt;/h1&gt;
&lt;p&gt;A simple cross-platform tool to import old DBF files into SQL Server.&lt;/p&gt;

&lt;p&gt;DBF files were/are used by&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;dBase (Ashton Tate)&lt;/li&gt;
  &lt;li&gt;FoxBASE/FoxPro (Fox Software) / Visual FoxPro (Microsoft)&lt;/li&gt;
  &lt;li&gt;Clipper (Nantucket / Computer Associates)&lt;/li&gt;
  &lt;li&gt;…&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Built on DotNet Core 2.1, works on Windows, Linux, Mac.&lt;/p&gt;

&lt;h1 id=&quot;usage&quot;&gt;Usage&lt;/h1&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;dotnet DBFImport.dll -p &amp;lt;dbfpath&amp;gt; -s &amp;lt;server&amp;gt; -d &amp;lt;database&amp;gt; [--codepage &amp;lt;cp&amp;gt;] [--nobulkcopy]
dotnet DBFImport.dll -p &amp;lt;dbfpath&amp;gt; -c &amp;lt;conn&amp;gt; [--codepage &amp;lt;cp&amp;gt;] [--nobulkcopy]

   -p, --path                Required. Path to DBF file(s)
   -s, --server              Required. SQL Server (and instance)
   -d, --database            Required. Database name
   -c, --connectionstring    Required. Database connection string
   --codepage                Code page for decoding text
   --nobulkcopy              Use much slower 'SQL Command' interface, instead of 'SQL BulkCopy'
   --help                    Display this help screen.
   --version                 Display version information.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The database must be an existing database.  Every DBF file is imported into a database table with the same name (if the table exists, it is dropped first).  A dot (‘.’) is displayed per 1000 records that are INSERTed in the database.&lt;/p&gt;

&lt;h1 id=&quot;examples&quot;&gt;Examples&lt;/h1&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;dotnet DBFImport.dll &quot;c:\My DBF files\*.DBF&quot; DEVSERVER\SQL2017 ImportedDbfFiles
#Imports DBF files:
dotnet DBFImport.dll --path &quot;c:\Data\My DBF files\*.DBF&quot; `
   --server DEVSERVER\SQL2017 --database ImportedDbfFiles
#Imports DBF files, and decode text using code page 1252:
dotnet DBFImport.dll --path &quot;c:\Data\My DBF files\*.DBF&quot; `
   --server DEVSERVER\SQL2017  --database ImportedDbfFiles --codepage 1252 
#Imports DBF files, and connect to SQL Server using connection string:
dotnet DBFImport.dll --path &quot;c:\Data\My DBF files\*.DBF&quot; `
   --connectionstring &quot;Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;typical-output&quot;&gt;Typical output&lt;/h1&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;PS C:\&amp;gt; dotnet .\DBFImport.dll `
&amp;gt;&amp;gt;     --path 'c:\Data\My DBF files\*.DBF' --codepage 1252 `
&amp;gt;&amp;gt;     --server 'DEVSERVER\SQL2017' --database 'ImportedDbfFiles'
Processing c:\Data\My DBF files\ABALANS.DBF...
  LastUpdate:       16/08/2018
  Fields:           14
  Records:          5
  Importing:
  Inserted:         1
  MarkedAsDeleted:  4
  Duration:         00:00:00.9591436
Processing c:\Data\My DBF files\ANALYT.dbf...
  LastUpdate:       26/10/2018
  Fields:           22
  Records:          33496
  Importing:        ................................
  Inserted:         32402
  MarkedAsDeleted:  1094
  Duration:         00:00:00.4355719
...

Import finished.
Statistics:
  Records:          4869097
  Succeeded files:  714
  Failed files:     0
  Total Duration:   00:02:46.6250966
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;download--installation&quot;&gt;Download &amp;amp; installation&lt;/h1&gt;

&lt;ul&gt;
  &lt;li&gt;Requires dotnet Core 2.1 (available on Windows, Linux, Mac).
    &lt;ul&gt;
      &lt;li&gt;Go to &lt;a href=&quot;https://getdotnet.org&quot;&gt;https://getdotnet.org&lt;/a&gt;, click “Download”, click “Download .net Core Runtime”.&lt;/li&gt;
      &lt;li&gt;Or install using Chocolatey: &lt;code class=&quot;highlighter-rouge&quot;&gt;choco install dotnetcore-runtime&lt;/code&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Download &amp;amp; unzip the zip-file DBFImport.zip from &lt;a href=&quot;https://github.com/WimObiwan/DBFImport/releases/latest&quot;&gt;https://github.com/WimObiwan/DBFImport/releases/latest&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;typical-speed-characteristics&quot;&gt;Typical speed characteristics&lt;/h1&gt;

&lt;p&gt;For what it’s worth, this is a real situation:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;DBFImport.dll running on high-end laptop with SSD disk, Intel i7, 16 GB RAM.&lt;/li&gt;
  &lt;li&gt;DBFImport.dll compiled in Release mode, running on Windows 10 (1804), using dotnet Core 2.1.205 SDK.&lt;/li&gt;
  &lt;li&gt;Import of 714 local DBF files, total size 2493014358 bytes (2.32 GiB)&lt;/li&gt;
  &lt;li&gt;Containing 4868381 records (excluding those marked for deletion)&lt;/li&gt;
  &lt;li&gt;{1} Import into a local SQL Server 2017 Developer Edition.&lt;/li&gt;
  &lt;li&gt;{2} Import into a remote SQL Server 2016 Standard Edition (server specs unknown, virtualized, hosted in a datacenter)&lt;/li&gt;
  &lt;li&gt;In every test, the existing (filled) tabled was dropped and recreated.&lt;/li&gt;
&lt;/ul&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt; &lt;/th&gt;
      &lt;th&gt;{1} Local SQL Server 2017&lt;/th&gt;
      &lt;th&gt;{2} Remote SQL Server 2016&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;SQL Command (&lt;code class=&quot;highlighter-rouge&quot;&gt;--nobulkcopy&lt;/code&gt;)&lt;/td&gt;
      &lt;td&gt;16:11.421 (971 s)&lt;br /&gt;4823 records/s&lt;br /&gt;2.36 MiB/s&lt;/td&gt;
      &lt;td&gt;(*) 50.5 hours&lt;br /&gt;27 records/s&lt;br /&gt;13.39 KiB/s&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;SQL BulkCopy&lt;/td&gt;
      &lt;td&gt;2:05.705 (126 s)&lt;br /&gt;38729 records/s&lt;br /&gt;18.91 MiB/s&lt;/td&gt;
      &lt;td&gt;9:48.394 (588 s)&lt;br /&gt;8274 records/s&lt;br /&gt;4.04 MiB/s&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Speedup of BulkCopy&lt;/td&gt;
      &lt;td&gt;7.73x&lt;/td&gt;
      &lt;td&gt;308.98x&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;(*) This test took ages, these numbers were obtained by extrapolation.&lt;/p&gt;

&lt;p&gt;Resource utilization of dotnet.exe:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt; &lt;/th&gt;
      &lt;th&gt;{1} Local SQL Server 2017&lt;/th&gt;
      &lt;th&gt;{2} Remote SQL Server 2016&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;SQL Command (&lt;code class=&quot;highlighter-rouge&quot;&gt;--nobulkcopy&lt;/code&gt;)&lt;/td&gt;
      &lt;td&gt;CPU: 4-8% (during 16 minutes)&lt;br /&gt;Memory: 12.2 MB&lt;/td&gt;
      &lt;td&gt;CPU: 0%&lt;br /&gt;Memory: 10.9 MB&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;SQL BulkCopy&lt;/td&gt;
      &lt;td&gt;CPU: 12% constantly (during 2 minutes)&lt;br /&gt;Memory: 12.1 MB&lt;/td&gt;
      &lt;td&gt;CPU: 1-4% (during 10 minutes)&lt;br /&gt;Memory: 11.7 MB&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h1 id=&quot;impact-of-the-option---nobulkcopy&quot;&gt;Impact of the option &lt;code class=&quot;highlighter-rouge&quot;&gt;--nobulkcopy&lt;/code&gt;&lt;/h1&gt;

&lt;ul&gt;
  &lt;li&gt;When using BulkCopy, alle INSERTs are done in Batches of 10000 records.  When an error happens, the current batch is rolled back, and the BuldCopy is aborted.  All records INSERTed during previous batches will be present in the table.&lt;/li&gt;
  &lt;li&gt;When not using BulkCopy, every INSERT is done (separately using a prepared SQL Command), inside a single transaction.  This means that when an error occurs, the complete transaction is rolled back, and no records will be present in the database.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;known-issues--to-dos&quot;&gt;Known issues &amp;amp; To do’s&lt;/h1&gt;

&lt;p&gt;Any feedback (&lt;a href=&quot;https://github.com/WimObiwan/DBFImport/issues&quot;&gt;issues&lt;/a&gt; or &lt;a href=&quot;https://github.com/WimObiwan/DBFImport/pulls&quot;&gt;pull requests&lt;/a&gt;) is welcome!&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Not alle datatypes from the xBase flavors are implemented.&lt;/li&gt;
  &lt;li&gt;Memo types (and DBT files) are not (yet) implemented.&lt;/li&gt;
  &lt;li&gt;Currently only SQL Server is supported.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;alternatives&quot;&gt;Alternatives&lt;/h1&gt;

&lt;p&gt;There are alternatives:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.microsoft.com/en-us/download/details.aspx?id=14839&quot;&gt;Microsoft OLE DB Provider for Visual FoxPro 9.0 (VfpOleDB.dll)&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://docs.microsoft.com/en-us/sql/odbc/microsoft/visual-foxpro-odbc-driver?view=sql-server-2017&quot;&gt;Visual FoxPro ODBC Driver&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;Commercial products&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For me these were insufficient because of:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;incompatibilities between 32-bit drivers and 64-bit SQL Sever&lt;/li&gt;
  &lt;li&gt;instabilities of SQL Server when using some of the drivers in linked servers&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;references&quot;&gt;References&lt;/h1&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/.dbf&quot;&gt;https://en.wikipedia.org/wiki/.dbf&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.manmrk.net/tutorials/database/xbase/&quot;&gt;http://www.manmrk.net/tutorials/database/xbase/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><author><name>Wim</name></author><category term="sql" /><summary type="html">A simple cross-platform tool to import old DBF files into SQL Server.</summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://mycomputeradventures.foxinnovations.be/foxpro.png" /></entry><entry><title type="html">SQL Server performance troubleshooting - Part 1</title><link href="https://mycomputeradventures.foxinnovations.be/2018/10/26/sql-performance-troubleshooting-part1/" rel="alternate" type="text/html" title="SQL Server performance troubleshooting - Part 1" /><published>2018-10-26T00:00:00+00:00</published><updated>2018-10-26T00:00:00+00:00</updated><id>https://mycomputeradventures.foxinnovations.be/2018/10/26/sql-performance-troubleshooting-part1</id><content type="html" xml:base="https://mycomputeradventures.foxinnovations.be/2018/10/26/sql-performance-troubleshooting-part1/">&lt;p&gt;SQL Server data/log file fragmentation can decrease performance.  This post gives some fixes for file and index fragmentation.&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;There are 2 types of fragmentations:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Fragmentation of the data/log files on file system level.&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;The cause of physical file fragmentation is mainly the &lt;em&gt;auto-grow&lt;/em&gt; feature in SQL Server.  This causes the data or log files to be extended in chunks whenever more space is needed.  Using auto-grow is discouraged: it causes heavy fragmentation, and causes a performance hit every time the auto-grow is performed. I have even seen a yoyo-effect when SQL command execution time is set to a low value: an &lt;code class=&quot;highlighter-rouge&quot;&gt;INSERT&lt;/code&gt; command causes an grow operation which takes a long time, causing the &lt;code class=&quot;highlighter-rouge&quot;&gt;INSERT&lt;/code&gt; to time out, and causing the grow to be reverted.  The &lt;code class=&quot;highlighter-rouge&quot;&gt;INSERT&lt;/code&gt; was then retried forever by the application, every time with the same result.&lt;/li&gt;
      &lt;li&gt;Disk fragmentation is only relevant for HDDs.  There is a huge &lt;em&gt;seek time penalty&lt;/em&gt; compared to sequential reads, which makes reads a lot more efficient when they can be done sequentially.&lt;/li&gt;
      &lt;li&gt;Defragmenting SSDs is discouraged.  There is no such &lt;em&gt;seek time penalty&lt;/em&gt;.  Moreover, defragmenting will decrease the lifetime of your SSDs.  &lt;a href=&quot;https://superuser.com/q/97071&quot;&gt;More information on StackOverflow/SuperUser&lt;/a&gt;.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Fragmentation of the pages inside the data/log.&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;SQL Server uses pages (of 8KB), grouped in extents (of 64KB), to allocate space inside the files (&lt;a href=&quot;https://docs.microsoft.com/en-us/sql/relational-databases/pages-and-extents-architecture-guide&quot;&gt;cfr. Microsoft&lt;/a&gt;).  Event when the files are not fragmented physically, the pages/extents will get fragmented over time.&lt;/li&gt;
      &lt;li&gt;Pages of indexes should not be completely full, since this will decrease performance because the first insert (or key update) on the page will cause a page split.  This is controlled by the &lt;em&gt;Fill factor&lt;/em&gt; (&lt;a href=&quot;https://www.brentozar.com/archive/2013/04/five-things-about-fillfactor/&quot;&gt;cfr Brentozar&lt;/a&gt;).&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;backup&quot;&gt;Backup&lt;/h2&gt;

&lt;p&gt;Don’t forget to make a fresh backup before doing these operations.&lt;/p&gt;

&lt;p&gt;The easiest way to do it is using SQL Server Management Studio:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Open the backup window:&lt;br /&gt;
&lt;img src=&quot;backup-1.png&quot; alt=&quot;Open the backup window&quot; /&gt;&lt;/p&gt;

    &lt;ol&gt;
      &lt;li&gt;Right click on your database&lt;/li&gt;
      &lt;li&gt;Open the &lt;em&gt;Tasks&lt;/em&gt; submenu&lt;/li&gt;
      &lt;li&gt;Click &lt;em&gt;Back Up…&lt;/em&gt;&lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Configure and start the backup:&lt;br /&gt;
&lt;img src=&quot;backup-2.png&quot; alt=&quot;Configure and start the backup&quot; /&gt;&lt;/p&gt;

    &lt;ol&gt;
      &lt;li&gt;Don’t forget to enable &lt;em&gt;Copy-only backup&lt;/em&gt;.  This is needed to prevent messing up with existing (transaction log &amp;amp; differential) backups, which would get corrupt when a new full backup is done outside the schedule.&lt;/li&gt;
      &lt;li&gt;Set a new location for the backup by removing the existing one, and adding a new one.&lt;/li&gt;
      &lt;li&gt;Click the &lt;em&gt;OK&lt;/em&gt; button to start the backup.&lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;physical-file-fragmentation&quot;&gt;Physical file fragmentation&lt;/h2&gt;

&lt;p&gt;(This doesn’t apply to SSDs.  Only do physical file defragmentation on regular HDDs!)&lt;/p&gt;

&lt;p&gt;There are several options to defragment this.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;One way to do it is running a defragmentation of the complete disk from within *Windows Explorer.  The advantage is that there are no extra tools needed.  The drawback is that this defragments all files (not only the data/log files).  If your data &amp;amp; log files are stored on different disks (which is a good practice), this needs to be repeated for every disk.  Be aware that there can be multiple data files.&lt;/p&gt;

    &lt;p&gt;&lt;img src=&quot;defragment-disk-1.png&quot; alt=&quot;Defragment disk&quot; /&gt;&lt;/p&gt;

    &lt;ol&gt;
      &lt;li&gt;Open &lt;em&gt;Windows Explorer&lt;/em&gt; and right click on the drive where the files are stored.&lt;/li&gt;
      &lt;li&gt;Click &lt;em&gt;Properties&lt;/em&gt; to open the disk properties.&lt;/li&gt;
    &lt;/ol&gt;

    &lt;p&gt;&lt;img src=&quot;defragment-disk-2.png&quot; alt=&quot;Defragment disk&quot; /&gt;&lt;/p&gt;

    &lt;ol&gt;
      &lt;li&gt;Go to the &lt;em&gt;Tools&lt;/em&gt; tab&lt;/li&gt;
      &lt;li&gt;Click &lt;em&gt;Optimize&lt;/em&gt;, and click &lt;em&gt;Optimize&lt;/em&gt; again on the next window to start the defragmentation.&lt;/li&gt;
    &lt;/ol&gt;

    &lt;p&gt;A last remark when using SSDs: The &lt;em&gt;Optimize&lt;/em&gt; process on SSD disks doesn’t do a defragmentation, but just sends a &lt;em&gt;trim&lt;/em&gt; to reclaim free blocks.  So this doesn’t apply to this article on performance.  &lt;a href=&quot;https://superuser.com/a/479211&quot;&gt;More info on StackOverflow/Superuser&lt;/a&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;There is a way to run defragmentation on file level, which requires the SysInternals &lt;code class=&quot;highlighter-rouge&quot;&gt;contig.exe&lt;/code&gt; tool.&lt;br /&gt;
Two ways to get it:&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;By downloading it from the &lt;a href=&quot;https://docs.microsoft.com/en-us/sysinternals/downloads/contig&quot;&gt;SysInternals website&lt;/a&gt;.&lt;/li&gt;
      &lt;li&gt;Or by installing using &lt;a href=&quot;https://chocolatey.org/packages/sysinternals&quot;&gt;Chocolatey&lt;/a&gt;:&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-powershell&quot; data-lang=&quot;powershell&quot;&gt;    choco &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;sysinternals
    &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Next you analyze individual data/log files by running:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-powershell&quot; data-lang=&quot;powershell&quot;&gt;  contig.exe -a &lt;span class=&quot;s1&quot;&gt;'&amp;amp;lt;filepath&amp;amp;gt;'&lt;/span&gt;
  &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;img src=&quot;defragment-contig-1.png&quot; alt=&quot;contig.exe -a&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Doing the actual defragmentation can be done by removing the &lt;code class=&quot;highlighter-rouge&quot;&gt;-a&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-powershell&quot; data-lang=&quot;powershell&quot;&gt;  contig.exe &lt;span class=&quot;s1&quot;&gt;'&amp;amp;lt;filepath&amp;amp;gt;'&lt;/span&gt;
  &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;img src=&quot;defragment-contig-2.png&quot; alt=&quot;contig.exe -a&quot; /&gt;&lt;/p&gt;

&lt;p&gt;In this example, the defragmentation has turned the 14 original fragments into 1 contiguous fragment. In a more realistic scenario which was executed at a customer, almost 9000 fragments were turned into 2 fragments.&lt;br /&gt;
  The &lt;code class=&quot;highlighter-rouge&quot;&gt;contig.exe&lt;/code&gt; tool doesn’t report any progress of the file defragmentation.  But the progress can be &lt;em&gt;monitored&lt;/em&gt; by running &lt;code class=&quot;highlighter-rouge&quot;&gt;contig.exe&lt;/code&gt; using &lt;code class=&quot;highlighter-rouge&quot;&gt;-a&lt;/code&gt; in another window, where you will see that the fragments are decreasing rapidly.&lt;br /&gt;
  In theory, it is perfectly safe to &lt;em&gt;kill&lt;/em&gt; a running &lt;code class=&quot;highlighter-rouge&quot;&gt;contig.exe&lt;/code&gt;, by pressing &lt;code class=&quot;highlighter-rouge&quot;&gt;Ctrl-C&lt;/code&gt;.  The tool can be restarted later on, causing it to continue where it was stopped.
  It is unclear if &lt;code class=&quot;highlighter-rouge&quot;&gt;contig.exe&lt;/code&gt; is as smart as the whole-disk &lt;em&gt;Optimize&lt;/em&gt; tool mentioned above, with regard to SSDs.  So I don’t recommend running it on SSDs.&lt;/p&gt;

&lt;h2 id=&quot;logical-file-fragmentation&quot;&gt;Logical file fragmentation&lt;/h2&gt;

&lt;p&gt;In this topic, we are talking about index fragmentation.  But be aware that (in the likely case that the table has a clustered index), a table is just a special kind of index.&lt;br /&gt;
A SQL Server index can be considered fragmented when it has more than 5% fragmentation.  Tables smaller than 1000 pages will normally not benifit from defragmentation.&lt;/p&gt;

&lt;p&gt;The most fragmented indexes can be found by running this query on your database:  (to be repeated per database)&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sql&quot; data-lang=&quot;sql&quot;&gt;&lt;span class=&quot;k&quot;&gt;WITH&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fragmented_indexes&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;AS&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; 
		&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;schema&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;table&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ips&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;page_count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; 
		&lt;span class=&quot;n&quot;&gt;ips&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;avg_fragmentation_in_percent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; 
		&lt;span class=&quot;n&quot;&gt;ips&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;page_count&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ips&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;avg_fragmentation_in_percent&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;weight&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dm_db_index_physical_stats&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DB_ID&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ips&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;JOIN&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;indexes&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ON&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ips&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;object_id&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;object_id&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;AND&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ips&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;index_id&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;index_id&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;JOIN&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tables&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ON&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;object_id&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;object_id&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;JOIN&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;schemas&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ON&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;schema_id&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;schema_id&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;page_count&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;avg_fragmentation_in_percent&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; 
&lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fragmented_indexes&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;ORDER&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;weight&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DESC&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Or if you have many indexes on many tables, the next query can be used to show a list per table:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sql&quot; data-lang=&quot;sql&quot;&gt;&lt;span class=&quot;k&quot;&gt;WITH&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fragmented_indexes&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;AS&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; 
		&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;schema&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;table&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ips&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;page_count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; 
		&lt;span class=&quot;n&quot;&gt;ips&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;avg_fragmentation_in_percent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; 
		&lt;span class=&quot;n&quot;&gt;ips&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;page_count&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ips&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;avg_fragmentation_in_percent&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;weight&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dm_db_index_physical_stats&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DB_ID&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;NULL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ips&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;JOIN&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;indexes&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ON&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ips&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;object_id&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;object_id&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;AND&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ips&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;index_id&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;index_id&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;JOIN&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;tables&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ON&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;object_id&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;object_id&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;JOIN&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sys&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;schemas&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ON&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;schema_id&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;schema_id&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;WHERE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;page_count&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;avg_fragmentation_in_percent&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;SELECT&lt;/span&gt; 
	&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;schema&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;table&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;COUNT&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;indexes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;SUM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;page_count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;page_count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;  
	&lt;span class=&quot;k&quot;&gt;AVG&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;avg_fragmentation_in_percent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;avg_fragmentation_in_percent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; 
	&lt;span class=&quot;k&quot;&gt;SUM&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;weight&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;weight&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;FROM&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fragmented_indexes&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;GROUP&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;schema&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;table&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;ORDER&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;BY&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;weight&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DESC&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Defragmenting indexes: indexes can be Reorganized (recommended for low fragmentation, e.g. between 5% and 20%), or Rebuild (recommended for heavy fragmentation, e.g. more than 20%).  Index Reorganization can be done on-line.  Index Rebuilds can only be done on-line on SQL Server Enterprise Edition.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;On SQL Server Standard Edition (or above), you should run a Maintenance plan to reorganize/rebuild indexes regularly, e.g. every week.&lt;/li&gt;
  &lt;li&gt;Alternatively, &lt;a href=&quot;https://ola.hallengren.com/sql-server-index-and-statistics-maintenance.html&quot;&gt;Ola Hallengren&lt;/a&gt; has maintenance scripts that can used even on SQL Server Express Edition where no SQL Server Agent is available.  (Kohera)[https://kohera.be/blog/sql-server/providing-a-sql-server-express-edition-with-a-solid-maintenance-plan/] shows how to use the Windows Task manager as an alternative.&lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Indexes can be defragmentated manually, per table or index, by running REORGANIZE or REBUILD on indexes.&lt;br /&gt;
&lt;img src=&quot;reorganize-rebuild.png&quot; alt=&quot;Reorganize Rebuild&quot; /&gt;&lt;/p&gt;

    &lt;ol&gt;
      &lt;li&gt;Expland the table entry in the Object Explorer.&lt;/li&gt;
      &lt;li&gt;Right click on the Indexes node (to run the operation on all indexes) or an individual index under the Indexes node (to run the operation on a single index).&lt;/li&gt;
      &lt;li&gt;Select Rebuild or Reorganize.&lt;/li&gt;
    &lt;/ol&gt;

    &lt;p&gt;You can investigate the progress of a REORGANIZE operation by running the SQL script above.  The index fragmentation will get lower in real-time while the operation is running.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;</content><author><name>Wim</name></author><category term="sql" /><category term="performance" /><summary type="html">SQL Server data/log file fragmentation can decrease performance. This post gives some fixes for file and index fragmentation.</summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://mycomputeradventures.foxinnovations.be/sql-server-performance.png" /></entry><entry><title type="html">pflogsumm</title><link href="https://mycomputeradventures.foxinnovations.be/2018/09/29/pflogsumm-with-srs/" rel="alternate" type="text/html" title="pflogsumm" /><published>2018-09-29T00:00:00+00:00</published><updated>2018-09-29T00:00:00+00:00</updated><id>https://mycomputeradventures.foxinnovations.be/2018/09/29/pflogsumm-with-srs</id><content type="html" xml:base="https://mycomputeradventures.foxinnovations.be/2018/09/29/pflogsumm-with-srs/">&lt;p&gt;pflogsumm is a great tool to generate a (daily) report on Postfix logs.  SRS-rewrites invalidate the From-addresses, but the log files can be preprocessed as a workaround.&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;More information on pflogsumm can be found in &lt;a href=&quot;https://linux.die.net/man/1/pflogsumm&quot;&gt;this man-page&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you configured SRS on your Postfix mailserver, From-addresses get rewritten to&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;SRS0=HHH=TT=booking.com=mailing@foxinnovations.be
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;To allow correct reporting on From-addresses and From-domains by pflogsumm, you can replace the SRS-addresses by there original counterparts by running this script:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cat /var/log/mail.log.1 /var/log/mail.log \
	| sed 's/&amp;lt;SRS0=[^=]*=[^=]*=\([^=]*\)=\([^@]*\)@.*&amp;gt;/&amp;lt;\2@\1&amp;gt;/g' \
	| sed 's/&amp;lt;SRS1=[^=]*=[^=]*==[^=]*=[^=]*=\([^=]*\)=\([^@]*\)@.*&amp;gt;/&amp;lt;\2@\1&amp;gt;/g'
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;For example, to mail a report about yesterday, this script can be run:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cat /var/log/mail.log.1 /var/log/mail.log \
	| sed 's/&amp;lt;SRS0=[^=]*=[^=]*=\([^=]*\)=\([^@]*\)@.*&amp;gt;/&amp;lt;\2@\1&amp;gt;/g' \
	| sed 's/&amp;lt;SRS1=[^=]*=[^=]*==[^=]*=[^=]*=\([^=]*\)=\([^@]*\)@.*&amp;gt;/&amp;lt;\2@\1&amp;gt;/g' \
	| /usr/sbin/pflogsumm -d yesterday &amp;gt; /tmp/mail 2&amp;gt;&amp;amp;1
cat /tmp/mail | mail -aFrom:myserver@example.com -s &quot;[Mon] Mail stats&quot; me@example.com
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You can call this script from your crontab, e.g. every day, a few minutes after midnight.&lt;/p&gt;</content><author><name>Wim</name></author><category term="postfix" /><category term="mail" /><summary type="html">pflogsumm is a great tool to generate a (daily) report on Postfix logs. SRS-rewrites invalidate the From-addresses, but the log files can be preprocessed as a workaround.</summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://mycomputeradventures.foxinnovations.be/postfix.jpeg" /></entry><entry><title type="html">Zabbix SIP server monitoring</title><link href="https://mycomputeradventures.foxinnovations.be/2018/08/01/zabbix-sip/" rel="alternate" type="text/html" title="Zabbix SIP server monitoring" /><published>2018-08-01T00:00:00+00:00</published><updated>2018-08-01T00:00:00+00:00</updated><id>https://mycomputeradventures.foxinnovations.be/2018/08/01/zabbix-sip</id><content type="html" xml:base="https://mycomputeradventures.foxinnovations.be/2018/08/01/zabbix-sip/">&lt;p&gt;Zabbix can be used to monitor availability and up-time of a SIP server or phone.&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;A template can be found on GitHub: &lt;a href=&quot;https://github.com/WimObiwan/ZabbixCustomTemplates/tree/master/SIP&quot;&gt;Link&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;The template uses an external script to run the check.  You need to put the contents of the &lt;em&gt;externalscripts&lt;/em&gt; subfolder under your Zabbix external scripts folder (on my Zabbix installation on Debian, this is &lt;code class=&quot;highlighter-rouge&quot;&gt;/usr/lib/zabbix/externalscripts/&lt;/code&gt;)&lt;/li&gt;
  &lt;li&gt;Import the template in the Zabbix user interface:
    &lt;ul&gt;
      &lt;li&gt;Go to &lt;em&gt;Configuration&lt;/em&gt;, &lt;em&gt;Templates&lt;/em&gt;&lt;/li&gt;
      &lt;li&gt;In the top-right corner, click on &lt;em&gt;Import&lt;/em&gt;&lt;/li&gt;
      &lt;li&gt;Select the template XML file and click &lt;em&gt;Import&lt;/em&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;</content><author><name>Wim</name></author><category term="zabbix" /><category term="sip" /><category term="voip" /><summary type="html">Zabbix can be used to monitor availability and up-time of a SIP server or phone.</summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://mycomputeradventures.foxinnovations.be/zabbix.png" /></entry><entry><title type="html">SQL Server performance testing</title><link href="https://mycomputeradventures.foxinnovations.be/2018/04/04/sql-performance-testing/" rel="alternate" type="text/html" title="SQL Server performance testing" /><published>2018-04-04T00:00:00+00:00</published><updated>2018-04-04T00:00:00+00:00</updated><id>https://mycomputeradventures.foxinnovations.be/2018/04/04/sql-performance-testing</id><content type="html" xml:base="https://mycomputeradventures.foxinnovations.be/2018/04/04/sql-performance-testing/">&lt;p&gt;With your databases stored on SSD-disks on fast development machines, it becomes difficult to reproduce performance problems that occur on customer machines.  This post gives some tricks to allow troubleshoot performance problems, while still using your fast development machine.&lt;/p&gt;

&lt;!--more--&gt;

&lt;h1 id=&quot;store-your-database-data-file-on-an-external-usb-disk&quot;&gt;Store your database data file on an external USB disk&lt;/h1&gt;

&lt;p&gt;Before you detache the USB drive, you should:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;In SQL Server Management Studio: Bring the database offline (or detach the database)&lt;/li&gt;
  &lt;li&gt;In Windows: Prepare the USB drive to detach (as you should always do with USB-disks)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you happen to forget one of these, it can happen that the database gets corrupted.  When this happens, you can correct the problems by running a &lt;code class=&quot;highlighter-rouge&quot;&gt;DBCC CHECKDB&lt;/code&gt; as in single-user mode:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sql&quot; data-lang=&quot;sql&quot;&gt;&lt;span class=&quot;k&quot;&gt;ALTER&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DATABASE&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;MyDatabase&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;USBDISK&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;SET&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SINGLE_USER&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;WITH&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ROLLBACK&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;IMMEDIATE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;GO&lt;/span&gt;
 
&lt;span class=&quot;n&quot;&gt;DBCC&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;CHECKDB&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;GO&lt;/span&gt;
 
&lt;span class=&quot;k&quot;&gt;ALTER&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;DATABASE&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;MyDatabase&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;USBDISK&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;SET&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MULTI_USER&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;GO&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h1 id=&quot;prevent-caching-of-query-data-in-memory&quot;&gt;Prevent caching of query data in memory&lt;/h1&gt;

&lt;p&gt;A slow USB disk will make the query slow once, but after that, the query will fast because the data is cached in (much faster) memory.  To prevent this, you can run this query:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sql&quot; data-lang=&quot;sql&quot;&gt;&lt;span class=&quot;n&quot;&gt;WHILE&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;-- repeat forever
&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;BEGIN&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;-- clear query cache
&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;DBCC&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;FREEPROCCACHE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;-- clear data cache
&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;DBCC&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;DROPCLEANBUFFERS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;-- wait 3s
&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;WAITFOR&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;DELAY&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'00:00:03'&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;END&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;GO&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;This query will run forever unless an error happens (e.g. connection issue) or the query is canceled by the user.&lt;/p&gt;</content><author><name>Wim</name></author><category term="sql" /><category term="performance" /><summary type="html">With your databases stored on SSD-disks on fast development machines, it becomes difficult to reproduce performance problems that occur on customer machines. This post gives some tricks to allow troubleshoot performance problems, while still using your fast development machine.</summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://mycomputeradventures.foxinnovations.be/sql-server-performance.png" /></entry><entry><title type="html">RDP credential caching</title><link href="https://mycomputeradventures.foxinnovations.be/2018/03/18/rdp-client-credential-caching/" rel="alternate" type="text/html" title="RDP credential caching" /><published>2018-03-18T00:00:00+00:00</published><updated>2018-03-18T00:00:00+00:00</updated><id>https://mycomputeradventures.foxinnovations.be/2018/03/18/rdp-client-credential-caching</id><content type="html" xml:base="https://mycomputeradventures.foxinnovations.be/2018/03/18/rdp-client-credential-caching/">&lt;p&gt;In Microsoft’s RDP client, you can enable a checkbox to save your password.  Usually, this doesn’t work, because by default delegating the credentials isn’t allowed by the Group Policy.  This post explains how to enable this.&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;When you connect to a &lt;em&gt;Terminal Server&lt;/em&gt;, you can get this error message when using saved credentials: &lt;strong&gt;Your credentials didn’t work.  The credentials that were used to connect to &lt;em&gt;[some server]&lt;/em&gt; did not work.  Please enter new credentials.&lt;/strong&gt;
&lt;img src=&quot;rdp-client-credential-caching-0.png&quot; alt=&quot;Enable&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Follow these steps to enable delegating credentials:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;Open the &lt;em&gt;Group Policy Editor&lt;/em&gt; as &lt;em&gt;administrator&lt;/em&gt;:&lt;br /&gt;
One way to do this is:&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;Press the &lt;em&gt;Windows-key&lt;/em&gt;, and type &lt;code class=&quot;highlighter-rouge&quot;&gt;Powershell&lt;/code&gt;.&lt;/li&gt;
      &lt;li&gt;Powershell will be found: right click on the result, and select &lt;em&gt;Run as administrator&lt;/em&gt;.&lt;/li&gt;
      &lt;li&gt;In the &lt;em&gt;Powershell prompt&lt;/em&gt;, type &lt;code class=&quot;highlighter-rouge&quot;&gt;gpedit.msc&lt;/code&gt;,and press Enter.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Update the settings in the &lt;em&gt;Group Policy Editor&lt;/em&gt;:&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;
        &lt;p&gt;In the left-side tree pane, navigate to:&lt;/p&gt;

        &lt;ul&gt;
          &lt;li&gt;Local Computer Policy&lt;/li&gt;
          &lt;li&gt;Computer Configuration&lt;/li&gt;
          &lt;li&gt;Administrative Templates&lt;/li&gt;
          &lt;li&gt;System&lt;/li&gt;
          &lt;li&gt;Credentials Delegation&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;
        &lt;p&gt;In the right pane, double click on:&lt;/p&gt;

        &lt;ul&gt;
          &lt;li&gt;Allow delegating saved credentials with NTLM-only server authentication&lt;br /&gt;
&lt;img src=&quot;rdp-client-credential-caching-1.png&quot; alt=&quot;Allow delegating saved credentials with NTLM-only server authentication&quot; /&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;
        &lt;p&gt;Select the radio button &lt;em&gt;Enabled&lt;/em&gt;:&lt;br /&gt;
&lt;img src=&quot;rdp-client-credential-caching-2.png&quot; alt=&quot;Enable&quot; /&gt;&lt;/p&gt;
      &lt;/li&gt;
      &lt;li&gt;
        &lt;p&gt;Click on &lt;em&gt;Show…&lt;/em&gt; beside &lt;em&gt;Add servers to the list&lt;/em&gt;.&lt;/p&gt;
      &lt;/li&gt;
      &lt;li&gt;
        &lt;p&gt;Add a new entry &lt;code class=&quot;highlighter-rouge&quot;&gt;TERMSRV/*&lt;/code&gt;to enable delegation for all servers:&lt;br /&gt;
&lt;img src=&quot;rdp-client-credential-caching-3.png&quot; alt=&quot;Enable&quot; /&gt;&lt;/p&gt;
      &lt;/li&gt;
      &lt;li&gt;
        &lt;p&gt;Repeat the same for &lt;em&gt;Allow delegating saved credentials&lt;/em&gt;.&lt;/p&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Apply the &lt;em&gt;Group Policy&lt;/em&gt; with the new changes:&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;In the &lt;em&gt;Powershell prompt&lt;/em&gt;, run the command &lt;code class=&quot;highlighter-rouge&quot;&gt;gpupdate&lt;/code&gt;.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ol&gt;</content><author><name>Wim</name></author><category term="windows" /><category term="mstsc" /><category term="rdp" /><summary type="html">In Microsoft’s RDP client, you can enable a checkbox to save your password. Usually, this doesn’t work, because by default delegating the credentials isn’t allowed by the Group Policy. This post explains how to enable this.</summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://mycomputeradventures.foxinnovations.be/rdp-client-credential-caching.jpeg" /></entry><entry><title type="html">Android Auto, and how to use it in non-supported countries</title><link href="https://mycomputeradventures.foxinnovations.be/2018/03/10/google-auto-installation/" rel="alternate" type="text/html" title="Android Auto, and how to use it in non-supported countries" /><published>2018-03-10T00:00:00+00:00</published><updated>2018-03-10T00:00:00+00:00</updated><id>https://mycomputeradventures.foxinnovations.be/2018/03/10/google-auto-installation</id><content type="html" xml:base="https://mycomputeradventures.foxinnovations.be/2018/03/10/google-auto-installation/">&lt;p&gt;Android Auto is a great application on your Android phone, that integrates seamlessly with all types of new cars. 
In many countries it isn’t available (yet?), but luckily - with some simple steps - it can be installed and used.&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;The feature is amazing: you connect your phone using USB to your car, and some of the applications become available on the screen of your car media system.  On Opel Insignia cars, the feature is called &lt;em&gt;Projection&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;First the main screen shows:&lt;br /&gt;
«TODO IMAGE»&lt;/p&gt;

&lt;p&gt;After connecting the phone, the &lt;em&gt;Projection&lt;/em&gt; icon changes into the &lt;em&gt;Android Auto&lt;/em&gt; logo:&lt;br /&gt;
«TODO IMAGE»&lt;/p&gt;

&lt;p&gt;After touching the icon, you get a literally some kind of &lt;em&gt;projection&lt;/em&gt; of the Android Auto application on your car media screen:&lt;br /&gt;
«TODO IMAGE»&lt;/p&gt;

&lt;p&gt;Other applications like Waze and Spotify integrate in Android Auto:&lt;br /&gt;
«TODO IMAGE»&lt;br /&gt;
«TODO IMAGE»&lt;/p&gt;

&lt;p&gt;According to &lt;a href=&quot;https://www.android.com/intl/en_ca/auto/&quot;&gt;the Android Auto site&lt;/a&gt;, the application is only available in these countries: Argentina, Australia, Austria, Bolivia, Brazil, Canada, Chile, Colombia, Costa Rica, Dominican Republic, Ecuador, France, Germany, Guatemala, India, Ireland, Italy, Japan, Mexico, New Zealand, Panama, Paraguay, Peru, Puerto Rico, Russia, Spain, Switzerland, United Kingdom, United States, Uruguay and Venezuela.  So if you live in Belgium or the Netherlands, you can’t install the application from &lt;a href=&quot;https://play.google.com&quot;&gt;Google Play&lt;/a&gt;.  It doesn’t even show up in the &lt;a href=&quot;https://play.google.com/store/search?q=android%20auto&quot;&gt;search results&lt;/a&gt;, unless you are in one of the supported countries, and you are not logged in with your Google Account.  When you search on the &lt;a href=&quot;https://play.google.com/store/apps/details?id=com.google.android.projection.gearhead&quot;&gt;APK ID&lt;/a&gt; and try to install it on your phone, you get the error &lt;code class=&quot;highlighter-rouge&quot;&gt;This item isn't available in your country.&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The list of supported cars and car media is impressive: Abarth, Acura, Alfa Romeo, Alpine, Audi, Buick, Cadillac, Chevrolet, Chrysler, Citroën, CVTE, Dodge, DS, Fiat, Ford, Genesis, GMC, Holden, Honda, Hyundai, JBL, Jeep, JVC, Karma, Kenwood, KIA, Lamborghini, The Lincoln Company, Macrom, Mahindra, Maruti/Suzuki, Maserati, Mercedes-Benz, Mitsubishi Motors, Nissan, Opel, Panasonic, Peugeot, Pioneer, RAM, Renault, Seat, Škoda, Smart, Sony, SsangYong, Subaru, Suzuki, Tata Motors, Vauxhall, Volkswagen and Volvo.
Others have already announced the support of Android Auto: Bentley, Blaupunkt, Borgward, Caska, Infiniti, Iveco, Jaguar, Koenigsegg, Lada, Land Rover, Mazda, MMauto, Renault Samsung Motors, SmartAuto, UniMax and Zenec.&lt;/p&gt;

&lt;p&gt;Android Auto runs on Android 5.0+ (Lollipop, Marshmallow, Nougat, or Oreo) and you need a data connection.&lt;/p&gt;

&lt;p&gt;To force installing Android Auto on your phone in a non-supported country, you can manually install the APK.&lt;/p&gt;

&lt;p&gt;First you need to allow installations from sources other than the Google Play store:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Open the &lt;em&gt;Settings&lt;/em&gt; on the phone&lt;br /&gt;
 &lt;img src=&quot;google-auto-installation-settings1.png&quot; alt=&quot;Settings step 1&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;Tap on the &lt;em&gt;Security&lt;/em&gt; item&lt;br /&gt;
 &lt;img src=&quot;google-auto-installation-settings2.png&quot; alt=&quot;Settings step 2&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;Make sure the checkbox “Unknown sources” (Allow installations from sources other than the Play Store) is enabled&lt;br /&gt;
 &lt;img src=&quot;google-auto-installation-settings3.jpg&quot; alt=&quot;Settings step 3&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;After you finished the steps below, you should restore the setting.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then you can install the APK manually: on your phone, download &amp;amp; run the APK.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;One of the sites you can use is &lt;a href=&quot;https://www.apkmirror.com/apk/google-inc/android-auto/&quot;&gt;APK Mirror&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;Open the website on your phone.&lt;/li&gt;
  &lt;li&gt;At the bottom, select the most recent version.&lt;/li&gt;
  &lt;li&gt;Select the correct architecture (most likely &lt;em&gt;arm64&lt;/em&gt;)&lt;/li&gt;
  &lt;li&gt;Tap the button &lt;em&gt;DOWNLOAD APK&lt;/em&gt;&lt;/li&gt;
  &lt;li&gt;After the download, open the APK file, which will install the Android Auto application.&lt;/li&gt;
  &lt;li&gt;When finished, you can restore the setting to allow “Unknown sources”.&lt;/li&gt;
&lt;/ul&gt;</content><author><name>Wim</name></author><category term="android-auto" /><category term="opel" /><category term="apk" /><summary type="html">Android Auto is a great application on your Android phone, that integrates seamlessly with all types of new cars. In many countries it isn’t available (yet?), but luckily - with some simple steps - it can be installed and used.</summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://mycomputeradventures.foxinnovations.be/google-auto-installation-logo.jpg" /></entry><entry><title type="html">Getting started with VS Code using C# and .NET Core on Ubuntu</title><link href="https://mycomputeradventures.foxinnovations.be/2016/10/24/ubuntu-c-sharp/" rel="alternate" type="text/html" title="Getting started with VS Code using C# and .NET Core on Ubuntu" /><published>2016-10-24T00:00:00+00:00</published><updated>2016-10-24T00:00:00+00:00</updated><id>https://mycomputeradventures.foxinnovations.be/2016/10/24/ubuntu-c-sharp</id><content type="html" xml:base="https://mycomputeradventures.foxinnovations.be/2016/10/24/ubuntu-c-sharp/">&lt;p&gt;A tutorial on how to compile and run C# application on Ubuntu with Visual Studio Code and .NET Core.&lt;/p&gt;

&lt;!--more--&gt;

&lt;iframe src=&quot;https://channel9.msdn.com/Blogs/dotnet/Get-started-with-VS-Code-Csharp-dotnet-Core-Ubuntu/player&quot; width=&quot;800&quot; height=&quot;450&quot; allowfullscreen=&quot;&quot; frameborder=&quot;0&quot;&gt;&lt;/iframe&gt;

&lt;p&gt;Steps:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Download &amp;amp; install Visual Studio Code from &lt;a href=&quot;https://code.visualstudio.com/download&quot;&gt;this link&lt;/a&gt;.&lt;br /&gt;
For Ubuntu, download the DEB file and install by double clicking on it.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;Enable the C# plugin
    &lt;ul&gt;
      &lt;li&gt;Ctrl-Shift-X&lt;/li&gt;
      &lt;li&gt;Search for C# (provider Microsoft)&lt;/li&gt;
      &lt;li&gt;Enable the plugin and restart Visual Studio Code.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Install .NET Core (as documented on &lt;a href=&quot;https://www.microsoft.com/net/core#ubuntu&quot;&gt;this link&lt;/a&gt;)&lt;/p&gt;

    &lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# For Ubuntu 16.04, but also works on Ubuntu 16.10.
sudo sh -c 'echo &quot;deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ xenial main&quot; &amp;gt; /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893
sudo apt-get update
sudo apt-get install dotnet-dev-1.0.0-preview2-003131
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;</content><author><name>Wim</name></author><category term="c#" /><category term="visualstudio" /><category term="ubuntu" /><summary type="html">A tutorial on how to compile and run C# application on Ubuntu with Visual Studio Code and .NET Core.</summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://mycomputeradventures.foxinnovations.be/vs2015.png" /></entry><entry><title type="html">Microsoft development tools build numbers - Visual Studio 2015 Update 3</title><link href="https://mycomputeradventures.foxinnovations.be/2016/10/07/microsoft-development-build-numbers/" rel="alternate" type="text/html" title="Microsoft development tools build numbers - Visual Studio 2015 Update 3" /><published>2016-10-07T00:00:00+00:00</published><updated>2016-10-07T00:00:00+00:00</updated><id>https://mycomputeradventures.foxinnovations.be/2016/10/07/microsoft-development-build-numbers</id><content type="html" xml:base="https://mycomputeradventures.foxinnovations.be/2016/10/07/microsoft-development-build-numbers/">&lt;p&gt;It is quite a challenge to understand the versions and build numbers of the Microsoft build chain.  This post tries to list them up…&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;&lt;a href=&quot;/docs/microsoft-development-build-numbers/&quot;&gt;Click here to see the complete list of versions&lt;/a&gt;&lt;/p&gt;

&lt;h1 id=&quot;visual-studio-2015-build-numbers&quot;&gt;Visual Studio 2015 build numbers&lt;/h1&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Date&lt;/th&gt;
      &lt;th&gt;Name&lt;/th&gt;
      &lt;th&gt;IDE Version&lt;/th&gt;
      &lt;th&gt;C++ Compiler&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;2016-09-14&lt;/td&gt;
      &lt;td&gt;Visual Studio 2015 Update 3 “d”&lt;/td&gt;
      &lt;td&gt;14.0.25431.01&lt;/td&gt;
      &lt;td&gt;19.00.24213.1&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;2016-08-02&lt;/td&gt;
      &lt;td&gt;Visual Studio 2015 Update 3 “c”&lt;/td&gt;
      &lt;td&gt;14.0.25425.01&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;2016-07-20&lt;/td&gt;
      &lt;td&gt;Visual Studio 2015 Update 3 “b”&lt;/td&gt;
      &lt;td&gt;14.0.25424.00&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;2016-07-12&lt;/td&gt;
      &lt;td&gt;Visual Studio 2015 Update 3 “a”&lt;/td&gt;
      &lt;td&gt;14.0.25422.01&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;2016-06-27&lt;/td&gt;
      &lt;td&gt;Visual Studio 2015 Update 3&lt;/td&gt;
      &lt;td&gt;14.0.25420.01&lt;/td&gt;
      &lt;td&gt;19.00.24210&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;</content><author><name>Wim</name></author><category term="c++" /><category term="visualstudio" /><category term="windows" /><summary type="html">It is quite a challenge to understand the versions and build numbers of the Microsoft build chain. This post tries to list them up…</summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://mycomputeradventures.foxinnovations.be/vs2015.png" /></entry><entry><title type="html">Outlook stuck on splash screen</title><link href="https://mycomputeradventures.foxinnovations.be/2016/06/07/outlook-splash-blocked/" rel="alternate" type="text/html" title="Outlook stuck on splash screen" /><published>2016-06-07T00:00:00+00:00</published><updated>2016-06-07T00:00:00+00:00</updated><id>https://mycomputeradventures.foxinnovations.be/2016/06/07/outlook-splash-blocked</id><content type="html" xml:base="https://mycomputeradventures.foxinnovations.be/2016/06/07/outlook-splash-blocked/">&lt;p&gt;After running Microsoft Outlook for years without problems, it won’t start anymore 
after a reboot.&lt;/p&gt;

&lt;!--more--&gt;

&lt;p&gt;This problem happened with Microsoft Outlook 2016, connected to 
an Office 365 online account.  But I assume it is rather unrelated to the version.&lt;/p&gt;

&lt;p&gt;After a reboot, I launched Outlook, and this was the result:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;outlook-splash.png&quot; alt=&quot;Outlook Splash&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The splash screen was shown infinitely, while indicating the status&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-Processing...```.&quot;&gt;
_Repairing_ the OST file with the tools from the Microsoft website didn't help.

This was the only thing that helped:

* kill outlook
* restart outlook in _safe_ mode (this succeeds immediately)
* close outlook
* restart outlook (which now also succeeds immediately)

A few PowerShell commands to do this:

```bash
# Kill outlook (or click the 'x' in the right/top corner of the splash screen)
(Get-Process outlook).Kill()

# Find the location of outlook.exe
$reg = 'HKLM:\SOFTWARE\Classes\Outlook.Application\CLSID'
$outlook_clsid = (Get-ItemProperty $reg).'(default)'
$reg = &quot;HKLM:\SOFTWARE\Classes\CLSID\$outlook_clsid\LocalServer32&quot;
$outlook_exe = (Get-ItemProperty $reg).'(default)'

# Start outlook in safe mode
. $outlook_exe /safe
&lt;/code&gt;&lt;/pre&gt;</content><author><name>Wim</name></author><category term="windows" /><category term="msoffice" /><summary type="html">After running Microsoft Outlook for years without problems, it won’t start anymore after a reboot.</summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://mycomputeradventures.foxinnovations.be/outlook.png" /></entry></feed>