<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>SQLPFE.IL</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/sqlpfeil/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/sqlpfeil/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:48:08 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>SQL Protocol How to secure and disable unnecessary protocol with a Power Shell script</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlpfeil/sql-protocol-how-to-secure-and-disable-unnecessary-protocol-with-a-power-shell-script</link>
      <pubDate>Tue, 27 May 2014 11:14:21 GMT</pubDate>
      <dc:creator><![CDATA[Oren Bouni]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sqlpfeil/2014/05/27/sql-protocol-how-to-secure-and-disable-unnecessary-protocol-with-a-power-shell-script/</guid>
      <description><![CDATA[As part of a project at one of my customers I was asked to create an automatic installation that...]]></description>
      <content:encoded><![CDATA[<p> <h3></h3> <h3>As part of a project at one of my customers I was asked to create an automatic installation that will be a secure installation and will use an Alias, disable unnecessary protocols and use a fix port number instead of dynamic. </h3> <h3>In my last post I shared with you all a Power Shell script that helped us to create SQL Alias automatically as part of an automatic installation. </h3> <h3>This time I&#39;d like to share how this can be done as a part of securing a SQL server and disable unnecessary protocols like Named Pipe, VIA, Shared Memory and setting the port number to a fixed port. </h3> <h3><b><u>First part</u></b> the property declaration, in this part we will choose the instance name, port number, connection string and which protocol to disable. </h3> <h3><b><u>Second Part</u></b> SMO declaration and the manage SMO object </h3> <h3><b><u>Third part</u></b> is the protocol reference </h3> <h3><b><u>Forth part</u></b> is the port part where we are fixing the port </h3> <h3>----------------- </h3> <div id="codeSnippetWrapper"> <div id="codeSnippet" style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;"><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;"><span style="color:#008000;"># propertyies declarations</span></pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;"><span style="color:#cc6633;">$</span>computerName=&quot;<span style="color:#ff0000;">.</span>&quot;</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;"><span style="color:#cc6633;">$</span>instance=&quot;(local)&quot;</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;"><span style="color:#cc6633;">$</span>tcpPort=&#39;1434&#39;</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;"><span style="color:#cc6633;">$</span>ProtocolUri=&quot;ManagedComputer[@Name=&#39;<span style="color:#cc6633;">$</span>env:computername&#39;]/ServerInstance[@Name=&#39;MSSQLSERVER&#39;]/ServerProtocol&quot;</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;"><span style="color:#cc6633;">$</span>tcpEnabled=<span style="color:#cc6633;">$</span>true</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;"><span style="color:#cc6633;">$</span>npEnabled=<span style="color:#cc6633;">$</span>false</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;"><span style="color:#cc6633;">$</span>smEnabled=<span style="color:#cc6633;">$</span>true</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;">&nbsp;</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;">&nbsp;</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;"><span style="color:#008000;"># load the sqlsmo assemblies</span></pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;"><span style="color:#008000;"># $null = suppress output of assembly loading</span></pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;"><span style="color:#cc6633;">$</span>null=[reflection<span style="color:#ff0000;">.</span>assembly]::LoadWithPartialName(&#39;Microsoft<span style="color:#ff0000;">.</span>SqlServer<span style="color:#ff0000;">.</span>Smo&#39;)</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;"><span style="color:#cc6633;">$</span>null=[reflection<span style="color:#ff0000;">.</span>assembly]::LoadWithPartialName(&#39;Microsoft<span style="color:#ff0000;">.</span>SqlServer<span style="color:#ff0000;">.</span>SQLWMIManagement&#39;)</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;">&nbsp;</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;"><span style="color:#008000;"># create a managed computer smo object</span></pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;"><span style="color:#cc6633;">$</span>ManagedComputer=New-ObjectMicrosoft<span style="color:#ff0000;">.</span>SqlServer<span style="color:#ff0000;">.</span>Management<span style="color:#ff0000;">.</span>Smo<span style="color:#ff0000;">.</span>WMI<span style="color:#ff0000;">.</span>ManagedComputer<span style="color:#cc6633;">$</span>computerName</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;">&nbsp;</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;"><span style="color:#008000;"># get refernce to server protocols</span></pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;"><span style="color:#cc6633;">$</span>tcp=<span style="color:#cc6633;">$</span>ManagedComputer<span style="color:#ff0000;">.</span>GetSmoObject(&quot;<span style="color:#cc6633;">$</span>ProtocolUri[@Name=&#39;Tcp&#39;]&quot;)</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;"><span style="color:#cc6633;">$</span>np=<span style="color:#cc6633;">$</span>ManagedComputer<span style="color:#ff0000;">.</span>GetSmoObject(&quot;<span style="color:#cc6633;">$</span>ProtocolUri[@Name=&#39;Np&#39;]&quot;)</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;"><span style="color:#cc6633;">$</span>sm=<span style="color:#cc6633;">$</span>ManagedComputer<span style="color:#ff0000;">.</span>GetSmoObject(&quot;<span style="color:#cc6633;">$</span>ProtocolUri[@Name=&#39;Sm&#39;]&quot;)</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;">&nbsp;</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;"><span style="color:#008000;"># enable or disbale protocol</span></pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;"><span style="color:#cc6633;">$</span>tcp<span style="color:#ff0000;">.</span>IsEnabled=<span style="color:#cc6633;">$</span>tcpEnabled</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;"><span style="color:#cc6633;">$</span>tcp<span style="color:#ff0000;">.</span>Alter()</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;">&nbsp;</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;"><span style="color:#cc6633;">$</span>np<span style="color:#ff0000;">.</span>IsEnabled=<span style="color:#cc6633;">$</span>npEnabled</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;"><span style="color:#cc6633;">$</span>np<span style="color:#ff0000;">.</span>Alter()</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;">&nbsp;</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;"><span style="color:#cc6633;">$</span>sm<span style="color:#ff0000;">.</span>IsEnabled=<span style="color:#cc6633;">$</span>smEnabled</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;"><span style="color:#cc6633;">$</span>sm<span style="color:#ff0000;">.</span>Alter()</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;">&nbsp;</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;">&nbsp;</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;">&nbsp;</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;"><span style="color:#008000;"># determine if the instance is default or named</span></pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;"><span style="color:#cc6633;">$</span>smoTcp=if(&#39;<span style="color:#ff0000;">.</span>&#39;,&#39;(local)&#39;-contains<span style="color:#cc6633;">$</span>instance) </pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;">{</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;"><span style="color:#008000;"># Default database instance</span></pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;"><span style="color:#cc6633;">$</span>smoComputer<span style="color:#ff0000;">.</span>ServerInstances[&#39;MSSQLSERVER&#39;]<span style="color:#ff0000;">.</span>ServerProtocols[&#39;Tcp&#39;]</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;">} </pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;">else</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;">{ </pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;"><span style="color:#008000;"># Named database instance</span></pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;"><span style="color:#cc6633;">$</span>smoComputer<span style="color:#ff0000;">.</span>ServerInstances[<span style="color:#cc6633;">$</span>instance]<span style="color:#ff0000;">.</span>ServerProtocols[&#39;Tcp&#39;]</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;">}</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;">&nbsp;</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;">&nbsp;</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;"><span style="color:#008000;"># assign new port number to tcp protocol $tcpPort is the instance port declared at the top of this script</span></pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;"><span style="color:#cc6633;">$</span>smoTcp<span style="color:#ff0000;">.</span>IPAddresses[&#39;IPAll&#39;]<span style="color:#ff0000;">.</span>IPAddressProperties[&#39;TcpPort&#39;]<span style="color:#ff0000;">.</span>Value =<span style="color:#cc6633;">$</span>tcpPort</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;"><span style="color:#cc6633;">$</span>smoTcp<span style="color:#ff0000;">.</span>Alter()</pre><!--CRLF--></div></div>
<p></p>
<h3>We can perform lots of tweaks and tricks on SQL Server, using the Power Shell script. Use it if you need to secure servers.</h3></p>]]></content:encoded>
    </item>
    <item>
      <title>SQL Alias PowerShell script</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlpfeil/sql-alias-powershell-script</link>
      <pubDate>Mon, 31 Mar 2014 13:15:00 GMT</pubDate>
      <dc:creator><![CDATA[Oren Bouni]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sqlpfeil/2014/03/31/sql-alias-powershell-script/</guid>
      <description><![CDATA[Hello everyone, this time I am going to show the &quot;Server Alias&quot;.   I have been asked by...]]></description>
      <content:encoded><![CDATA[<p><b>Hello everyone, this time I am going to show the &quot;Server Alias&quot;.</b>  <p><b></b> <p><b>I have been asked by one of my customers to write down a PowerShell script to add an SQL Alias as part of an automatic installation.</b>  <p><b>The Alias is stored in the registry at this path:</b><b><br /></b><b>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo</b>  <p><b>The alias is configured via the configuration manager.</b>  <p><b>An alias is a name that can be used instead of a connection. </b> <p><b>It holds inside some elements of the connection string and can be used from each and every client application. One of its advantages is that it contains all the connection details - protocol, ports and named pipes. It even allows you to redirect a connection to a remote server.</b>  <p><b>Here is the script:</b>  <div id="codeSnippetWrapper"> <div id="codeSnippet" style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;"><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;"><span style="color:#008000;">## Setting the Alias name, Server name and setting the port number</span></pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;"><span style="color:#008000;">## Adding an extension to the alias name _ALDB Customer Request </span></pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;"><span style="color:#cc6633;">$</span>ServerName = Get-Content Env:Computername</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;"><span style="color:#cc6633;">$</span>AliasName = <span style="color:#cc6633;">$</span>ServerName+&quot;_ALDB&quot; </pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;"><span style="color:#cc6633;">$</span>SN</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;"><span style="color:#cc6633;">$</span>AliasName</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;"><span style="color:#cc6633;">$</span>PortNum = 1111</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;">&nbsp;</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;"><span style="color:#008000;">## The Aliase is stord in the registry here i&#39;m seting the </span></pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;"><span style="color:#008000;">## REG path for the Alias 32 &amp; 64</span></pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;"><span style="color:#cc6633;">$</span>Bit32 = &quot;HKLM:<span style="color:#ff0000;">\S</span>OFTWARE\Microsoft\MSSQLServer\Client\ConnectTo&quot;</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;"><span style="color:#cc6633;">$</span>bit64 = &quot;HKLM:<span style="color:#ff0000;">\S</span>OFTWARE<span style="color:#ff0000;">\W</span>ow6432Node\Microsoft\MSSQLServer\Client\ConnectTo&quot;</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;">&nbsp;</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;"><span style="color:#008000;">## chect if the ConnectTo SubFolder </span></pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;"><span style="color:#008000;">## exist in the registry if not it will create it.</span></pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;">If((Test-Path -Path <span style="color:#cc6633;">$</span>Bit32)-ne <span style="color:#cc6633;">$</span>true)</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;">    {<span style="color:#cc6633;">$</span>writable = <span style="color:#cc6633;">$</span>true</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;">        <span style="color:#cc6633;">$</span>key = (get-item HKLM:\)<span style="color:#ff0000;">.</span>OpenSubKey(&quot;SOFTWARE\Microsoft\MSSQLServer\Client&quot;, <span style="color:#cc6633;">$</span>writable)<span style="color:#ff0000;">.</span>CreateSubKey(&quot;ConnectTo&quot;)</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;">    }</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;">    If((Test-Path -Path <span style="color:#cc6633;">$</span>Bit64)-ne <span style="color:#cc6633;">$</span>true)</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;">    {        <span style="color:#cc6633;">$</span>key = (get-item HKLM:\)<span style="color:#ff0000;">.</span>OpenSubKey(&quot;SOFTWARE<span style="color:#ff0000;">\W</span>ow6432Node\Microsoft\MSSQLServer\Client&quot;, <span style="color:#cc6633;">$</span>writable)<span style="color:#ff0000;">.</span>CreateSubKey(&quot;ConnectTo&quot;)</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;">&nbsp;</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;">    }</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;">&nbsp;</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;"><span style="color:#008000;">## Create the TCPAlias</span></pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;"><span style="color:#cc6633;">$</span>TCPAliasName=&quot;DBMSSCON,&quot;+<span style="color:#cc6633;">$</span>ServerName+&quot;,&quot;+<span style="color:#cc6633;">$</span>PortNum</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:white;">New-ItemProperty -Path <span style="color:#cc6633;">$</span>Bit32 -Name <span style="color:#cc6633;">$</span>AliasName -PropertyType string -Value <span style="color:#cc6633;">$</span>TCPAliasName</pre><!--CRLF--><pre style="border-top-style:none;overflow:visible;font-size:8pt;font-family:&#39;Courier New&#39;, courier, monospace;width:100%;border-bottom-style:none;color:black;padding-bottom:0px;direction:ltr;text-align:left;padding-top:0px;border-right-style:none;padding-left:0px;margin:0em;border-left-style:none;line-height:12pt;padding-right:0px;background-color:#f4f4f4;">New-ItemProperty -Path <span style="color:#cc6633;">$</span>Bit64 -Name <span style="color:#cc6633;">$</span>AliasName -PropertyType string -Value <span style="color:#cc6633;">$</span>TCPAliasName </pre><!--CRLF--></div></div></p></p></p></p></p></p></p></p>]]></content:encoded>
    </item>
    <item>
      <title>Using the proper login account for the correct SQL Service</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlpfeil/using-the-proper-login-account-for-the-correct-sql-service</link>
      <pubDate>Thu, 27 Feb 2014 00:07:24 GMT</pubDate>
      <dc:creator><![CDATA[Oren Bouni]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sqlpfeil/2014/02/27/using-the-proper-login-account-for-the-correct-sql-service/</guid>
      <description><![CDATA[I was often asked this question: I&#39;m installing my SQL Server. What should I use as the...]]></description>
      <content:encoded><![CDATA[<h3></h3> <h2></h2> <h5></h5> <h4></h4> <h3>I was often asked this question:</h3> <h3>I&#39;m installing my SQL Server. What should I use as the service account? </h3> <h3>There are a few options (Local Account, Service Network, domain User)</h3> <h3>What is the best and suitable account for the service? </h3> <h3>I will try to answer that on this blog post.</h3> <h3>It is very important for System Admins (SA) to make sure that SQL Server is highly secured and is not exposed to users or/and application that don’t need access to the SQL Server. </h3> <h3>Configuring the permissions and security settings for SQL Server users and logins is one way to do it, but it is also very important to select the correct service account to run SQL Server services. </h3> <h3><b>Domain Account</b></h3><b> <h3><b></b>If the SQL Service operates along with other servers or resources on the network, or the SQL services/application uses linked servers to connect to other SQL Servers or your SQL server uses Cluster architecture, then you may use a domain user account for the SQL service account. </h3></b> <h3>Domain user account is the recommended account for SQL Server services that interact with other servers on the network. Another reason to use a Domain User Account is that the account is controlled by Windows active directory therefore, domain level policy on accounts are applied to the service account. </h3> <h3>Applying permission to the Domain user account that is running an SQL service are detailed in this link. it is highly recommended to read and know all the needed permissions. </h3> <h3><a href="https://msdn.microsoft.com/en-us/library/ms143504.aspx">https://msdn.microsoft.com/en-us/library/ms143504.aspx</a> </h3> <h3><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/92/43/metablogapi/image_5F284FD7.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-92-43-metablogapi/image_5F00_5F284FD7.png"><img title="image" style="border-left-width:0px;border-right-width:0px;border-bottom-width:0px;display:inline;border-top-width:0px;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/92/43/metablogapi/image_thumb_580BA410.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-92-43-metablogapi/image_5F00_thumb_5F00_580BA410.png" width="217" height="244" /></a> </h3> <h3><b>Network Service Account</b></h3><b> <h3><b></b>The network service account is a built in service that has access to server resources and objects on the local user groups. Any SQL that is running under network service can access network resources with the credential of a computer account, the account is the</h3></b> <h3>NET AUTHORITY\NETWORK SERVICE </h3><b></b> <h3><b><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/92/43/metablogapi/clip_image002_2E2B2FDB.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-92-43-metablogapi/clip_5F00_image002_5F00_2E2B2FDB.png"><img title="clip_image002" style="border-left-width:0px;border-right-width:0px;border-bottom-width:0px;display:inline;border-top-width:0px;" border="0" alt="clip_image002" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/92/43/metablogapi/clip_image002_thumb_06F37757.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-92-43-metablogapi/clip_5F00_image002_5F00_thumb_5F00_06F37757.png" width="216" height="244" /></a></b><b></b></h3><b></b> <h3><b>Local User Account</b></h3><b> <h3><b></b>When your SQL server is not interacting with other server\application\resources on the network then we can use a local user account for running SQL Services. </h3></b> <h3><b><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/92/43/metablogapi/clip_image004_3CF7F664.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-92-43-metablogapi/clip_5F00_image004_5F00_3CF7F664.png"><img title="clip_image004" style="border-left-width:0px;border-right-width:0px;border-bottom-width:0px;display:inline;border-top-width:0px;" border="0" alt="clip_image004" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/92/43/metablogapi/clip_image004_thumb_47B7DE6A.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-92-43-metablogapi/clip_5F00_image004_5F00_thumb_5F00_47B7DE6A.png" width="216" height="244" /></a></b><b></b> </h3><b></b> <h3><b>Local System Account</b></h3><b> <h3><b></b>Local System account has more permissions than you think, it is a very high-privileged built in account that is created by the OS, the Local sys account can act has a computer in the organizational network. Try and minimize the use of the Local System account on the servers by not running services under the Local System account. This ensures that other processes cannot take advantage of the enhanced privileges of the system’s computer account. </h3></b> <h3><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/92/43/metablogapi/clip_image006_32C8ECA8.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-92-43-metablogapi/clip_5F00_image006_5F00_32C8ECA8.png"><img title="clip_image006" style="border-left-width:0px;border-right-width:0px;border-bottom-width:0px;display:inline;border-top-width:0px;" border="0" alt="clip_image006" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/92/43/metablogapi/clip_image006_thumb_325F4A64.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-92-43-metablogapi/clip_5F00_image006_5F00_thumb_5F00_325F4A64.png" width="215" height="244" /></a> </h3> <h3>Try to use the Domain user account wherever is possible for the SQL services (SQL DB Engine, SQL Agent, SSIS, SSRS, SSAS). Use the link above to configure the correct user privileges for the SQL Service. </h3>]]></content:encoded>
    </item>
    <item>
      <title>Sys.Configuration</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlpfeil/sys-configuration</link>
      <pubDate>Tue, 10 Dec 2013 09:12:22 GMT</pubDate>
      <dc:creator><![CDATA[Oren Bouni]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sqlpfeil/2013/12/10/sys-configuration/</guid>
      <description><![CDATA[A while ago, I was asked by customer how to tell if an instance parameter is dynamic or rather...]]></description>
      <content:encoded><![CDATA[<p><font size="3">A while ago, I was asked by customer how to tell if an instance parameter is dynamic or rather static (which requires me to restart the instance service).</font></p>  <p><font size="3">Parameters like<b><u> fill factor (%)</u> </b>or <b><u>max degree of parallelism</u></b>. Does this parameter exist in the short list or do I need the <b><u>show advance option</u></b>?</font></p>  <p><font size="3">So how do we know if the <b><u>fill factor (%)</u></b> require a service restart?</font></p>  <p><font size="3">Well, like everything in SQL we have a SYS table <b><u>sys.configuration</u></b>; that will show us if the parameter is dynamic and if the parameter is an advance setting.</font></p>  <p><font size="3">Running a query on the <b><u>sys.configuration</u></b> will show us the parameters: </font></p>  <div id="codeSnippetWrapper" style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);">   <div id="codeSnippet" style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"><font size="3"></font>      <pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><font size="3"><span id="lnum1" style="color: rgb(96, 96, 96);">   1:</span> <span style="color: rgb(0, 0, 255);">Select</span> * <span style="color: rgb(0, 0, 255);">From</span> Sys.configurations</font></pre>
<!--CRLF--></div>
</div>

<p><font size="3">We can spot the fill factor on this screenshot. </font></p>

<p><font size="3">We can see that in order to modify this parameter, it will require a service restart and we can also see that the parameter is hidden, so we should enable the &quot;Show advanced option&quot;</font></p>

<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/92/43/metablogapi/8132.ConfiguPost3_71364737.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-92-43-metablogapi/8132.ConfiguPost3_5F00_71364737.png"><img title="ConfiguPost3" style="display: inline;" border="0" alt="ConfiguPost3" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/92/43/metablogapi/1220.ConfiguPost3_thumb_4852E441.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-92-43-metablogapi/1220.ConfiguPost3_5F00_thumb_5F00_4852E441.png" width="526" height="387" /></a>&#160;</p>

<p></p>

<p><font size="3">In this table we have the description of the sys.configuration columns.</font></p>

<table cellspacing="0" cellpadding="0" width="529" border="1"><tbody>
    <tr>
      <td valign="top" width="120">
        <p align="center"><font size="2">Column name<b></b></font></p>
      </td>

      <td valign="top" width="110">
        <p align="center"><font size="2">Data type</font></p>
      </td>

      <td valign="top" width="297">
        <p align="center"><font size="2">Description</font></p>
      </td>
    </tr>

    <tr>
      <td valign="top" width="120">
        <p align="center"><strong><font size="2">configuration_id</font></strong></p>
      </td>

      <td valign="top" width="110">
        <p align="center"><font size="2">int</font></p>
      </td>

      <td valign="top" width="297">
        <p align="left"><font size="2">Unique ID for the configuration value.</font></p>
      </td>
    </tr>

    <tr>
      <td valign="top" width="120">
        <p align="center"><font size="2"><strong>name</strong><b></b></font></p>
      </td>

      <td valign="top" width="110">
        <p align="center"><font size="2">nvarchar(35) </font></p>
      </td>

      <td valign="top" width="297">
        <p align="left"><font size="2">Name of the configuration option.</font></p>
      </td>
    </tr>

    <tr>
      <td valign="top" width="120">
        <p align="center"><font size="2"><strong>value</strong><b></b></font></p>
      </td>

      <td valign="top" width="110">
        <p align="center"><font size="2">sql_variant</font></p>
      </td>

      <td valign="top" width="297">
        <p align="left"><font size="2">Configured value for this option.</font></p>
      </td>
    </tr>

    <tr>
      <td valign="top" width="120">
        <p align="center"><font size="2"><strong>minimum</strong><b></b></font></p>
      </td>

      <td valign="top" width="110">
        <p align="center"><font size="2">sql_variant</font></p>
      </td>

      <td valign="top" width="297">
        <p align="left"><font size="2">Minimum value for the configuration option.</font></p>
      </td>
    </tr>

    <tr>
      <td valign="top" width="120">
        <p align="center"><font size="2"><strong>maximum</strong><b></b></font></p>
      </td>

      <td valign="top" width="110">
        <p align="center"><font size="2">sql_variant</font></p>
      </td>

      <td valign="top" width="297">
        <p align="left"><font size="2">Maximum value for the configuration option.</font></p>
      </td>
    </tr>

    <tr>
      <td valign="top" width="120">
        <p align="center"><font size="2"><strong>value_in_use</strong><b></b></font></p>
      </td>

      <td valign="top" width="110">
        <p align="center"><font size="2">sql_variant</font></p>
      </td>

      <td valign="top" width="297">
        <p align="left"><font size="2">Running value currently in effect for this option.</font></p>
      </td>
    </tr>

    <tr>
      <td valign="top" width="120">
        <p align="center"><font size="2"><strong>description</strong><b></b></font></p>
      </td>

      <td valign="top" width="110">
        <p align="center"><font size="2">nvarchar(255) </font></p>
      </td>

      <td valign="top" width="297">
        <p align="left"><font size="2">Description of the configuration option.</font></p>
      </td>
    </tr>

    <tr>
      <td valign="top" width="120">
        <p align="center"><font size="2"><strong>is_dynamic</strong><b></b></font></p>
      </td>

      <td valign="top" width="110">
        <p align="center"><font size="2">bit </font></p>
      </td>

      <td valign="top" width="297">
        <p align="left"><font size="2">1 = The variable that takes effect when the RECONFIGURE statement is executed.</font></p>
      </td>
    </tr>

    <tr>
      <td valign="top" width="120">
        <p align="center"><font size="2"><strong>is_advanced</strong><b></b></font></p>
      </td>

      <td valign="top" width="110">
        <p align="center"><font size="2">bit </font></p>
      </td>

      <td valign="top" width="297">
        <p align="left"><font size="2">1 = The variable is displayed only when the <strong>show advancedoption</strong> is set.</font></p>
      </td>
    </tr>
  </tbody></table>

<p><font size="3">That is a very useful table and can be used every time that we are required to change the configuration of the instance</font></p>]]></content:encoded>
    </item>
    <item>
      <title>LOG PARSER.</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlpfeil/log-parser</link>
      <pubDate>Wed, 30 Oct 2013 08:21:05 GMT</pubDate>
      <dc:creator><![CDATA[Oren Bouni]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sqlpfeil/2013/10/30/log-parser/</guid>
      <description><![CDATA[Hello everyone, today I'd like to write about the LOG PARSER.  First time I have encountered this...]]></description>
      <content:encoded><![CDATA[<p><font size="3">Hello everyone, today I'd like to write about the LOG PARSER.</font></p>  <p><font size="3">First time I have encountered this tool was around 2004 when I had to load a big mass of data (IIS Log) into a database.</font></p>  <p><font size="3">A month ago I was asked by a customer, how can is it possible to read and load into SQL Server flat files / application files. I recommended using the log parser and I was surprised to see that he was not aware of its existence. a fast survey among my customers reviled that there is a rather large group of DBAs that are not aware of this tool.</font></p>  <p><font size="3">Log Parser is a command line tool that allows the user to use SQL in order to query log files.</font></p>  <p><font size="3">This is how it works:</font></p>  <p><font size="3">The logparser command has three parts: INPUT, DATA, OUTPUT.</font></p>  <p><font size="3"><b><u>Input</u></b> – will be the part that supports the file format such as IIS LOG, Windows event logs, CSV, XML, TSV and other file formats.</font></p>  <p><font size="3"><b><u>Data</u></b> – the data is the engine that make it possible to run SQL queries on the input file, much like a database engine.</font></p>  <p><font size="3"><b><u>Output</u></b> – this part supports many types of outputs, you can format the output table into plain text files, SQL databases and XML.</font></p>  <p><font size="3">Opening the logparser starts with a CMD command.</font></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/92/43/metablogapi/4807.image_190B29A1.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-92-43-metablogapi/4807.image_5F00_190B29A1.png"><font color="#333333" size="3"></font></a><font color="#333333" size="3"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/92/43/metablogapi/4380.image_5AA7F69E.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-92-43-metablogapi/4380.image_5F00_5AA7F69E.png"><img title="image" style="display: inline;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/92/43/metablogapi/2043.image_thumb_04AC7EB1.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-92-43-metablogapi/2043.image_5F00_thumb_5F00_04AC7EB1.png" width="762" height="421" /></a></font><font size="3"> </font></p>  <p><font size="3"></font></p>  <p><font size="3">Executing a command with log parser basic command on an IIS log file with a group by:</font></p>  <p><strong><font color="#0000ff" size="3">logparser “SELECT * FROM C:\1\iislog.log”</font></strong></p>  <p><font size="3">This query will return the file output in a table format:</font></p>  <p><font size="3"></font></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/92/43/metablogapi/8306.image_276E4DE6.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-92-43-metablogapi/8306.image_5F00_276E4DE6.png"><font color="#333333" size="3"></font></a><font color="#333333" size="3"><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/92/43/metablogapi/0336.image_0D307573.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-92-43-metablogapi/0336.image_5F00_0D307573.png"><img title="image" style="display: inline;" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/92/43/metablogapi/2860.image_thumb_5D2FCF3D.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-92-43-metablogapi/2860.image_5F00_thumb_5F00_5D2FCF3D.png" width="765" height="337" /></a></font><font size="3"> </font></p>  <p><font size="3"></font></p>  <p><font size="3">We can also do some manipulation on the file just like T-SQL command.</font></p>  <p><font size="3">This query will show the Requests per day.</font></p>  <p><font color="#0000ff" size="3"><strong>logparser&quot;SELECT TO_STRING(TO_LOCALTIME(TO_TIMESTAMP(date, time)), 'yyyy-MM-dd') AS [Day], COUNT(*) AS [Requests] FROM u_ex*.log GROUP BY [Day] ORDER BY [Day]&quot;</strong></font></p>  <p><font size="3">And now for the SQL fun part, we can upload the log/logs output directly to a database table and keep it for inquiries and history.</font></p>  <p><font color="#0000ff"><strong><font size="3">logparser&quot;SELECT * INTO EmailLogs FROM C:\1\iislog.log&quot;-i:W3C-o:SQL-oConnString&quot;Server=SQL2012; Database=IIS_LOGS; Trusted_Connection=True;&quot; </font><font size="3">-oConnString:&quot;Driver={SQL Server};Server=MyServer;db=pubs;uid=sa;pwd=MyPassword&quot;</font></strong></font></p>  <p><font size="3">The <strong>-i:W3C</strong> parameter for the input format (IIS file)</font></p>  <p><font size="3">The <strong>-o:SQL</strong> parameter for the output format (to SQL)</font></p>  <p><font size="3">The <strong>-oConnString</strong> parameter is the connection string to the database</font></p>  <p><font size="3"></font></p>]]></content:encoded>
    </item>
    <item>
      <title>SQL 2014 Beta</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlpfeil/sql-2014-beta</link>
      <pubDate>Wed, 30 Oct 2013 03:20:00 GMT</pubDate>
      <dc:creator><![CDATA[Oren Bouni]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sqlpfeil/2013/10/30/sql-2014-beta/</guid>
      <description><![CDATA[SQL2014 BETA is available now.
You can download and enjoy it.
&nbsp;Don&rsquo;t forget to try the...]]></description>
      <content:encoded><![CDATA[<p>SQL<br />2014 BETA is available now.</p>
<p>You can download and enjoy it.</p>
<p>&nbsp;Don&rsquo;t forget to try the In memory DB</p>
<p>&nbsp;</p>
<p><strong><a href="https://technet.microsoft.com/en-US/evalcenter/dn205290.aspx">https://technet.microsoft.com/en-US/evalcenter/dn205290.aspx</a></strong></p>]]></content:encoded>
    </item>
    <item>
      <title>Replication of indexed views</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlpfeil/replication-of-indexed-views</link>
      <pubDate>Mon, 30 Sep 2013 00:09:11 GMT</pubDate>
      <dc:creator><![CDATA[Stas Bogachinsky]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sqlpfeil/2013/09/30/replication-of-indexed-views/</guid>
      <description><![CDATA[Recently we created a Transactional Replication for one of our customer's database.  In addition to...]]></description>
      <content:encoded><![CDATA[<p>Recently we created a Transactional Replication for one of our customer's database.</p>  <p>In addition to tables, views and procedures we had <a href="https://msdn.microsoft.com/en-us/library/ms191432.aspx">indexed view</a> including Full Text Index base on it.</p>  <p>Currently, we cannot specify on the management studio what we’d like to replicated with the indexed view, so the only way is to do it with a script.</p>  <p>We need to pay attention to the following parameters: @type and @schema_option.</p>  <p>There are a few options, I’ve used    <br />@type=N'indexed view schema only' and @schema_option=0x0000000009000051</p>  <p>@type is quite simple, I wanted to replicate only the schema. </p>  <p>The @schema_option is a bitmask and in my case it contains the following bits:</p>  <p>· 0x01 - Generates the object creation script</p>  <p>· 0x10 - Generates a corresponding clustered index</p>  <p>· 0x40 - Generates corresponding nonclustered indexes</p>  <p>· 0x1000000 - Full-text index</p>  <p>· 0x8000000 - Create any schemas not already present on the subscriber</p>  <p>The command looks like this</p>  <p>&#160;</p>  <p>&#160;</p>  <p><font color="#0000ff">use</font> [PublishedDB]</p>  <p>   <br /><font color="#0000ff">exec</font> sp_addarticle    <br />@publication=<font color="#ff0000">N'DB_Publication'</font>,    <br />@article=<font color="#ff0000">N'v_View'</font>,    <br />@source_owner=<font color="#ff0000">N'dbo'</font>,    <br />@source_object=<font color="#ff0000">N'v_View'</font>,    <br />@type=<font color="#ff0000">N'indexed view schema only'</font>,    <br />@description=<font color="#a5a5a5">null</font>,    <br />@creation_script=<font color="#a5a5a5">null</font>,    <br />@pre_creation_cmd=<font color="#ff0000">N'drop'</font>,    <br />@schema_option= 0x0000000009000051,    <br />@destination_table=<font color="#ff0000">N'v_View'</font>,    <br />@destination_owner=<font color="#ff0000">N'dbo'</font>    <br /><font color="#0000ff">GO</font></p>  <p>conclusions</p>  <p>· indexed view can be replicated in a few ways – schema only or as table</p>  <p>· article replication has lots of options, you can read about them <a href="https://msdn.microsoft.com/en-us/library/ms173857.aspx">here</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Keep track of the DML changes:</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlpfeil/keep-track-of-the-dml-changes</link>
      <pubDate>Wed, 07 Aug 2013 04:00:00 GMT</pubDate>
      <dc:creator><![CDATA[Oren Bouni]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sqlpfeil/2013/08/07/keep-track-of-the-dml-changes/</guid>
      <description><![CDATA[Last week, one of my customers asked me how to track DML code.
He had a scenario in which he needed...]]></description>
      <content:encoded><![CDATA[<p>Last week, one of my customers asked me how to track DML code.</p>
<p>He had a scenario in which he needed to update a table and keep the old data.</p>
<p>In the past, developers and DBAs have used custom code to track changes, stored procedures, triggers and CDC.</p>
<p>Starting with version 2005, SQL Server supports a simple method for auditing DML changes; the OUTPUT clause.</p>
<p>The OUTPUT command, collects the audited data into a table or a table variable. It enables us to track DML info of DELETE, UPDATE, INSERT &amp; MERGE command.</p>
<p>The most common usage of the output command is in archiving processes. If we want to delete info from a business data table and archive the deleted data.</p>
<p><strong><span style="text-decoration: underline;">An important thing to know about OUTPUT:</span></strong></p>
<p>When UPDATE, INSERT, or DELETE statements are cached in an OUTPUT clause, it will return rows to the client even if the statement encounters errors and is rolled back.</p>
<p><strong><em>The result should not be used if any error occurs.</em></strong></p>
<h1><strong><span style="text-decoration: underline;">Example:</span></strong></h1>
<p>In this example we have an Employee salary table that we want to trace the salary changes.</p>
<p>In this scenario, the HR department of a big corporation would like to update all hourly tariff of the employees by 15% and keep the changes in an audit table for further action or for a fast rollback after testing the impact of the raise.</p>
<p>&nbsp;</p>
<div id="codeSnippetWrapper" style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: 'Courier New', courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: #f4f4f4;">
<div id="codeSnippet" style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;">
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span id="lnum1" style="color: #606060;"> 1:</span> <span style="color: #0000ff;">Create</span> <span style="color: #0000ff;">Database</span> Output_Syntax</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"><span id="lnum2" style="color: #606060;"> 2:</span> <span style="color: #0000ff;">go</span></pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span id="lnum3" style="color: #606060;"> 3:</span> <span style="color: #0000ff;">use</span> Output_Syntax</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"><span id="lnum4" style="color: #606060;"> 4:</span> <span style="color: #0000ff;">go</span></pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span id="lnum5" style="color: #606060;"> 5:</span>&nbsp; </pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"><span id="lnum6" style="color: #606060;"> 6:</span> <span style="color: #0000ff;">Create</span> <span style="color: #0000ff;">Table</span> Emp_Hour_Rate(</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span id="lnum7" style="color: #606060;"> 7:</span>     Emp_ID        intidentity,</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"><span id="lnum8" style="color: #606060;"> 8:</span>     EmpFName    <span style="color: #0000ff;">varchar</span>(15),</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span id="lnum9" style="color: #606060;"> 9:</span>     Emp_Sal_H    <span style="color: #0000ff;">int</span>,</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"><span id="lnum10" style="color: #606060;"> 10:</span>     Emp_hour    <span style="color: #0000ff;">int</span>,</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span id="lnum11" style="color: #606060;"> 11:</span>     Emp_Sal    <span style="color: #0000ff;">AS</span> ([Emp_Sal_H]*[Emp_hour]),</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"><span id="lnum12" style="color: #606060;"> 12:</span>     Mod_Date    Datetime)</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span id="lnum13" style="color: #606060;"> 13:</span>&nbsp; </pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"><span id="lnum14" style="color: #606060;"> 14:</span> Insert <span style="color: #0000ff;">into</span> Emp_Hour_RateValues (<span style="color: #006080;">'David'</span>,120, 180,getdate()-1)</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span id="lnum15" style="color: #606060;"> 15:</span> Insert <span style="color: #0000ff;">into</span> Emp_Hour_RateValues (<span style="color: #006080;">'Tomer'</span>,120, 165,getdate()-7)</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"><span id="lnum16" style="color: #606060;"> 16:</span> Insert <span style="color: #0000ff;">into</span> Emp_Hour_RateValues (<span style="color: #006080;">'Daniel'</span>,120,192,getdate()-21)</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span id="lnum17" style="color: #606060;"> 17:</span> Insert <span style="color: #0000ff;">into</span> Emp_Hour_RateValues (<span style="color: #006080;">'Yoel'</span>,120,160,getdate()-32)</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"><span id="lnum18" style="color: #606060;"> 18:</span> Insert <span style="color: #0000ff;">into</span> Emp_Hour_RateValues (<span style="color: #006080;">'Eran'</span>,120,172,getdate()-32)</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span id="lnum19" style="color: #606060;"> 19:</span> Insert <span style="color: #0000ff;">into</span> Emp_Hour_RateValues (<span style="color: #006080;">'Israel'</span>,120,147,getdate()-12)</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"><span id="lnum20" style="color: #606060;"> 20:</span>&nbsp; </pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span id="lnum21" style="color: #606060;"> 21:</span> <span style="color: #0000ff;">Create</span> <span style="color: #0000ff;">table</span> Audit_Sal(</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"><span id="lnum22" style="color: #606060;"> 22:</span> EmpID         <span style="color: #0000ff;">int</span> NOTNULL,</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span id="lnum23" style="color: #606060;"> 23:</span> EmpFName    <span style="color: #0000ff;">varchar</span>(15),</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"><span id="lnum24" style="color: #606060;"> 24:</span> OldSalery     <span style="color: #0000ff;">int</span>,</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span id="lnum25" style="color: #606060;"> 25:</span> NewSalery     <span style="color: #0000ff;">int</span>,</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"><span id="lnum26" style="color: #606060;"> 26:</span> ModifiedDa     tedatetime);</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span id="lnum27" style="color: #606060;"> 27:</span>&nbsp; </pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"><span id="lnum28" style="color: #606060;"> 28:</span>&nbsp; </pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span id="lnum29" style="color: #606060;"> 29:</span>&nbsp; </pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"><span id="lnum30" style="color: #606060;"> 30:</span>&nbsp; </pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span id="lnum31" style="color: #606060;"> 31:</span> <span style="color: #008000;">-- updateing a raise of 15% for </span></pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"><span id="lnum32" style="color: #606060;"> 32:</span> <span style="color: #0000ff;">UPDATE</span> Emp_Hour_Rate</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span id="lnum33" style="color: #606060;"> 33:</span> <span style="color: #0000ff;">SET</span>        Emp_Sal_H=Emp_Sal_H*1.15,</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"><span id="lnum34" style="color: #606060;"> 34:</span>         Mod_Date=GETDATE()</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span id="lnum35" style="color: #606060;"> 35:</span> <span style="color: #0000ff;">OUTPUT</span> inserted.Emp_ID,</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"><span id="lnum36" style="color: #606060;"> 36:</span>         inserted.EmpFName,</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span id="lnum37" style="color: #606060;"> 37:</span> deleted.Emp_Sal_H,</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"><span id="lnum38" style="color: #606060;"> 38:</span> inserted.Emp_Sal_H,</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span id="lnum39" style="color: #606060;"> 39:</span> inserted.Mod_Date</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"><span id="lnum40" style="color: #606060;"> 40:</span> <span style="color: #0000ff;">INTO</span> Audit_Sal;</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span id="lnum41" style="color: #606060;"> 41:</span>&nbsp; </pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"><span id="lnum42" style="color: #606060;"> 42:</span> --Display the <span style="color: #0000ff;">result</span> <span style="color: #0000ff;">set</span> <span style="color: #0000ff;">of</span> the <span style="color: #0000ff;">table</span> <span style="color: #0000ff;">variable</span>.</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span id="lnum43" style="color: #606060;"> 43:</span>&nbsp; </pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"><span id="lnum44" style="color: #606060;"> 44:</span>&nbsp; </pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span id="lnum45" style="color: #606060;"> 45:</span> <span style="color: #0000ff;">Select</span>    EmpID,EmpFName,OldSalery,NewSalery,ModifiedDate</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"><span id="lnum46" style="color: #606060;"> 46:</span> <span style="color: #0000ff;">FROM</span>    Audit_Sal</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span id="lnum47" style="color: #606060;"> 47:</span>&nbsp; </pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"><span id="lnum48" style="color: #606060;"> 48:</span> <span style="color: #0000ff;">Select</span> * <span style="color: #0000ff;">from</span> Emp_Hour_Rate</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span id="lnum49" style="color: #606060;"> 49:</span>&nbsp; </pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"><span id="lnum50" style="color: #606060;"> 50:</span> Usemaster</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span id="lnum51" style="color: #606060;"> 51:</span> <span style="color: #0000ff;">go</span></pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"><span id="lnum52" style="color: #606060;"> 52:</span>&nbsp; </pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span id="lnum53" style="color: #606060;"> 53:</span> <span style="color: #0000ff;">drop</span> <span style="color: #0000ff;">database</span> Output_Syntax</pre>
<!--CRLF-->
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: 'Courier New', courier, monospace; font-size: 8pt; direction: ltr; background-color: #f4f4f4;"><span id="lnum54" style="color: #606060;"> 54:</span> <span style="color: #0000ff;">go</span></pre>
<!--CRLF--></div>
</div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/92/43/metablogapi/2068.AuditDML_Output1_029712F7.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-92-43-metablogapi/2068.AuditDML_5F00_Output1_5F00_029712F7.png"><img style="display: inline;" title="AuditDML_Output1" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/92/43/metablogapi/2625.AuditDML_Output1_thumb_5A1FE2F5.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-92-43-metablogapi/2625.AuditDML_5F00_Output1_5F00_thumb_5F00_5A1FE2F5.png" alt="AuditDML_Output1" width="576" height="464" border="0" /></a></p>
<table cellspacing="0" cellpadding="0" align="left">
<tbody>
<tr>
<td width="312" height="506">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>]]></content:encoded>
    </item>
    <item>
      <title>The scenario of a missing SA password:</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlpfeil/the-scenario-of-a-missing-sa-password</link>
      <pubDate>Mon, 22 Jul 2013 13:36:00 GMT</pubDate>
      <dc:creator><![CDATA[Oren Bouni]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sqlpfeil/2013/07/22/the-scenario-of-a-missing-sa-password/</guid>
      <description><![CDATA[You are the senior DBA of your organization, responsible for all the databases that hold the...]]></description>
      <content:encoded><![CDATA[<p><span style="font-size: x-small;">You are the senior DBA of your organization, responsible for all the databases that hold the critical info. In order to secure <br />the environment and the databases, you performed the next recommended steps:</span></p>
<p><span style="font-size: x-small;">1) Remove all built-in admin account from SQL Server logins.</span></p>
<p><span style="font-size: x-small;">2) Remove all users from SYSADMIN server role except SA (assuming you are&nbsp; <br />&nbsp;&nbsp;&nbsp; working in a mixed mode environment).</span></p>
<p><span style="font-size: x-small;">3) Change the SA account password to something extremely complex.</span></p>
<p><span style="font-size: x-small;">4) For SQL daily operations, you use a domain user account with DBO permissions on&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp; user databases with no SYSADMIN privileges on the system.</span></p>
<p><span style="font-size: x-small;">5) You haven't saved the SA password.</span></p>
<p><span style="font-size: x-small;">Since the SA password is complicated, you are using your domain account and in time you have forgotten the SA password.</span></p>
<p><span style="font-size: x-small;">Well, you are the only one on the team that knows the password but you don't remember it.</span></p>
<p><span style="font-size: x-small;">The first option is to write the resignation letter.</span></p>
<p><span style="font-size: x-small;">The recommended option is to continue reading.</span></p>
<p><strong><span style="color: #4f81bd; font-size: medium;">Here are the Steps to take back control of your SQL 2012 SA:</span></strong></p>
<p><span style="font-size: x-small;">Start the damaged instance of SQL 2012 in single user mode from command prompt with Administrator rights and type: <br /><strong><span style="color: #ff0000;">SQLServr.Exe &ndash;m </span></strong>(or <strong><span style="color: #ff0000;">SQLServr.exe &ndash;f</span></strong>). <br />The <strong><span style="color: #ff0000;">SQLServr.exe </span></strong>will be located in the Binn folder, make shure that the Binn path exist in the environmental parameters: <br /><strong>C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Binn&gt;.</strong></span></p>
<p><span style="font-size: x-small;">Now that SQL Server 2012 was started in single user mode, we open up another CMD (with elevated right) window and f <br />rom the command prompt connect to SQL Server 2012 instance with the SQLCMD command:</span></p>
<p><strong><span style="color: #ff0000; font-size: x-small;">SQLCMD &ndash;S &lt;My_Machin\My_Instance&gt;</span></strong></p>
<p><strong><span style="color: #ff0000; font-size: x-small;">For Example: <br /></span></strong><strong><span style="color: #ff0000; font-size: x-small;">SQLCMD &ndash;S ServSQL2012\Inst2012</span></strong></p>
<p><span style="font-size: x-small;">When connecting in &ndash;S mode you are to the SQL in an windows authentication mode and with the user admin right. <br /></span><span style="font-size: x-small;">Once connected to the SQL Instance we can start and create a new login "NEW_SA" <br /></span><span style="font-size: x-small;">The command to create the new login:</span></p>
<p><strong><span style="color: #ff0000; font-size: x-small;">1&gt; CREATE LOGIN &lt;Login_Name&gt; with PASSWORD=&rsquo;&lt;Password&gt;&rsquo; <br /></span></strong><strong><span style="color: #ff0000; font-size: x-small;">2&gt; GO</span></strong></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/92/43/metablogapi/8117.image_0F8B11F5.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-92-43-metablogapi/8117.image_5F00_0F8B11F5.png"><img style="display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/92/43/metablogapi/6740.image_thumb_4684F02E.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-92-43-metablogapi/6740.image_5F00_thumb_5F00_4684F02E.png" alt="image" width="642" height="291" border="0" /></a></p>
<p>&nbsp;</p>
<p><span style="font-size: x-small;">Once the login was created we will add it to the SYSADMIN role. </span></p>
<p><span style="font-size: x-small;">The command to add a login to the SYSADMIN role:</span></p>
<p><span style="color: #ff0000;"><strong><span style="font-size: x-small;">1&gt; SP_ADDSRVROLEMEMBER '&lt;Login_Name&gt;','SYSADMIN' <br /></span></strong><strong><span style="font-size: x-small;">2&gt; GO</span></strong></span></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/92/43/metablogapi/4251.image_43FBBE70.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-92-43-metablogapi/4251.image_5F00_43FBBE70.png"><img style="display: inline; background-image: none;" title="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/92/43/metablogapi/8838.image_thumb_41DEBFA7.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-92-43-metablogapi/8838.image_5F00_thumb_5F00_41DEBFA7.png" alt="image" width="646" height="298" border="0" /></a></p>
<p><span style="font-size: x-small;">Now that the new LOGIN was created and that the added to the SYSADMIN role we can log with it to the <br />instance and change the SA password to a new one.</span></p>]]></content:encoded>
    </item>
    <item>
      <title>Discontinued and Deprecated features in SQL Server 2012</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlpfeil/discontinued-and-deprecated-features-in-sql-server-2012</link>
      <pubDate>Sat, 29 Jun 2013 12:33:07 GMT</pubDate>
      <dc:creator><![CDATA[Stas Bogachinsky]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sqlpfeil/2013/06/29/discontinued-and-deprecated-features-in-sql-server-2012/</guid>
      <description><![CDATA[Recently we encountered a few problems with upgrades to SQL Server 2012, mainly because of usage of...]]></description>
      <content:encoded><![CDATA[<p>Recently we encountered a few problems with upgrades to SQL Server 2012, mainly because of usage of features that are no longer supported.</p>  <p>Each time we are approach an upgrade, we try to minimize the risk.    <br /> These built-in tools can assist us:</p>  <ul>   <li>SQL Server Upgrade Advisor</li>    <li>SQL Server Profiler deprecation events</li>    <li>SQL Server Distributed Replay</li> </ul>  <p>Once we use any of these simple tools, we minimize the risk of a failing an upgrade. It is also important to mention that it is also required to perform full regression, functionality and performance tests as well.</p>  <p>Here are some of most relevant deprecated and discontinued features.</p>  <p>Deprecated</p>  <ul>   <li>SET ROWCOUNT</li>    <li>SQL Server Database Mirroring</li>    <li>Specifying the SQLOLEDB provider for linked servers.</li>    <li>Not ending Transact-SQL statements with a semicolon.</li>    <li>Specifying table hints without using the WITH keyword.</li>    <li>Specifying NOLOCK or READUNCOMMITTED in the FROM clause of an UPDATE or DELETE statement.</li>    <li>SQL Trace stored procedures, functions, and catalog views.</li>    <li>sp_dbcmptlevel</li>    <li>sp_attach_db &amp; sp_attach_single_file_db</li>    <li>c2 audit option</li>    <li>default trace enabled option</li>    <li>sp_addlogin / sp_droplogin / sp_adduser / sp_dropuser / sp_grantdbaccess / sp_revokedbaccess / sp_denylogin      <br /></li> </ul>  <p>Discontinued</p>  <ul>   <li>fastfirstrow option</li>    <li>compatibility level 80</li>    <li>sp_dboption</li>    <li>AWE</li> </ul>  <p>&#160;</p>  <p>For more details, please refer to this detailed document (including 4 topics) -    <br /><a href="https://msdn.microsoft.com/en-us/library/ms143532.aspx">https://msdn.microsoft.com/en-us/library/ms143532.aspx</a></p>]]></content:encoded>
    </item>
  </channel>
</rss>