<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Matt Lavery (MSFT) Blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/mlavery/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/mlavery/feed.xml</link>
    <description>Technical tips, tricks and information relating to SQL Server, PowerShell, Azure and other technologies</description>
    <lastBuildDate>Wed, 17 Apr 2019 04:10:45 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>TSQL to identify databases with high number of VLFs</title>
      <link>https://docs.microsoft.com/archive/blogs/mlavery/tsql-to-identify-databases-with-high-number-of-vlfs</link>
      <pubDate>Mon, 22 Apr 2013 15:39:00 GMT</pubDate>
      <dc:creator><![CDATA[MatticusAu]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/mlavery/2013/04/22/tsql-to-identify-databases-with-high-number-of-vlfs/</guid>
      <description><![CDATA[If you aren't aware there can be significant impact to performance when a database has a high number...]]></description>
      <content:encoded><![CDATA[<p>If you aren't aware there can be significant impact to performance when a database has a high number of VLFs within it's Transaction Log. SQL Server divides each physical transaction log file internally into a number of virtual log files (VLFs) and it is&nbsp;these that&nbsp;contain the log records.&nbsp; There is no fixed size for a VLF, and there is no fixed number which would be created within a physical log file. These values&nbsp;are all determined dynamically by SQL Server when creating or extending physical log files.&nbsp; While SQL Server tries to maintain a small number of VLFs for the best performance, file growth can result in a database having a large number of VLFs because the following equation will be used to determine the number of files to create within the new space.</p>
<p>- Less than 64MB = 4 VLFs <br />- Greater than 64MB and less than 1GB = 8 VLFs <br />- Greater than or equal to 1GB = 16 VLFs</p>
<p>So for example if I initially create a 1GB transaction log file it will be divided into 16 64MB VLFs, then if it grew a few times by 10 Mb before being switched to 10% the following trend would be experienced and result in a&nbsp;quickly increasing number of VLFs when then compared to manually growing the file:</p>
<table style="margin-right: auto; margin-left: auto;" border="0">
<tbody>
<tr>
<td><span style="text-decoration: underline; background-color: #ffffff;"><strong>Action</strong></span></td>
<td><span style="text-decoration: underline; background-color: #ffffff;"><strong>Space Added</strong></span></td>
<td><span style="text-decoration: underline; background-color: #ffffff;"><strong>VLFs Created</strong></span></td>
<td><span style="text-decoration: underline; background-color: #ffffff;"><strong>Total Size</strong></span></td>
<td><span style="text-decoration: underline; background-color: #ffffff;"><strong>Total VLFs</strong></span></td>
</tr>
<tr>
<td>Initial Size</td>
<td>1024 Mb</td>
<td>16</td>
<td>1024 Mb</td>
<td>16</td>
</tr>
<tr>
<td>Auto Grow</td>
<td>10&nbsp;Mb</td>
<td>4</td>
<td>1034 Mb</td>
<td>20</td>
</tr>
<tr>
<td>Auto Grow</td>
<td>10&nbsp;Mb</td>
<td>4</td>
<td>1044 Mb</td>
<td>24&nbsp;</td>
</tr>
<tr>
<td>Auto Grow</td>
<td>10&nbsp;Mb</td>
<td>4</td>
<td>1054 Mb</td>
<td>28</td>
</tr>
<tr>
<td>Auto Grow</td>
<td>10&nbsp;Mb</td>
<td>4</td>
<td>1064 Mb</td>
<td>32</td>
</tr>
<tr>
<td>Auto Grow</td>
<td>106&nbsp;Mb</td>
<td>8</td>
<td>1170&nbsp;Mb</td>
<td>40</td>
</tr>
<tr>
<td>Auto Grow</td>
<td>117&nbsp;Mb</td>
<td>8</td>
<td>1287&nbsp;Mb</td>
<td>48</td>
</tr>
<tr>
<td>&nbsp;Auto Grow</td>
<td>128 Mb</td>
<td>8</td>
<td>1415&nbsp;Mb</td>
<td>56</td>
</tr>
<tr>
<td>&nbsp;Auto Grow</td>
<td>141&nbsp;Mb</td>
<td>8</td>
<td>1556&nbsp;Mb</td>
<td>64</td>
</tr>
<tr>
<td>&nbsp;Auto Grow</td>
<td>155&nbsp;Mb</td>
<td>8</td>
<td>1711&nbsp;Mb</td>
<td>72</td>
</tr>
<tr>
<td>&nbsp;Auto Grow</td>
<td>171&nbsp;Mb</td>
<td>8</td>
<td>1882&nbsp;Mb</td>
<td>80</td>
</tr>
<tr>
<td>&nbsp;Auto Grow</td>
<td>188&nbsp;Mb</td>
<td>8</td>
<td>2070&nbsp;Mb</td>
<td>88</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>The only way to reduce the number of VLFs is to then Shrink the file and manually grow the file by a set size such as:</p>
<table style="margin-right: auto; margin-left: auto;" border="0">
<tbody>
<tr>
<td><span style="text-decoration: underline;"><strong>Action</strong></span></td>
<td><span style="text-decoration: underline;"><strong>Space Added</strong></span></td>
<td><span style="text-decoration: underline;"><strong>VLFs Created</strong></span></td>
<td><span style="text-decoration: underline;"><strong>Total Size</strong></span></td>
<td><span style="text-decoration: underline;"><strong>Total VLFs</strong></span></td>
</tr>
<tr>
<td>Initial Size</td>
<td>1024 Mb</td>
<td>16</td>
<td>1024 Mb</td>
<td>16</td>
</tr>
<tr>
<td>Manual Grow</td>
<td>1024 Mb</td>
<td>16</td>
<td>2048&nbsp;Mb</td>
<td>32</td>
</tr>
<tr>
<td>Auto Grow</td>
<td>204 Mb</td>
<td>8</td>
<td>2252&nbsp;Mb&nbsp;</td>
<td>40</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>Ideally you should keep the number of VLFs to as small as possible. In SQL 2012 there is now a warning raised when a database has &gt;10,000 VLFs, although there is no warning available in earlier versions of SQL Server. You can use the following TSQL though to report on the number of VLFs per database within your SQL Instance. Then if you compare this with your auto-grow settings for the database you can determine the reason for why the count is the way it is.</p>
<p>&nbsp;</p>
<p>SET NOCOUNT ON;</p>
<p>&nbsp;</p>
<p>/* declare variables required */</p>
<p>DECLARE @DatabaseId INT;</p>
<p>DECLARE @TSQL varchar(MAX);</p>
<p>DECLARE cur_DBs CURSOR FOR</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT database_id FROM sys.databases;</p>
<p>OPEN cur_DBs;</p>
<p>FETCH NEXT FROM cur_DBs INTO @DatabaseId</p>
<p>&nbsp;</p>
<p>--These table variables will be used to store the data</p>
<p>DECLARE @tblAllDBs Table (DBName sysname</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , FileId INT</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , FileSize BIGINT</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , StartOffset BIGINT</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , FSeqNo INT</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , Status TinyInt</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , Parity INT</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , CreateLSN NUMERIC(25,0)</p>
<p>)</p>
<p>IF&nbsp; '11' = substring(convert(char(12),serverproperty('productversion')), 1, 2)</p>
<p>BEGIN</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DECLARE @tblVLFs2012 Table (RecoveryUnitId BIGINT</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , FileId INT</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , FileSize BIGINT</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , StartOffset BIGINT</p>
<p>&nbsp;&nbs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p;&nbsp;&nbsp;&nbsp;&nbsp; , Parity INT</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , CreateLSN NUMERIC(25,0)</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; );</p>
<p>END</p>
<p>&nbsp;</p>
<p>--loop through each database and get the info</p>
<p>WHILE @@FETCH_STATUS = 0</p>
<p>BEGIN</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PRINT 'DB: ' + CONVERT(varchar(200), DB_NAME(@DatabaseId));</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SET @TSQL = 'dbcc loginfo('+CONVERT(varchar(12), @DatabaseId)+');';</p>
<p>&nbsp;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IF&nbsp; '11' = substring(convert(char(12),serverproperty('productversion')), 1, 2)</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BEGIN</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DELETE FROM @tblVLFs2012;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INSERT INTO @tblVLFs2012</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXEC(@TSQL);</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INSERT INTO @tblAllDBs</p>
<p>&nbsp;&nbs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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , StartOffset</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , FSeqNo</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , Status</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , Parity</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , CreateLSN</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FROM @tblVLFs;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; END</p>
<p>&nbsp;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FETCH NEXT FROM cur_DBs INTO @DatabaseId</p>
<p>END</p>
<p>CLOSE cur_DBs;</p>
<p>DEALLOCATE cur_DBs;</p>
<p>&nbsp;</p>
<p>--just for formating if output to Text</p>
<p>PRINT '';</p>
<p>PRINT '';</p>
<p>PRINT '';</p>
<p>&nbsp;</p>
<p>--Return the data based on what we have found</p>
<p>SELECT a.DBName</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , COUNT(a.FileId) AS [TotalVLFs]</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , MAX(b.[ActiveVLFs]) AS [ActiveVLFs]</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , (SUM(a.FileSize) / COUNT(a.FileId) / 1024) AS [AvgFileSizeKb]</p>
<p>FROM @tblAllDBs a</p>
<p>INNER JOIN (</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SELECT DBName</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , COUNT(FileId) [ActiveVLFs]</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FROM @tblAllDBs</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHERE Status = 2</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GROUP BY DBName</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ) b</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ON b.DBName = a.DBName</p>
<p>GROUP BY a.DBName</p>
<p>ORDER BY TotalVLFs DESC;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>SET NOCOUNT OFF;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><em><span style="color: #999999;">Legal Stuff: The contents of this blog is provided &ldquo;as-is&rdquo;. The information, opinions and views expressed are those of the author and do not necessarily state or reflect those of any other company with affiliation to the products discussed. This includes any URLs or Tools. The author does not accept any responsibility from the use of the information or tools mentioned within this blog, and recommends adequate evaluation against your own requirements to measure suitability.</span></em></p>
<p>&nbsp;</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>SQL 2012 Core on Windows Server 2012 (Part 2 - SQL Install)</title>
      <link>https://docs.microsoft.com/archive/blogs/mlavery/sql-2012-core-on-windows-server-2012-part-2-sql-install</link>
      <pubDate>Sun, 09 Sep 2012 19:41:00 GMT</pubDate>
      <dc:creator><![CDATA[MatticusAu]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/mlavery/2012/09/09/sql-2012-core-on-windows-server-2012-part-2-sql-install/</guid>
      <description><![CDATA[With the release of Windows Server 2012 I thought I would take the opportunity to look at running...]]></description>
      <content:encoded><![CDATA[<p>With the release of Windows Server 2012 I thought I would take the opportunity to look at running SQL 2012 Core on Windows Server 2012.</p>
<p>This blog is part 2 of a series which will look at the configuration for installing SQL 2012 Core on Windows Server Core, and then finish with adding AlwaysOn functionality to the environment.</p>
<p>In Part 1 of this series we covered building the Management Server (SQL2012-MGMT) and the SQL Server (SQL2012-01)&nbsp;</p>
<p>&nbsp;</p>
<p><span style="color: #ff0000;"><strong>IMPORTANT</strong></span>: It is important to highlight that there are particular requirements for installing SQL Server on Windows 2012 and those are available at <a href="http://support.microsoft.com/kb/2681562/EN-US">http://support.microsoft.com/kb/2681562/EN-US</a>. For SQL 2012&nbsp;the RTM release is supported on Windows 2012 however you should always refer to the official MSDN documentation to verify your hardware and software requirements (for SQL 2012 see&nbsp;<a href="http://msdn.microsoft.com/en-us/library/ms143506.aspx">http://msdn.microsoft.com/en-us/library/ms143506.aspx</a>). It is also important to&nbsp;note that&nbsp;this work is out of pure interest within an isolated&nbsp;LAB environment and does not represent any official supportability of this configuration, it is based on my experience when configuring the environment and you should verify the suitability and supportability of such configuration within your own environment.&nbsp;</p>
<p>&nbsp;</p>
<p><span style="text-decoration: underline;"><strong>Step&nbsp;1 -&nbsp;SQL Install (SQL2012-01)</strong></span></p>
<p>In this step we need to complete the SQL install on the Windows Server 2012 Core installation. As there is no GUI the install needs to be performed using an unattended install file and from the command line.</p>
<ol>
<li>Connect to the SQL Server using either your Hyper-V Console or RDP.</li>
<li>First we need to create the directories</li>
<ol>
<li>From the Command Prompt navigate to the drive and use the <em><strong>mkdir</strong></em> command to create the required directories where you will store the database files.<br />For my environment I have created the following directories as this provides segregation within environments with multiple SQL Instances on the one server.<br /><em>- E:\MSSQL11.MSSQLSERVER\MSSQL\Data</em><br /><em><em>- </em>F:\MSSQL11.MSSQLSERVER\MSSQL\Data</em><br /><em><em>- </em>G:\MSSQL11.MSSQLSERVER\MSSQL\Data</em><br /><em><em>- </em>H:\MSSQL11.MSSQLSERVER\MSSQL\BackupDB</em><br /><em><em>- </em>H:\MSSQL11.MSSQLSERVER\MSSQL\BackupTrnLog</em></li>
</ol>
<li>Ensure that the Windows Server 2012 installation media is inserted/mounted to the server's CD/DVD drive.</li>
<li>Using powershell add the .Net 3.5&nbsp;feature by the following command where #: is the drive to the Windows Server 2012 installation media (this is required as the installation source for .Net 3.5 was&nbsp;not included with the Windows install local source media):<br /><br /><em><strong>Install-WindowsFeature -Name NET-Framework-Core -Source #:\sources\sxs<br /></strong></em></li>
<li>Ensure that the SQL media is available on the server by either&nbsp;either:</li>
<ol>
<li>CD/DVD drive presented to the VM and mapped to the correct ISO (recommended)</li>
<li>or by copying the install media onto a drive of the vm</li>
</ol>
<li>Normally the GUI will be disabled for installation packages&nbsp;on Server Core, however you can run the SQL install package with the following parameter to allow the use of the GUI to allow you to generate the unattended installation file.<br /><br />D:\setup.exe /UIMODE=EnableUIOnServerCore /Action=install /INDICATEPROGRESS=True<br /><br />My personal preference is to always use an unattended install file, for more granular control and also easier management of multiple builds, so I&nbsp;use these parameters to run the&nbsp;UI and generate the unattended file or when troubleshooting installation issues.&nbsp;<em>IndicateProgress</em> ensures that the log information is displayed in the command line window so you can determine any hung operations or errors.<br /><br />For a full list of available parameters to configure within the unattended configuration file see <a href="http://msdn.microsoft.com/en-us/library/ms144259.aspx">http://msdn.microsoft.com/en-us/library/ms144259.aspx</a><br /><br />TIP: Ensure that you specify your local account as a SysAdmin account (or your DBA Team's Domain Group) so that you can connect and administer the server remotely. I'll cover restricting the membership of the sysadmins group and why you no longer need that privilege in another post, but at least for the initial setup this simplifies things, just remember to change it later.</li>
<li>To perform the install using the Unattended Configuration File I created a directory on the server C:\SQLInstall and copied my unattended configuration file from the location provided&nbsp;by the GUI Install Wizard just&nbsp;prior to commencing the install,&nbsp;into that directory. This will also simplify the creation of my 2nd server later on when configuring AlwaysOn.<br />So from the command prompt,&nbsp;run the following command to perform the install:<br /><br /><em><strong>D:\setup.exe /Action=Install /Q /ConfigurationFile=[PathToUnattendedFile]</strong></em><br /><br />e.g. <em><strong>D:\setup.exe /Action=Install /Q /ConfigurationFile=C:\SQLInstall\ConfigurationFile.ini</strong></em></li>
<li>When the process completes, verify both from the command prompt output as well as from the log file <em>C:\Program Files\Microsoft Sql Server\110\Setup Bootstrap\Log\Summary.txt</em> that the process was performed successfully. To open the log file run the following from the command prompt:<br /><em><strong>notepad.exe C:\Program Files\Microsoft Sql Server\110\Setup Bootstrap\Log\Summary.txt</strong></em></li>
</ol>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><span style="text-decoration: underline;"><strong>Step&nbsp;2 -&nbsp;Post SQL Install Configuration (SQL2012-01)</strong></span></p>
<p>In this step we need to configure the additional settings like memory, TCP ports, etc, but more importantly this shows how to remotely manage&nbsp;your&nbsp;SQL Install.</p>
<ol>
<li>Connect to the Remote Management Server (SQL2012-MGMT) using either your Hyper-V Console or RDP.</li>
<li>You may be tempted to immediately open the SQL Server Configuration Manager however the tool only connects to the local server by default. To connect to a remote server you must first open the <em><strong>Server Manager</strong></em> tool, locate the SQL Server (SQL2012-01), right click this server and then select <em><strong>Computer Management</strong></em> from the&nbsp;menu, this process is explained in more detail in Part 1 of this series.<br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/1663.006.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/1663.006.png"><img alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/1663.006.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/350x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/1663.006.png" border="0" /></a><br /><br />TIP: If the Server Manager console is closed simply open the new Start Menu and start typing "Server M", the new Start Screen in Windows Server 2012 will automatically start searching for applications that match the text you type and the Server Manager application should be displayed in the results.<br /><br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/7838.008.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/7838.008.png"><img width="350" style="border: 0px currentColor;" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/7838.008.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/7838.008.png" /></a></li>
<li>From the <em><strong>Computer Management</strong></em> console, expand <em><strong>Services and Applications</strong></em>, and <em><strong>SQL Server Configuration Manager<br /></strong></em></li>
<li>The use of the configuration manager is the same as if you were on a local machine. <br /><em>TIP: If you receive a connectivity error here (e.g. The RPC Server is unavailable. [0x800706ba]) you need to check your Firewall settings on both the SQL Server and the Remote Management Server. See Part 1 for these settings.</em><br /><br />The things I configure here are :</li>
<ol>
<li>TCP/IP ports (because I do not like using the default port of 1433 as it is typically the target of attackers)</li>
<li>Client Aliases (because I don't like to remember or tell people what port I am using, remember to set these up on the RMS server as well)</li>
</ol>
<li>Open the SQL Server Configuration Manager locally on the RMS server from the new Start Screen, and configure any Client Aliases as required.<br />TIP: ensure you configure both 32-bit and 64-bit aliases to ensure that all applications can locate the server instances</li>
<li>If you have changed the TCP/IP port that SQL uses make sure you create the appropriate firewall rule by running a command such as the following back on the console of the SQL Server (e.g. SQL2012-01).<br /><em><strong>netsh advfirewall firewall add rule name="SQL TCP In" dir=in protocol=tcp localport=#### action=allow</strong></em></li>
<li>Next, open <em><strong>SQL Management Studio</strong></em> from the new Start Screen and connect to the SQL Server (e.g. SQL2012-01)</li>
<li>From a <em><strong>New Query</strong></em> window run the following command to set the max server memory as appropriate for your server. When setting this value make sure you allow memory for the OS and any other applications you are running on the server (including any other SQL applications such as SSIS)<br /><em><strong>EXEC sp_configure 'show advanced options', 1;</strong></em><br /><em><strong>GO</strong></em><br /><em><strong>RECONFIGURE</strong></em><br /><em><strong>GO</strong></em><br /><em><strong>EXEC sp_configure 'max server memory (MB), ###;</strong></em><br /><em><strong>GO</strong></em><br /><em><strong>RECONFIGURE</strong></em><br /><em><strong>GO<br /><br /></strong></em>In my case I have run the following script as it preconfigures a number of the settings I like to set:<br /><em>EXEC sp_configure 'show advanced options', 1;</em><br /><em>GO</em><br /><em>RECONFIGURE</em><br /><em>GO</em><br /><em>--Set the allowed memory</em><br /><em>EXEC sp_configure 'max server memory (MB), 900;</em><br /><em>GO</em><br /><em>--Enable backup compression</em><br /><em>EXEC sp_configure 'backup compression default', 1;</em><br /><em>GO</em><br /><em>--Set the Index Fill Factor %</em><br /><em>EXEC sp_configure 'fill factor (%)', 90;</em><br /><em>GO</em><br /><em>--Set the default backup media retention</em><br /><em>EXEC sp_configure 'media retention', 2;</em><br /><em>GO</em><br /><em>RECONFIGURE</em><br /><em>GO</em></li>
</ol>
<p>&nbsp;</p>
<p><span style="text-decoration: underline;"><strong>Step&nbsp;3 -&nbsp;Testing and Provisioning</strong></span></p>
<p>Now that your SQL Installation is complete and you have performed your initial configuration steps, the next steps are.</p>
<ol>
<li>Run tests against the environment to check connectivity</li>
<li>Capture a performance baseline</li>
<li>Configure and test&nbsp;your backup and maintenance tasks</li>
<li>Provision databases and users</li>
</ol>
<p>Of cause this is best practise, in my Lab environment I am going to assume I know what I am doing (famous last words!)</p>
<p>&nbsp;</p>
<p><span style="text-decoration: underline;"><strong>What's Next</strong></span></p>
<p>Congratulations your SQL Server 2012 Core install on Windows Server 2012 Core is now complete.</p>
<p>In the follow up blog&nbsp;to this series we will start to configure the AlwaysOn high availability feature.</p>
<p>&nbsp;</p>
<p>&nbsp;<br /><br /></p>]]></content:encoded>
    </item>
    <item>
      <title>SQL 2012 Core on Windows Server 2012 (Part 1 - OS Install and Environment Setup)</title>
      <link>https://docs.microsoft.com/archive/blogs/mlavery/sql-2012-core-on-windows-server-2012-part-1-os-install-and-environment-setup</link>
      <pubDate>Wed, 05 Sep 2012 00:54:00 GMT</pubDate>
      <dc:creator><![CDATA[MatticusAu]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/mlavery/2012/09/05/sql-2012-core-on-windows-server-2012-part-1-os-install-and-environment-setup/</guid>
      <description><![CDATA[With the release of Windows Server 2012 I thought I would take the opportunity to look at running...]]></description>
      <content:encoded><![CDATA[<p>With the release of Windows Server 2012 I thought I would take the opportunity to look at running SQL 2012 Core on Windows Server 2012. This blog will be part of a series which will initially look at the configuration of installing SQL 2012 Core on Windows Server Core, and then finish with adding AlwaysOn functionality to the environment.</p>
<p>For this blog series the following servers&nbsp;are being used within the environment:</p>
<p style="padding-left: 30px;"><span style="text-decoration: underline;"><em><strong>DC</strong></em></span><br />Purpose: Domain Controller<br />OS: Windows Server 2012 Standard with GUI<br />RAM: 512Mb<br />Storage: 30Gb<br />IP: 10.x.x.2</p>
<p style="padding-left: 30px;"><span style="text-decoration: underline;"><em><strong>SQL2012-01</strong></em></span><br />Purpose: SQL Server<br />OS: Windows Server 2012 Standard Core<br />RAM: 1024Mb<br />Storage: 30Gb, 5Gb, 5Gb, 5Gb, 2Gb<br />IP: 10.x.x.4</p>
<p style="padding-left: 30px;"><span style="text-decoration: underline;"><em><strong>SQL2012-MGMT</strong></em></span><br />Purpose: Remote Management Server<br />OS: Windows Server 2012 Standard Core<br />RAM: 512Mb<br />Storage: 30Gb<br />IP: 10.x.x.3</p>
<p>&nbsp;</p>
<p><span style="color: #ff0000;"><strong>IMPORTANT</strong></span>: It is important to highlight that there are particular requirements for installing SQL Server on Windows 2012 and those are available at <a href="http://support.microsoft.com/kb/2681562/EN-US">http://support.microsoft.com/kb/2681562/EN-US</a>. For SQL 2012&nbsp;the RTM release is supported on Windows 2012 however you should always refer to the official MSDN documentation to verify your hardware and software requirements (for SQL 2012 see&nbsp;<a href="http://msdn.microsoft.com/en-us/library/ms143506.aspx">http://msdn.microsoft.com/en-us/library/ms143506.aspx</a>). It is also important to&nbsp;note that&nbsp;this work is out of pure interest within an isolated&nbsp;LAB environment and does not represent any official supportability of this configuration, it is based on my experience when configuring the environment and you should verify the suitability and supportability of such configuration within your own environment.</p>
<p>&nbsp;</p>
<p><span style="text-decoration: underline;"><strong>Step 1 -&nbsp;Build the&nbsp;Remote Management Server&nbsp;(SQL2012-MGMT)</strong></span></p>
<p>For the purpose of this blog I will be skimming the obvious steps&nbsp;but from a high level here is how I prepared the&nbsp;server:</p>
<ol>
<li>Create the VM with appropriate storage</li>
<li>Install the OS, you need to select the option <strong><em>Server with a GUI</em></strong> during the install (e.g. <em>Windows Server 2012 Standard (Server with a GUI)</em>).<br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/4760.001.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/4760.001.png"><img alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/4760.001.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/4760.001.png" border="0" /></a></li>
<li>Configure the Computer Name, Time Zone, Region, Network, Domain, RDP, etc.... and make sure your domain user account has adequate permissions to access the server</li>
<li>Make sure that the .Net feature has been enabled on the server.</li>
<ol>
<li>To simplify this ensure that the Windows Server 2012 media is inserted/mounted to the server's CD/DVD drive</li>
<li>Using powershell run the following command to install the .Net 3.5 feature using the source from the Windows Server 2012 install media as the install package is no longer copied to the sources folder within the Windows installation.<br /> <strong><em>Install-WindowsFeature -Name NET-Framework-Core -Source D:\sources\sxs</em></strong></li>
</ol>
<li>Install the SQL features required for a client machine to allow connectivity to a remote server (e.g. SQL Server Data Tools, Client Tools Connectivity, Integration Services, Documentation Components, Management Tools - Complete)<br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/1385.002.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/1385.002.png"><img alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/1385.002.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/1385.002.png" border="0" /></a></li>
</ol>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><span style="text-decoration: underline;"><strong>Step&nbsp;2 -&nbsp;Create the SQL Server with Windows Server 2012 Core</strong></span></p>
<p>&nbsp;</p>
<ol>
<li>Create the VM with appropriate storage</li>
<li>Install the OS, you do need to select the option <strong><em>Server Core Installation </em></strong>during the install (e.g. <em>Windows Server 2012 Standard (Server Core Installation)</em>).<br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/0250.001.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/0250.001.png"><img alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/0250.001.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/0250.001.png" border="0" /></a></li>
<li>Once the Windows install completes, log into the system and the console should be displayed with just a Command Prompt</li>
<li>Type <em><strong>sconfig</strong></em> to open the Server Configuration tool<br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/6082.002.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/6082.002.png"><img alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/6082.002.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/6082.002.png" border="0" /></a></li>
<li>From the Server Configuration tool you can manage most of the common properties of a server. <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/4834.003.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/4834.003.png"><img alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/4834.003.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/4834.003.png" border="0" /></a><br /><br />For those not familiar with the tool, it works by entering the numerical value of the property / setting you wish to change or perform. My suggested order of adjustment for a new machine is the following:</li>
<ol>
<li>Type "2" and enter the Computer Name of the server. When prompted Reboot the server and after re-authentication open the sconfig tool again.</li>
<li>Verify that "Configure Remote Management" is Enabled, if not then type "4" to display the Configure Remote Management sub menu (see next screen), from this menu type "1" to Enable Remote Management.<br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/7043.004.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/7043.004.png"><img alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/7043.004.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/7043.004.png" border="0" /></a></li>
<li>If "Remote Desktop" is currently configured as "disabled" then type "7".</li>
<li>When prompted type "e" for (E)nable.<br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/3250.005.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/3250.005.png"><img alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/3250.005.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/3250.005.png" border="0" /></a></li>
<li>Ensure that the notification prompt reports Remote Desktop was enabled successfully<br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/5482.006.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/5482.006.png"><img alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/5482.006.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/5482.006.png" border="0" /></a></li>
<li>The main menu will be displayed again, Type "8" to configure the Network Settings.</li>
<li>The network adapters in the Server will be displayed. Type the Index# of the adapter you need to configure (in my example my Index# is 10).<br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/2161.007.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/2161.007.png"><img alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/2161.007.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/2161.007.png" border="0" /></a></li>
<li>The various network configuration options will be displayed. <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/4251.008.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/4251.008.png"><img alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/4251.008.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/4251.008.png" border="0" /></a></li>
<li>Type "1" to configure the IP address of the network adapter as required (e.g. Type "S" for static, enter the IP address, subnet mask, and gateway).<br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/3872.009.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/3872.009.png"><img alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/3872.009.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/3872.009.png" border="0" /></a></li>
<li>The network settings will be displayed on the screen again. Type "2" to enter the DNS server details. When prompted enter the Primary DNS and Secondary DNS servers.<br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/4331.010.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/4331.010.png"><img alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/4331.010.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/4331.010.png" border="0" /></a></li>
<li>Type "4" to return to the main menu.</li>
<li>Type "9" to configure the Date and Time. The normal GUI for Date Time configuration will be displayed, configure the Time Zone and Date/Time as needed.</li>
<li>Finally type "1" to set the Domain/Workgroup of the server.<br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/5141.011.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/5141.011.png"><img alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/5141.011.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/5141.011.png" border="0" /></a></li>
<li>When prompted if you wish to change the Computer Name select "No" unless you did not set the computer name earlier in this process.</li>
<li>Reboot the server when prompted.</li>
</ol>
<li>The next step I like to perform is verify that the regional settings are correctly set, for a Server Core install this can be done from the Command Prompt (if you are still in the Server Configuration, sconfig, tool then use option 15 to exit to the command prompt)</li>
<ol>
<li>At the command prompt type <em><strong>control intl.Cpl</strong></em></li>
<li>The usual GUI configuration window will be displayed to allow configuration of the regional settings</li>
</ol></ol>
<p>&nbsp;</p>
<p><span style="text-decoration: underline;"><strong>Step&nbsp;3 -&nbsp;Configure the Firewall between the SQL Server and Management Server</strong></span></p>
<p>Before being able to remotely manage the Windows Server 2012 Core install we need to configure the firewall on both the SQL Server and also the Remote Management Server.</p>
<ol>
<li>On the Windows Server 2012 Core machine (e.g. SQL2012-01), open the&nbsp;<em><strong>C</strong><strong>ommand Prompt </strong></em>and run the following:<br /><br /><em>Netsh advfirewall firewall set rule group=&ldquo;Remote Event Log Management&rdquo; new enable=yes</em><br /><em>Netsh advfirewall firewall set rule group=&ldquo;Remote Volume Management&rdquo; new enable=yes</em><br /><em>Netsh advfirewall firewall set rule group=&ldquo;Remote Service Management&rdquo; new enable=yes</em><br /><em>Netsh advfirewall firewall set rule group=&ldquo;Windows Firewall Remote Management&rdquo; new enable=yes<br /></em><em>Netsh advfirewall firewall set rule group=&ldquo;Remote Desktop&rdquo; new enable=yes<br /></em><em><em>Netsh advfirewall firewall set rule group=&ldquo;Windows Management Instrumentation (WMI)&rdquo; new enable=yes</em></em><br /><br />The Firewall rule above allows you to then manage the firewall remotely, should any restrictions on these rules or any others be required for your environment.<br />The WMI rule is required to allow the SQL Server Configuration Manager connectivity.</li>
<li>On the Remote Management Server running Windows Server 2012 with GUI (e.g. SQL2012-MGMT), open the <em><strong>Command Prompt as Administrator</strong></em>. Run the following commands to add the required rules for 2-way communication.<br /><br /><em><em>Netsh advfirewall firewall set rule group=&ldquo;Remote Volume Management&rdquo; new enable=yes<br /><em><em>Netsh advfirewall firewall set rule group=&ldquo;Windows Management Instrumentation (WMI)&rdquo; new enable=yes</em></em><br /></em></em></li>
</ol>
<p>NOTE: This will not allow access to Device Manager, as you can only allow&nbsp;a Read-Only view I am not going to turn that on in my lab. However if you require something like that in your environment then check out some of the other blogs which explain what Local Security Policy setting needs to be changed such as Brad Rutkowski's blog post <a href="http://blogs.technet.com/b/brad_rutkowski/archive/2007/10/22/unable-to-remotely-manage-a-server-core-machine-mmc-wmi-device-manager.aspx">http://blogs.technet.com/b/brad_rutkowski/archive/2007/10/22/unable-to-remotely-manage-a-server-core-machine-mmc-wmi-device-manager.aspx</a>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><span style="text-decoration: underline;"><strong>Step&nbsp;3 -&nbsp;Remote management of Windows Server 2012 Core</strong></span></p>
<p>Now that the server is installed you still need to configure aspects like Storage and to do this it will involve remotely managing the server from the Management Server. This is where some of the new features in Windows 2012 really make this easier.</p>
<p><em>TIP: I recommended that you use a server with either&nbsp;Windows Server 2012 or Windows 8 OS for your Remote Management Server as the Server Manager console has been upgraded in the Windows Server 2012 release and therefore you cannot manage a Windows Server 2012 Core install from Windows 7 using Server Manager. However you can still use individual&nbsp;snap-ins via the mmc console. This is why within my environment I am using a server running the Windows Server 2012 OS as the Remote Management Server.</em></p>
<ol>
<li>Using RDP, log onto the RMS (Remote Management Server), in my case it is SQL2012-MGMT.</li>
<li>Open Server Manager and right-click <em><strong>All Servers</strong></em> from the left-hand menu. Select <em><strong>Add Server</strong></em> from the context menu.<br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/4113.004.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/4113.004.png"><img alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/4113.004.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/4113.004.png" border="0" /></a></li>
<li>Using the Active Directory search locate the server you wish to manage (in my case SQL2012-01) and add it to the list of selected servers via the center arrow.<br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/2570.005.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/2570.005.png"><img alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/2570.005.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/2570.005.png" border="0" /></a></li>
<li>Click <em><strong>OK</strong></em></li>
<li>The server will now be listed in the list of servers. Initially the status of "In Progress" will be displayed as the Server Manager attempts to connect to the server. If the status reports "<em><strong>Access Denied</strong></em>" then right click the server and select <em><strong>Manage As</strong></em> and supply the required credentials for an account with administrative access to the server.</li>
<li>Right-click the server and select <em><strong>Computer Management</strong></em> to launch the remote management.<br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/4544.006.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/4544.006.png"><img alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/4544.006.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/4544.006.png" border="0" /></a></li>
<li>From the Computer Management console you can now adjust certain properties such as Local Users / Groups, Disk Management, or Services as well as view administrative properties such as Event Log.</li>
<li>For the purpose of this LAB environment I added myself to Local Administrators group. This also allows me to remotely manage the server from Server Manager without specifying a separate account as in the step above.</li>
</ol>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><span style="text-decoration: underline;"><strong>Step&nbsp;4 - (Option A) -&nbsp;Disk Configuration (via Command Line on Server Core)</strong></span></p>
<p>Now that the server is installed you still need to configure aspects like Storage, there are two methods which you can use to achieve this. My preference is through the DiskPart Command-Line tool via the console of the Server Core install, however you can also use the GUI via the Remote Management Server (those instructions are below) and this is where some of the new features in Windows 2012 really make remote management easier.</p>
<ol>
<li>Connect to the console of the server core SQL Server (SQL2012-01).</li>
<li>If automatically logged into the sconfig tool, select the appropriate option to exit to the Command Prompt (e.g. option 15).</li>
<li>From the Command Prompt type <em><strong>diskpart</strong></em> and &lt;ENTER&gt; to launch the command-line tool</li>
<li>Type the following command and verify that the appropriate disks are displayed:<br /><em><strong>list disk</strong></em><br /><br />In my example I expect to see 5 disks, remember the numerical identifier for these disks will start at zero.<br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/3757.014.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/3757.014.png"></a><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/4377.014.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/4377.014.png"><img alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/4377.014.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/250x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/4377.014.png" border="0" /></a></li>
<li>The following steps will need to be performed for each disk as required.</li>
<ol>
<li>Select the required disk you wish to create the partition on with the following where # is the numerical identifier from the list created by the above<br /><em><strong>Select Disk #</strong></em></li>
<li>If the disk was listed as Offline in the results of the List Disk command above, then run the following to bring it online<br /><em><strong>Online Disk</strong></em></li>
<li>Run the following command to check the attributes of the disk.<br /><em><strong>Detail Disk</strong></em></li>
<li>If the disk's attributes reports the <em><strong>Current Read-only State</strong></em> as "Yes" then run the following to set it to Read-Write<br /><em><strong>attributes disk clear readonly</strong></em></li>
<li>Check for any existing partitions on the disk with the following command<br /><em><strong>list partition</strong></em><br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/7167.015.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/7167.015.png"><img width="250" style="border: 0px currentColor;" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/7167.015.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/7167.015.png" /></a><br /><br />In my case I am working with Basic disks as these are on a VM and no need for dynamic functionality however if you require dynamic disks then use the Convert command and the Create Volume command in replacement for the following steps.</li>
<li>Make sure the disk is cleaned before creating a partition so run<br /><em><strong>Clean</strong></em></li>
<li>Use the following command to create a partition on the disk using all the available space:<br /><em><strong>create partition primary</strong></em></li>
<li>Mark the current partition as active so that we can manage it by running the command:<br /><em><strong>active</strong></em></li>
<li>Now we need to format the partition with the ntfs file system, where the label is appropriate for the disk you are creating.<br /><em><strong>format fs=ntfs label="#####" quick</strong></em></li>
<li>Next assign a drive letter to the partition as appropriate for the disk you have created<br /><em><strong>assign letter=#<br /></strong></em><br /><em><strong><br /></strong></em>The following is the output of my screen after executing these commands:<br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/4188.016.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/4188.016.png"><img alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/4188.016.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/4188.016.png" border="0" /></a></li>
</ol>
<li>Repeat the steps until all the disks are created as needed. In my example the following are the disks I created:<br />E:&gt; SQLData<br />F:&gt; SQLLog<br />G:&gt; SQLTempDB<br />H:&gt; SQLBackup</li>
<li>Finally execute <em><strong>list volume </strong></em>and verify that all partitions are now created as required</li>
</ol>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><span style="text-decoration: underline;"><strong>Step&nbsp;4 - (Option B) -&nbsp;Disk Configuration (via GUI on Remote Management Server)</strong></span></p>
<p>Now that the server is installed you still need to configure aspects like Storage and to do this it will involve remotely managing the server from the Management Server. This is where some of the new features in Windows 2012 really make this easier.</p>
<ol>
<li>Follow the steps above to connect to the server (SQL2012-01) from the Remote Management Server (SQL2012-MGMT) using Computer Manager.</li>
<li>Select <em><strong>Disk Management</strong></em>. As this is a SQL Server there are a number of disks / partitions to configure, and the following are the steps which I have taken</li>
<ol>
<li>Right click any disk that is reported as Offline and select <em><strong>Online</strong></em> to bring the disk online. <br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/6837.012.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/6837.012.png"><img alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/6837.012.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/6837.012.png" border="0" /></a></li>
<li>Close and reopen Computer Manager&nbsp;to force a refresh of meta data.<br /><br />NOTE: I found that&nbsp;the meta data does not refresh as you would expect when making changes and&nbsp;the only way to view all the changes was to close and reopen the Computer Management console. For example after bringing the Disk Online it would not&nbsp;be represented&nbsp;as Online and therefore you cannot continue until closing and reopening the Computer Management console.&nbsp;</li>
<li>When prompted use the <em><strong>Initialise Disk</strong></em> wizard, I used the MBR partition style</li>
<li>Again close and reopen Computer Manager if needed to refresh the data</li>
<li>Right click on the first unallocated disk and select <em><strong>New Simple Volume</strong></em>.<br /><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/1526.013.png" original-url="http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/1526.013.png"><img alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/55/18/1526.013.png" original-url="http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-55-18/1526.013.png" border="0" /></a></li>
<li>Follow the wizard to create the partition with appropriate drive letter and label using the NTFS file system and quick format method.</li>
<li>Repeat for all unallocated disks. For my environment I created the following partitions:<br />E:&gt; SQLData<br />F:&gt; SQLLog<br />G:&gt; SQLTempDB<br />H:&gt; SQLBackup</li>
</ol></ol>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><span style="text-decoration: underline;"><strong>What's next?</strong></span></p>
<p>At this point the&nbsp;Remote Management Server (SQL2012-MGMT) and SQL Server (SQL2012-01) are now configured enough where the SQL install can be commenced. This will be covered in Part 2 of this series.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
  </channel>
</rss>