tag:blogger.com,1999:blog-36332709742357262052024-03-13T08:21:51.902-04:00Swarndeep's TECH BLOGSSwarndeep Singhhttp://www.blogger.com/profile/11550593701026635986noreply@blogger.comBlogger31125tag:blogger.com,1999:blog-3633270974235726205.post-6153234534463613742019-09-15T23:14:00.001-04:002019-09-15T23:15:46.131-04:00Optimizing Indexes with Execution Plans<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/O4xVzEMkyzM/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/O4xVzEMkyzM?feature=player_embedded" width="320"></iframe></div>
<br />Swarndeep Singhhttp://www.blogger.com/profile/11550593701026635986noreply@blogger.com2tag:blogger.com,1999:blog-3633270974235726205.post-78202138019005052572019-03-16T11:12:00.000-04:002019-03-16T11:12:45.523-04:00Using Azure Storage for SQL Backups<br />
<div class="MsoNormalCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">you may have taken backups on local storage, file servers, NAS, etc. Now a days it is becoming crucial you have backup copies available in different locations just in case disaster strikes and you need your large backup readily available on other coast.</span></div>
<div class="MsoNormalCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><br /></span></div>
<div class="MsoNormalCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Cloud Storage probably is the best option you can have without having data centers offsite availability for BCP.</span></div>
<div class="MsoNormalCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><br /></span></div>
<div class="MsoNormalCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">As I have been reviewing Azure for some time now, I find it very simple and intuitive taking backups on Azure Storage.</span></div>
<div class="MsoNormalCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><br /></span></div>
<div class="MsoNormalCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Some of the storage objects provided by Azure are Blob, Table, Queue and File. Not only
Azure Storage is highly available from anywhere in the world also it secured
and durable. </span></div>
<div class="MsoNormalCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><br /></span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">By default, the data
in Storage Account is secured with Encryption at server-side (using Transparent
Data Encryption). </span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><br /></span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Data from Azure
Storage can be accessed via URLs (http and https). The
URL (also called end points) are fixed for each object type and can be
referenced by prefixing unique storage account name. Here are the URLs for various object types: </span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><br /></span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<b style="mso-bidi-font-weight: normal;"><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Blob:</span></b><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">
blob.core.windows.net </span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<b style="mso-bidi-font-weight: normal;"><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Table:</span></b><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">
table.core.windows.net </span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<b style="mso-bidi-font-weight: normal;"><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Queue:</span></b><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"> queue.core.windows.net
</span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<b style="mso-bidi-font-weight: normal;"><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">File:</span></b><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">
file.core.windows.net </span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><br /></span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">For example, if my
blob storage account name is “mystorage” then the URL will become
http://mystorage.blob.core.windows.net/ </span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><br /></span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">In order to
understand Azure Storage, I would like to give one End to End demo on Azure
Storage. The demo will include creating Storage Blob and then taking backup directly on the Storage Blob.</span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><br /></span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">At high level these
are the steps we need to take: </span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://www.blogger.com/blogger.g?blogID=3633270974235726205" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"></a></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto;">
<br /></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto;">
<span style="color: #b45f06; font-family: "verdana" , sans-serif; font-size: 12.0pt;">Setup Storage</span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span></div>
<ul type="disc">
<li class="MsoNormalCxSpMiddle" style="line-height: normal; mso-add-space: auto; mso-list: l7 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Create
Resource Group</span></li>
<li class="MsoNormalCxSpMiddle" style="line-height: normal; mso-add-space: auto; mso-list: l7 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Create
Storage Account</span></li>
<li class="MsoNormalCxSpMiddle" style="line-height: normal; mso-add-space: auto; mso-list: l7 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Create
Storage Context</span></li>
<li class="MsoNormalCxSpMiddle" style="line-height: normal; mso-add-space: auto; mso-list: l7 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Create
Storage Container</span></li>
<li class="MsoNormalCxSpMiddle" style="line-height: normal; mso-add-space: auto; mso-list: l7 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Create
Access Policy</span></li>
<li class="MsoNormalCxSpMiddle" style="line-height: normal; mso-add-space: auto; mso-list: l7 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Create
Shared Access Signature (SAS)</span></li>
</ul>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto;">
<br /></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto;">
<span style="color: #b45f06; font-family: "verdana" , sans-serif; font-size: 12.0pt;">Preparing for SQL Backup</span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span></div>
<ul type="disc">
<a href="https://www.blogger.com/blogger.g?blogID=3633270974235726205" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><br /></a>
<li class="MsoNormalCxSpMiddle" style="line-height: normal; mso-add-space: auto; mso-list: l2 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><div style="text-align: left;">
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Create
Credentials for Storage in SQL Server</span></div>
</li>
<li class="MsoNormalCxSpMiddle" style="line-height: normal; mso-add-space: auto; mso-list: l2 level1 lfo2; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><div style="text-align: left;">
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Connect
to Azure Storage from SSMS</span></div>
</li>
</ul>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto;">
<br /></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto;">
<span style="color: #b45f06; font-family: "verdana" , sans-serif; font-size: 12.0pt;">Final Steps (SQL backup
on Azure Storage)</span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">
</span></div>
<ul type="disc">
<li class="MsoNormalCxSpMiddle" style="line-height: normal; mso-add-space: auto; mso-list: l6 level1 lfo3; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Take
Backup on Azure Storage using connected Azure Storage (URL)</span></li>
<li class="MsoNormalCxSpMiddle" style="line-height: normal; mso-add-space: auto; mso-list: l6 level1 lfo3; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Verify
Backup on Storage</span></li>
</ul>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto;">
<br /></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto;">
<span style="color: #b45f06; font-family: "verdana" , sans-serif; font-size: 12.0pt;">Setup Storage</span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span></div>
<ul type="disc">
<li class="MsoNormalCxSpMiddle" style="line-height: normal; mso-add-space: auto; mso-list: l3 level1 lfo4; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Connect
to PowerShell (Elevated)</span></li>
<li class="MsoNormalCxSpMiddle" style="line-height: normal; mso-add-space: auto; mso-list: l3 level1 lfo4; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Install
and connect to Az (Azure Module)</span></li>
</ul>
<div class="MsoNormalCxSpMiddle" style="background: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">Install-module az -AllowCobbler </span></div>
<div class="MsoNormalCxSpMiddle" style="background: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">Connect-azAccount </span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-add-space: auto;">
<br /></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-add-space: auto;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<i><a href="https://4.bp.blogspot.com/-77rBZ7wKN6I/XGTRgrQgeOI/AAAAAAAAe5A/czz6oSjQQmcZ6AYCX9M9iePV7wQ_rJwTACEwYBhgL/s1600/1-AzureSignIn.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="415" data-original-width="527" height="251" src="https://4.bp.blogspot.com/-77rBZ7wKN6I/XGTRgrQgeOI/AAAAAAAAe5A/czz6oSjQQmcZ6AYCX9M9iePV7wQ_rJwTACEwYBhgL/s320/1-AzureSignIn.png" width="320" /></a></i></div>
<i><span id="goog_160332675"></span><a href="https://www.blogger.com/"></a><span id="goog_160332676"></span></i><br />
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: 5.0pt; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<a href="https://4.bp.blogspot.com/-77rBZ7wKN6I/XGTRgrQgeOI/AAAAAAAAe5A/czz6oSjQQmcZ6AYCX9M9iePV7wQ_rJwTACEwYBhgL/s1600/1-AzureSignIn.png"><span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt; text-decoration: none;"><!--[if gte vml 1]><v:shapetype
id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t"
path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f">
<v:stroke joinstyle="miter"/>
<v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0"/>
<v:f eqn="sum @0 1 0"/>
<v:f eqn="sum 0 0 @1"/>
<v:f eqn="prod @2 1 2"/>
<v:f eqn="prod @3 21600 pixelWidth"/>
<v:f eqn="prod @3 21600 pixelHeight"/>
<v:f eqn="sum @0 0 1"/>
<v:f eqn="prod @6 1 2"/>
<v:f eqn="prod @7 21600 pixelWidth"/>
<v:f eqn="sum @8 21600 0"/>
<v:f eqn="prod @7 21600 pixelHeight"/>
<v:f eqn="sum @10 21600 0"/>
</v:formulas>
<v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/>
<o:lock v:ext="edit" aspectratio="t"/>
</v:shapetype><v:shape id="Picture_x0020_11" o:spid="_x0000_i1035" type="#_x0000_t75"
alt="https://4.bp.blogspot.com/-77rBZ7wKN6I/XGTRgrQgeOI/AAAAAAAAe5A/czz6oSjQQmcZ6AYCX9M9iePV7wQ_rJwTACEwYBhgL/s320/1-AzureSignIn.png"
href="https://4.bp.blogspot.com/-77rBZ7wKN6I/XGTRgrQgeOI/AAAAAAAAe5A/czz6oSjQQmcZ6AYCX9M9iePV7wQ_rJwTACEwYBhgL/s1600/1-AzureSignIn.png"
style='width:240pt;height:188.25pt;visibility:visible;mso-wrap-style:square'
o:button="t">
<v:imagedata src="file:///C:/Users/swarn/AppData/Local/Temp/msohtmlclip1/01/clip_image001.png"
o:title="1-AzureSignIn"/>
</v:shape><![endif]--><!--[if !vml]--><span style="mso-ignore: vglayout;"></span><!--[endif]--></span></a><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"></span></div>
<ul type="disc">
<li class="MsoNormalCxSpMiddle" style="line-height: normal; mso-add-space: auto; mso-list: l10 level1 lfo5; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Complete
the Sign in Process as prompted</span></li>
<li class="MsoNormalCxSpMiddle" style="line-height: normal; mso-add-space: auto; mso-list: l10 level1 lfo5; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Setup
a few variables</span></li>
</ul>
<div class="MsoNormalCxSpMiddle" style="background: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$resourcegroup</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: #69ff69; font-family: "verdana" , sans-serif; font-size: 12.0pt;">=</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: #ffb500; font-family: "verdana" , sans-serif; font-size: 12.0pt;">'1209rg'</span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span></div>
<div class="MsoNormalCxSpMiddle" style="background: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$storageaccount</span><span style="color: #69ff69; font-family: "verdana" , sans-serif; font-size: 12.0pt;">=</span><span style="color: #ffb500; font-family: "verdana" , sans-serif; font-size: 12.0pt;">'1209sa'</span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span></div>
<div class="MsoNormalCxSpMiddle" style="background: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$container</span><span style="color: #69ff69; font-family: "verdana" , sans-serif; font-size: 12.0pt;">=</span><span style="color: #ffb500; font-family: "verdana" , sans-serif; font-size: 12.0pt;">'1209con'</span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span></div>
<div class="MsoNormalCxSpMiddle" style="background: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$policyname</span><span style="color: #69ff69; font-family: "verdana" , sans-serif; font-size: 12.0pt;">=</span><span style="color: #ffb500; font-family: "verdana" , sans-serif; font-size: 12.0pt;">'1209policy'
</span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"></span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-left: .5in; mso-add-space: auto; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: justify;">
<br /></div>
<ul type="disc">
<li class="MsoNormalCxSpMiddle" style="line-height: normal; mso-add-space: auto; mso-list: l12 level1 lfo6; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-align: justify;"><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Get the Subscription ID<span style="color: white;">#Get SubscriptionID</span> </span></li>
</ul>
<div class="MsoNormalCxSpMiddle" style="background: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$subscription</span><span style="color: #69ff69; font-family: "verdana" , sans-serif; font-size: 12.0pt;">=</span><span style="color: #ff56ff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">Get-AZSubscription</span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span></div>
<div class="MsoNormalCxSpMiddle" style="background: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$subscriptionid</span><span style="color: #69ff69; font-family: "verdana" , sans-serif; font-size: 12.0pt;">=</span><span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$subscription</span><span style="color: #69ff69; font-family: "verdana" , sans-serif; font-size: 12.0pt;">.</span><span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt;">ID </span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"></span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-left: .5in; mso-add-space: auto; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<br /></div>
<ul type="disc">
<li class="MsoNormalCxSpMiddle" style="line-height: normal; mso-add-space: auto; mso-list: l9 level1 lfo7; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Switch
the context to Subscription as selected above</span></li>
</ul>
<div class="MsoNormalCxSpMiddle" style="background: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"># Change the context to subscription ID for
further work</span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">
</span></div>
<div class="MsoNormalCxSpMiddle" style="background: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: #ff56ff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">Set-AzContext</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt;">-SubscriptionId</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$subscriptionid </span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"></span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-left: .5in; mso-add-space: auto; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<br /></div>
<ul type="disc">
<li class="MsoNormalCxSpMiddle" style="line-height: normal; mso-add-space: auto; mso-list: l8 level1 lfo8; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Create
new resource group (read more about resource groups here</span><span style="font-size: 12.0pt;"><span style="font-family: "verdana" , sans-serif;">: https://tinyurl.com/y8k3jqoj)</span><div id="success" style="-webkit-text-stroke-width: 0px; background-color: transparent; color: black; display: inline; font-style: normal; font-variant: normal; letter-spacing: normal; margin-left: 40px; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;">
</div>
</span></li>
</ul>
<div class="MsoNormalCxSpMiddle" style="background: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"># create new resource group for </span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"></span></div>
<div class="MsoNormalCxSpMiddle" style="background: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: #ff56ff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">New-AzResourceGroup</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt;">-Name</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$resourcegroup</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt;">-Location</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: #ffb500; font-family: "verdana" , sans-serif; font-size: 12.0pt;">'East
US' </span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"></span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-left: .5in; mso-add-space: auto; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<br /></div>
<ul type="disc">
<li class="MsoNormalCxSpMiddle" style="line-height: normal; mso-add-space: auto; mso-list: l11 level1 lfo9; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Create
a new Storage Account</span></li>
</ul>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-left: 1.0in; mso-add-space: auto; mso-list: l0 level1 lfo10; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "symbol"; font-size: 10.0pt;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><i><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">You may read more about storage accounts at <a href="https://azure.microsoft.com/en-us/pricing/details/storage/page-blobs/"><span style="color: blue;">https://azure.microsoft.com/en-us/pricing/details/storage/page-blobs/</span></a></span></i><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-left: 1.0in; mso-add-space: auto; mso-list: l1 level1 lfo11; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "symbol"; font-size: 10.0pt;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><i><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">For creating storage account, you need to provide Resource
Group name, Location and Type of storage</span></i><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-left: 1.0in; mso-add-space: auto; mso-list: l5 level1 lfo12; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "symbol"; font-size: 10.0pt;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><i><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">For more information on storage types, visit this page:
https://docs.microsoft.com/en-us/azure/storage/common/storage-account-overview</span></i><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormalCxSpMiddle" style="background: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"># Create new Storage Account </span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormalCxSpMiddle" style="background: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: #ff56ff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">New-AzStorageAccount</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt;">-Name</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$storageaccount</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt;">-ResourceGroupName</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$resourcegroup</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt;">-Location</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: #ffb500; font-family: "verdana" , sans-serif; font-size: 12.0pt;">'East
US'</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt;">-Type</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: #8aff00; font-family: "verdana" , sans-serif; font-size: 12.0pt;">Standard_LRS </span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-left: .5in; mso-add-space: auto; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;">
<br /></div>
<ul type="disc">
<li class="MsoNormalCxSpLast" style="line-height: normal; mso-add-space: auto; mso-list: l4 level1 lfo13; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Getting
Access Keys<o:p></o:p></span></li>
</ul>
<div class="MsoListParagraph" style="line-height: normal; margin-left: 1.0in; mso-add-space: auto; mso-list: l4 level2 lfo13; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list 1.0in; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "courier new"; font-size: 10.0pt;"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">After creating
storage account, azure will be default create two new access keys and these
keys are secret passcode to access the storage remotely using http or https URL<o:p></o:p></span></div>
<div class="MsoNormal" style="background: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$accesskey</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: #69ff69; font-family: "verdana" , sans-serif; font-size: 12.0pt;">=</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: red; font-family: "verdana" , sans-serif; font-size: 12.0pt;">(</span><span style="color: #ff56ff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">Get-AzStorageAccountKey</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt;">-ResourceGroupName</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$resourcegroup</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt;">-Name</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$storageaccount</span><span style="color: red; font-family: "verdana" , sans-serif; font-size: 12.0pt;">)</span><span style="color: #69ff69; font-family: "verdana" , sans-serif; font-size: 12.0pt;">.</span><span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt;">Value</span><span style="color: #69ff69; font-family: "verdana" , sans-serif; font-size: 12.0pt;">[</span><span style="color: #8000ff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">0</span><span style="color: #69ff69; font-family: "verdana" , sans-serif; font-size: 12.0pt;">] </span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoListParagraph" style="line-height: normal; margin-left: 1.0in; mso-add-space: auto; mso-list: l4 level2 lfo13; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list 1.0in; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "courier new"; font-size: 10.0pt;"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Access keys can be
validated from Portal as well<o:p></o:p></span></div>
<div class="MsoNormalCxSpFirst" style="line-height: normal; margin-bottom: 5.0pt; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt; text-decoration: none;"><!--[if gte vml 1]><v:shape id="Picture_x0020_10"
o:spid="_x0000_i1034" type="#_x0000_t75" alt="https://3.bp.blogspot.com/-QCSk79PHORg/XGTRgm4A6HI/AAAAAAAAe5A/nhLfpaFTYKgyEpPSg4cTs4GETLiHoqj6gCEwYBhgL/s400/2-AccessKeys.png"
href="https://3.bp.blogspot.com/-QCSk79PHORg/XGTRgm4A6HI/AAAAAAAAe5A/nhLfpaFTYKgyEpPSg4cTs4GETLiHoqj6gCEwYBhgL/s1600/2-AccessKeys.png"
style='width:300pt;height:157.5pt;visibility:visible;mso-wrap-style:square'
o:button="t">
<v:imagedata src="file:///C:/Users/swarn/AppData/Local/Temp/msohtmlclip1/01/clip_image002.png"
o:title="2-AccessKeys"/>
</v:shape><![endif]--><!--[if !vml]--><span style="mso-ignore: vglayout;"></span><!--[endif]--></span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-QCSk79PHORg/XGTRgm4A6HI/AAAAAAAAe5A/nhLfpaFTYKgyEpPSg4cTs4GETLiHoqj6gCEwYBhgL/s1600/2-AccessKeys.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="649" data-original-width="1231" height="168" src="https://3.bp.blogspot.com/-QCSk79PHORg/XGTRgm4A6HI/AAAAAAAAe5A/nhLfpaFTYKgyEpPSg4cTs4GETLiHoqj6gCEwYBhgL/s320/2-AccessKeys.png" width="320" /></a></div>
<br />
<ul type="disc">
<li class="MsoNormalCxSpLast" style="line-height: normal; mso-add-space: auto; mso-list: l4 level1 lfo13; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Creating
Storage Context<o:p></o:p></span></li>
</ul>
<div class="MsoListParagraph" style="line-height: normal; margin-left: 1.0in; mso-add-space: auto; mso-list: l4 level2 lfo13; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list 1.0in; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "courier new"; font-size: 10.0pt;"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Storage context is a
reference to storage by taking storage account name and access key<o:p></o:p></span></div>
<div class="MsoNormalCxSpFirst" style="background: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$storagecontext</span><span style="color: #69ff69; font-family: "verdana" , sans-serif; font-size: 12.0pt;">=</span><span style="color: #ff56ff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">New-AzureStorageContext</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt;">-StorageAccountName</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$storageaccount</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt;">-StorageAccountKey</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$accesskey
</span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto;">
<br /></div>
<ul type="disc">
<li class="MsoNormalCxSpMiddle" style="line-height: normal; mso-add-space: auto; mso-list: l4 level1 lfo13; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list .5in;"><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Creating
Storage Container <o:p></o:p></span></li>
<ul type="circle">
<li class="MsoNormalCxSpMiddle" style="line-height: normal; mso-add-space: auto; mso-list: l4 level2 lfo13; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list 1.0in;"><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Storage
container can be thought of as a parent folder within Storage Account and
holds the data <o:p></o:p></span></li>
</ul>
</ul>
<div class="MsoNormalCxSpLast" style="background: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$storagecontainer</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: #69ff69; font-family: "verdana" , sans-serif; font-size: 12.0pt;">=</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: #ff56ff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">New-AzureStorageContainer</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt;">-Name</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$container</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt;">-Context</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$storagecontext
</span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; mso-list: l4 level1 lfo13; tab-stops: list .5in; text-align: justify; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "symbol"; font-size: 10.0pt;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Creating
Access Policy <o:p></o:p></span></div>
<div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l4 level2 lfo13; tab-stops: list 1.0in; text-align: justify; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "courier new"; font-size: 10.0pt;"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Access
Policy can be considered as a group policy for containers and Shared Access
Signatures Token can be created with policy as defined in Access Policy and
makes it easy to manage, revoke and restrict access. SAS without Access
Policies can be difficult to manage. In order to revoke access from SAS without
a policy, the access key would need to be changed. <o:p></o:p></span></div>
<div class="MsoNormalCxSpFirst" style="background: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$policy</span><span style="color: #69ff69; font-family: "verdana" , sans-serif; font-size: 12.0pt;">=</span><span style="color: #ff56ff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">New-AzureStorageContainerStoredAccessPolicy</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt;">-Container</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$container</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt;">-Policy</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$policyname</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt;">-Context</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$storagecontext</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt;">-StartTime</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: red; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$(</span><span style="color: #ff56ff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">Get-Date</span><span style="color: red; font-family: "verdana" , sans-serif; font-size: 12.0pt;">)</span><span style="color: #69ff69; font-family: "verdana" , sans-serif; font-size: 12.0pt;">.</span><span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt;">ToUniversalTime</span><span style="color: red; font-family: "verdana" , sans-serif; font-size: 12.0pt;">()</span><span style="color: #69ff69; font-family: "verdana" , sans-serif; font-size: 12.0pt;">.</span><span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt;">AddMinutes</span><span style="color: red; font-family: "verdana" , sans-serif; font-size: 12.0pt;">(</span><span style="color: #8000ff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">-5</span><span style="color: red; font-family: "verdana" , sans-serif; font-size: 12.0pt;">)</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt;">-ExpiryTime</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: red; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$(</span><span style="color: #ff56ff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">Get-Date</span><span style="color: red; font-family: "verdana" , sans-serif; font-size: 12.0pt;">)</span><span style="color: #69ff69; font-family: "verdana" , sans-serif; font-size: 12.0pt;">.</span><span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt;">ToUniversalTime</span><span style="color: red; font-family: "verdana" , sans-serif; font-size: 12.0pt;">()</span><span style="color: #69ff69; font-family: "verdana" , sans-serif; font-size: 12.0pt;">.</span><span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt;">AddYears</span><span style="color: red; font-family: "verdana" , sans-serif; font-size: 12.0pt;">(</span><span style="color: #8000ff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">1</span><span style="color: red; font-family: "verdana" , sans-serif; font-size: 12.0pt;">)</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt;">-Permission</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: #8aff00; font-family: "verdana" , sans-serif; font-size: 12.0pt;">rwld </span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormalCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .25in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify; text-indent: -.25in;">
<br /></div>
<div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; mso-list: l4 level1 lfo13; tab-stops: list .5in; text-align: justify; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "symbol"; font-size: 10.0pt;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Creating
shared access key and getting container object <o:p></o:p></span></div>
<div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l4 level2 lfo13; tab-stops: list 1.0in; text-align: justify; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "courier new"; font-size: 10.0pt;"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">A
shared access key is required for creating credentials and container object is
required to get URL from container <o:p></o:p></span></div>
<div class="MsoNormalCxSpFirst" style="background: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"># get blob container</span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"> <o:p></o:p></span></div>
<div class="MsoNormalCxSpLast" style="background: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$cbc</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: #69ff69; font-family: "verdana" , sans-serif; font-size: 12.0pt;">=</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$storagecontainer</span><span style="color: #69ff69; font-family: "verdana" , sans-serif; font-size: 12.0pt;">.</span><span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt;">CloudBlobContainer</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<br /></div>
<div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l4 level2 lfo13; tab-stops: list 1.0in; text-align: justify; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "courier new"; font-size: 10.0pt;"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Following
script will copy the script in clipboard <o:p></o:p></span></div>
<div class="MsoNormalCxSpFirst" style="background: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"># Create credentials</span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"> <o:p></o:p></span></div>
<div class="MsoNormalCxSpMiddle" style="background: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$tSql</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: #69ff69; font-family: "verdana" , sans-serif; font-size: 12.0pt;">=</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: #ffb500; font-family: "verdana" , sans-serif; font-size: 12.0pt;">"CREATE
CREDENTIAL [{0}] WITH IDENTITY='Shared Access Signature', SECRET='{1}'"</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: #69ff69; font-family: "verdana" , sans-serif; font-size: 12.0pt;">-f</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$cbc</span><span style="color: #69ff69; font-family: "verdana" , sans-serif; font-size: 12.0pt;">.</span><span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt;">Uri</span><span style="color: #69ff69; font-family: "verdana" , sans-serif; font-size: 12.0pt;">,</span><span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$sharedaccesstoken</span><span style="color: #69ff69; font-family: "verdana" , sans-serif; font-size: 12.0pt;">.</span><span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt;">Substring</span><span style="color: red; font-family: "verdana" , sans-serif; font-size: 12.0pt;">(</span><span style="color: #8000ff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">1</span><span style="color: red; font-family: "verdana" , sans-serif; font-size: 12.0pt;">)</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"><span style="mso-spacerun: yes;"> </span></span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormalCxSpMiddle" style="background: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: #88ffff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">$tSql</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: #69ff69; font-family: "verdana" , sans-serif; font-size: 12.0pt;">|</span><span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;"> </span><span style="color: #ff56ff; font-family: "verdana" , sans-serif; font-size: 12.0pt;">clip </span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<br /></div>
<div class="MsoNormalCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto;">
<span style="color: #b45f06; font-family: "verdana" , sans-serif; font-size: 12.0pt;">Preparation of SQL
Backups <o:p></o:p></span></div>
<div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; mso-list: l4 level1 lfo13; tab-stops: list .5in; text-align: justify; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "symbol"; font-size: 10.0pt;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Create
Credentials <o:p></o:p></span></div>
<div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l4 level2 lfo13; tab-stops: list 1.0in; text-align: justify; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "courier new"; font-size: 10.0pt;"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">In
the previous step we generated CREATE CREDENTIAL script and stored in Clip,
paste the content from clip to SSMS where you wan to run the backup process <o:p></o:p></span></div>
<div class="MsoNormalCxSpFirst" style="background: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;">CREATE CREDENTIAL
[https://1209sa.blob.core.windows.net/1209con] WITH IDENTITY='Shared Access
Signature', </span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormalCxSpLast" style="background: black; line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: white; font-family: "verdana" , sans-serif; font-size: 12.0pt;">SECRET='sv=2017-07-29&sr=c&si=1209policy&sig=XbRBSAQiwkHds2a5vOBR8sM0rKpAQJkLbI3D'</span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"> <o:p></o:p></span></div>
<div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<br /></div>
<div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l4 level2 lfo13; tab-stops: list 1.0in; text-align: justify; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "courier new"; font-size: 10.0pt;"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">To
verify expand the Credentials from Security as you can see below: <o:p></o:p></span></div>
<div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l4 level2 lfo13; tab-stops: list 1.0in; text-align: justify; text-indent: -.25in;">
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><br /></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt; text-decoration: none;"><!--[if gte vml 1]><v:shape id="Picture_x0020_9"
o:spid="_x0000_i1033" type="#_x0000_t75" alt="https://2.bp.blogspot.com/-QUzBKenjcK0/XGTRhBLRzKI/AAAAAAAAe48/dsHlkkMOIgYKOZSNM9X9B0QfSh2CikZ6gCEwYBhgL/s320/3-picture.png"
href="https://2.bp.blogspot.com/-QUzBKenjcK0/XGTRhBLRzKI/AAAAAAAAe48/dsHlkkMOIgYKOZSNM9X9B0QfSh2CikZ6gCEwYBhgL/s1600/3-picture.png"
style='width:240pt;height:149.25pt;visibility:visible;mso-wrap-style:square'
o:button="t">
<v:imagedata src="file:///C:/Users/swarn/AppData/Local/Temp/msohtmlclip1/01/clip_image003.png"
o:title="3-picture"/>
</v:shape><![endif]--><!--[if !vml]--><span style="mso-ignore: vglayout;"></span><!--[endif]--></span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-QUzBKenjcK0/XGTRhBLRzKI/AAAAAAAAe48/dsHlkkMOIgYKOZSNM9X9B0QfSh2CikZ6gCEwYBhgL/s1600/3-picture.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="255" data-original-width="410" height="199" src="https://2.bp.blogspot.com/-QUzBKenjcK0/XGTRhBLRzKI/AAAAAAAAe48/dsHlkkMOIgYKOZSNM9X9B0QfSh2CikZ6gCEwYBhgL/s320/3-picture.png" width="320" /></a></div>
<div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><o:p><br /></o:p></span></div>
<div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; mso-list: l4 level1 lfo13; tab-stops: list .5in; text-align: justify; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "symbol"; font-size: 10.0pt;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Now
add Azure Storage Account in SSMS <o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l4 level2 lfo13; tab-stops: list 1.0in; text-align: justify; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "courier new"; font-size: 10.0pt;"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">SSMS->
Connect-> Azure Storage <o:p></o:p></span></div>
<div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<br /></div>
<div class="MsoNormalCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt; text-decoration: none;"><!--[if gte vml 1]><v:shape id="Picture_x0020_8"
o:spid="_x0000_i1032" type="#_x0000_t75" alt="https://1.bp.blogspot.com/-OapTCB9M-U0/XGTRhK3S6AI/AAAAAAAAe5M/DTuDB6UWTpUqAsXI8K5ISjyV84SszltDwCEwYBhgL/s1600/4-picture.png"
href="https://1.bp.blogspot.com/-OapTCB9M-U0/XGTRhK3S6AI/AAAAAAAAe5M/DTuDB6UWTpUqAsXI8K5ISjyV84SszltDwCEwYBhgL/s1600/4-picture.png"
style='width:238.5pt;height:156.75pt;visibility:visible;mso-wrap-style:square'
o:button="t">
<v:imagedata src="file:///C:/Users/swarn/AppData/Local/Temp/msohtmlclip1/01/clip_image004.png"
o:title="4-picture"/>
</v:shape><![endif]--><!--[if !vml]--><span style="mso-ignore: vglayout;"></span><!--[endif]--></span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormalCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-OapTCB9M-U0/XGTRhK3S6AI/AAAAAAAAe5M/DTuDB6UWTpUqAsXI8K5ISjyV84SszltDwCEwYBhgL/s1600/4-picture.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="209" data-original-width="318" src="https://1.bp.blogspot.com/-OapTCB9M-U0/XGTRhK3S6AI/AAAAAAAAe5M/DTuDB6UWTpUqAsXI8K5ISjyV84SszltDwCEwYBhgL/s1600/4-picture.png" /></a></div>
<br />
<div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l4 level2 lfo13; tab-stops: list 1.0in; text-align: justify; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "courier new"; font-size: 10.0pt;"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Enter
Storage Account Name and Access Key as got from previous steps (or you may get
it from Portal too) <o:p></o:p></span></div>
<div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-Gmb7gOgTze4/XGTRhnqz4nI/AAAAAAAAe5A/9i3BF7VG4AIeG0wb8ffybqwUudjSL3EZACEwYBhgL/s1600/5-picture.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="211" data-original-width="537" height="125" src="https://4.bp.blogspot.com/-Gmb7gOgTze4/XGTRhnqz4nI/AAAAAAAAe5A/9i3BF7VG4AIeG0wb8ffybqwUudjSL3EZACEwYBhgL/s320/5-picture.png" width="320" /></a></div>
<div class="MsoNormalCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt; text-decoration: none;"><!--[if gte vml 1]><v:shape id="Picture_x0020_7"
o:spid="_x0000_i1031" type="#_x0000_t75" alt="https://4.bp.blogspot.com/-Gmb7gOgTze4/XGTRhnqz4nI/AAAAAAAAe5A/9i3BF7VG4AIeG0wb8ffybqwUudjSL3EZACEwYBhgL/s320/5-picture.png"
href="https://4.bp.blogspot.com/-Gmb7gOgTze4/XGTRhnqz4nI/AAAAAAAAe5A/9i3BF7VG4AIeG0wb8ffybqwUudjSL3EZACEwYBhgL/s1600/5-picture.png"
style='width:240pt;height:93.75pt;visibility:visible;mso-wrap-style:square'
o:button="t">
<v:imagedata src="file:///C:/Users/swarn/AppData/Local/Temp/msohtmlclip1/01/clip_image005.png"
o:title="5-picture"/>
</v:shape><![endif]--><!--[if !vml]--><span style="mso-ignore: vglayout;"></span><!--[endif]--></span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormalCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<br /></div>
<div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l4 level2 lfo13; tab-stops: list 1.0in; text-align: justify; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "courier new"; font-size: 10.0pt;"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Getting
from Portal<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-UMgLCByD81M/XGTRiMm16tI/AAAAAAAAe5E/1_9jnAl0wQE4T-605cIldl717NH-rwiAQCEwYBhgL/s1600/6-picture.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="724" data-original-width="1221" height="189" src="https://2.bp.blogspot.com/-UMgLCByD81M/XGTRiMm16tI/AAAAAAAAe5E/1_9jnAl0wQE4T-605cIldl717NH-rwiAQCEwYBhgL/s320/6-picture.png" width="320" /></a></div>
<div class="MsoNormalCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt; text-decoration: none;"><!--[if gte vml 1]><v:shape id="Picture_x0020_6"
o:spid="_x0000_i1030" type="#_x0000_t75" alt="https://2.bp.blogspot.com/-UMgLCByD81M/XGTRiMm16tI/AAAAAAAAe5E/1_9jnAl0wQE4T-605cIldl717NH-rwiAQCEwYBhgL/s400/6-picture.png"
href="https://2.bp.blogspot.com/-UMgLCByD81M/XGTRiMm16tI/AAAAAAAAe5E/1_9jnAl0wQE4T-605cIldl717NH-rwiAQCEwYBhgL/s1600/6-picture.png"
style='width:300pt;height:177pt;visibility:visible;mso-wrap-style:square'
o:button="t">
<v:imagedata src="file:///C:/Users/swarn/AppData/Local/Temp/msohtmlclip1/01/clip_image006.png"
o:title="6-picture"/>
</v:shape><![endif]--><!--[if !vml]--><span style="mso-ignore: vglayout;"></span><!--[endif]--></span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<br /></div>
<div class="MsoNormalCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto;">
<span style="color: #b45f06; font-family: "verdana" , sans-serif; font-size: 12.0pt;">Final Backups to Azure
Storage <o:p></o:p></span></div>
<div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; mso-list: l4 level1 lfo13; tab-stops: list .5in; text-align: justify; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "symbol"; font-size: 10.0pt;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Backups
<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l4 level2 lfo13; tab-stops: list 1.0in; text-align: justify; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "courier new"; font-size: 10.0pt;"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Backup
on Azure Storage is just slightly different from traditional backups on file
system or tape. When taking backups on Azure, you need to select URL as
destination instead of file or tape: <o:p></o:p></span></div>
<div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<br /></div>
<div class="MsoNormalCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt; text-decoration: none;"><!--[if gte vml 1]><v:shape id="Picture_x0020_5"
o:spid="_x0000_i1029" type="#_x0000_t75" alt="https://3.bp.blogspot.com/-QqCa9qpH4GU/XGTRi7IGxBI/AAAAAAAAe5M/hRCw0VwIsp012LqihDbCbyhWBZZhdh6BgCEwYBhgL/s400/7-picture.png"
href="https://3.bp.blogspot.com/-QqCa9qpH4GU/XGTRi7IGxBI/AAAAAAAAe5M/hRCw0VwIsp012LqihDbCbyhWBZZhdh6BgCEwYBhgL/s1600/7-picture.png"
style='width:300pt;height:152.25pt;visibility:visible;mso-wrap-style:square'
o:button="t">
<v:imagedata src="file:///C:/Users/swarn/AppData/Local/Temp/msohtmlclip1/01/clip_image007.png"
o:title="7-picture"/>
</v:shape><![endif]--><!--[if !vml]--><span style="mso-ignore: vglayout;"></span><!--[endif]--></span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt; text-decoration: none;"><br /></span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt; text-decoration: none;"><!--[if gte vml 1]><v:shape id="Picture_x0020_4"
o:spid="_x0000_i1028" type="#_x0000_t75" alt="https://3.bp.blogspot.com/-VU2ZXxVLjXQ/XGTRjOdVV-I/AAAAAAAAe5I/UzN8gBucP7MMhIan4CHpXYlRaGOjWn_JwCEwYBhgL/s400/8-picture.png"
href="https://3.bp.blogspot.com/-VU2ZXxVLjXQ/XGTRjOdVV-I/AAAAAAAAe5I/UzN8gBucP7MMhIan4CHpXYlRaGOjWn_JwCEwYBhgL/s1600/8-picture.png"
style='width:300pt;height:109.5pt;visibility:visible;mso-wrap-style:square'
o:button="t">
<v:imagedata src="file:///C:/Users/swarn/AppData/Local/Temp/msohtmlclip1/01/clip_image008.png"
o:title="8-picture"/>
</v:shape><![endif]--><!--[if !vml]--><span style="mso-ignore: vglayout;"></span><a href="https://3.bp.blogspot.com/-VU2ZXxVLjXQ/XGTRjOdVV-I/AAAAAAAAe5I/UzN8gBucP7MMhIan4CHpXYlRaGOjWn_JwCEwYBhgL/s1600/8-picture.png"><!--[endif]--></a></span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormalCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<br /></div>
<div class="MsoListParagraph" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l4 level2 lfo13; tab-stops: list 1.0in; text-align: justify; text-indent: -.25in;">
<!--[if !supportLists]--><a href="https://www.blogger.com/blogger.g?blogID=3633270974235726205" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"></a><span style="font-family: "courier new"; font-size: 10.0pt;"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Right click on
database (I am using Test database) and select Task -> Backup <o:p></o:p></span></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="MsoNormalCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt; text-decoration: none;"><!--[if gte vml 1]><v:shape id="Picture_x0020_3"
o:spid="_x0000_i1027" type="#_x0000_t75" alt="https://3.bp.blogspot.com/-VU2ZXxVLjXQ/XGTRjOdVV-I/AAAAAAAAe5I/UzN8gBucP7MMhIan4CHpXYlRaGOjWn_JwCEwYBhgL/s320/8-picture.png"
href="https://3.bp.blogspot.com/-VU2ZXxVLjXQ/XGTRjOdVV-I/AAAAAAAAe5I/UzN8gBucP7MMhIan4CHpXYlRaGOjWn_JwCEwYBhgL/s1600/8-picture.png"
style='width:240pt;height:87.75pt;visibility:visible;mso-wrap-style:square'
o:button="t">
<v:imagedata src="file:///C:/Users/swarn/AppData/Local/Temp/msohtmlclip1/01/clip_image009.png"
o:title="8-picture"/>
</v:shape><![endif]--><!--[if !vml]--><span style="mso-ignore: vglayout;"></span><!--[endif]--></span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormalCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<a href="https://3.bp.blogspot.com/-VU2ZXxVLjXQ/XGTRjOdVV-I/AAAAAAAAe5I/UzN8gBucP7MMhIan4CHpXYlRaGOjWn_JwCEwYBhgL/s1600/8-picture.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"></a><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><br /></div>
<div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l4 level2 lfo13; tab-stops: list 1.0in; text-align: justify; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "courier new"; font-size: 10.0pt;"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">From
Back up to option select URL and click on Add </span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-QqCa9qpH4GU/XGTRi7IGxBI/AAAAAAAAe5M/hRCw0VwIsp012LqihDbCbyhWBZZhdh6BgCEwYBhgL/s1600/7-picture.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"></a></div>
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><a href="https://3.bp.blogspot.com/-QqCa9qpH4GU/XGTRi7IGxBI/AAAAAAAAe5M/hRCw0VwIsp012LqihDbCbyhWBZZhdh6BgCEwYBhgL/s1600/7-picture.png" imageanchor="1" style="-webkit-text-stroke-width: 0px; background-color: transparent; color: #0066cc; font-family: Times New Roman; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; margin-left: 16px; margin-right: 16px; orphans: 2; text-align: center; text-decoration: underline; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><img border="0" data-original-height="460" data-original-width="901" height="163" src="https://3.bp.blogspot.com/-QqCa9qpH4GU/XGTRi7IGxBI/AAAAAAAAe5M/hRCw0VwIsp012LqihDbCbyhWBZZhdh6BgCEwYBhgL/s320/7-picture.png" style="cursor: move;" width="320" /></a><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike></span></div>
<div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l4 level2 lfo13; tab-stops: list 1.0in; text-align: justify; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "courier new"; font-size: 10.0pt;"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">The
Dialog box for Selecting Backup Destination would let you select the storage
container that added in previous steps <o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l4 level2 lfo13; tab-stops: list 1.0in; text-align: justify; text-indent: -.25in;">
<!--[if !supportLists]--><a href="https://3.bp.blogspot.com/-VU2ZXxVLjXQ/XGTRjOdVV-I/AAAAAAAAe5I/UzN8gBucP7MMhIan4CHpXYlRaGOjWn_JwCEwYBhgL/s1600/8-picture.png" imageanchor="1" style="-webkit-text-stroke-width: 0px; background-color: transparent; clear: left; color: #0066cc; float: left; font-family: Times New Roman; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 1em; margin-right: 1em; orphans: 2; text-align: center; text-decoration: underline; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><img border="0" data-original-height="200" data-original-width="547" height="117" src="https://3.bp.blogspot.com/-VU2ZXxVLjXQ/XGTRjOdVV-I/AAAAAAAAe5I/UzN8gBucP7MMhIan4CHpXYlRaGOjWn_JwCEwYBhgL/s320/8-picture.png" width="320" /></a><span style="font-family: "courier new"; font-size: 10.0pt;"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Enter
Backup File Name and click on Ok <o:p></o:p></span></div>
<div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l4 level2 lfo13; tab-stops: list 1.0in; text-align: justify; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "courier new"; font-size: 10.0pt;"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";"> </span></span></span><br />
<!--[endif]--><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><br /></span>
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><br /></span>
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><br /></span>
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><br /></span>
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><br /></span>
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">T-SQL
for taking backup on Azure Storage Container is copied below: <o:p></o:p></span></div>
<div class="MsoNormalCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: #0070c0; font-family: "verdana" , sans-serif; font-size: 12.0pt;">BACKUP DATABASE [Test] TO<span style="mso-spacerun: yes;">
</span>URL = N'https://1209sa.blob.core.windows.net/1209con/testbackup.bak'
STATS = 10 <o:p></o:p></span></div>
<div class="MsoNormalCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: #0070c0; font-family: "verdana" , sans-serif; font-size: 12.0pt;">GO <o:p></o:p></span></div>
<div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l4 level2 lfo13; tab-stops: list 1.0in; text-align: justify; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "courier new"; font-size: 10.0pt;"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">If
the command completes successfully you should have your backup posted on Azure
Container <o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; mso-list: l4 level1 lfo13; tab-stops: list .5in; text-align: justify; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "symbol"; font-size: 10.0pt;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">Verify
Backup <o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l4 level2 lfo13; tab-stops: list 1.0in; text-align: justify; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "courier new"; font-size: 10.0pt;"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">You
can verify the backup file from either SSMS->Storage Container or from
Portal itself <o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l4 level2 lfo13; tab-stops: list 1.0in; text-align: justify; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "courier new"; font-size: 10.0pt;"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">From
Portal, Navigate to Resources-> Storage Resource-> Blob-> Container <o:p></o:p></span></div>
<div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-4GPfJPmIVAA/XGTRjvgTtNI/AAAAAAAAe5M/UK-UqAR-iEMiNlN78y-XK9j93jsL9lcOgCEwYBhgL/s1600/9-picture.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="359" data-original-width="626" height="183" src="https://2.bp.blogspot.com/-4GPfJPmIVAA/XGTRjvgTtNI/AAAAAAAAe5M/UK-UqAR-iEMiNlN78y-XK9j93jsL9lcOgCEwYBhgL/s320/9-picture.png" width="320" /></a></div>
<div class="MsoNormalCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: blue; font-family: "verdana" , sans-serif; font-size: 12.0pt; text-decoration: none;"><!--[if gte vml 1]><v:shape id="Picture_x0020_2"
o:spid="_x0000_i1026" type="#_x0000_t75" alt="https://2.bp.blogspot.com/-4GPfJPmIVAA/XGTRjvgTtNI/AAAAAAAAe5M/UK-UqAR-iEMiNlN78y-XK9j93jsL9lcOgCEwYBhgL/s400/9-picture.png"
href="https://2.bp.blogspot.com/-4GPfJPmIVAA/XGTRjvgTtNI/AAAAAAAAe5M/UK-UqAR-iEMiNlN78y-XK9j93jsL9lcOgCEwYBhgL/s1600/9-picture.png"
style='width:300pt;height:171pt;visibility:visible;mso-wrap-style:square'
o:button="t">
<v:imagedata src="file:///C:/Users/swarn/AppData/Local/Temp/msohtmlclip1/01/clip_image010.png"
o:title="9-picture"/>
</v:shape><![endif]--><!--[if !vml]--><span style="mso-ignore: vglayout;"></span><!--[endif]--></span><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><o:p></o:p></span></div>
<div class="MsoNormalCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<br /></div>
<div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l4 level2 lfo13; tab-stops: list 1.0in; text-align: justify; text-indent: -.25in;">
<!--[if !supportLists]--><span style="font-family: "courier new"; font-size: 10.0pt;"><span style="mso-list: Ignore;">o<span style="font: 7.0pt "Times New Roman";">
</span></span></span><!--[endif]--><span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">From
SSMS, Expand Storage Account-> Containers-> Container <o:p></o:p></span></div>
<div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-6xI41xedag8/XGTRgnOEC9I/AAAAAAAAe44/94BdJ7U3Veoyz6uC3UTB7LLS7-vi0ntoQCEwYBhgL/s1600/10-picture.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="83" data-original-width="214" src="https://3.bp.blogspot.com/-6xI41xedag8/XGTRgnOEC9I/AAAAAAAAe44/94BdJ7U3Veoyz6uC3UTB7LLS7-vi0ntoQCEwYBhgL/s1600/10-picture.png" /></a></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<span style="color: #b45f06; font-family: "verdana" , sans-serif;">Conclusion</span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;"><br /></span></div>
<div class="MsoNormalCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; text-align: justify;">
<span style="font-family: "verdana" , sans-serif; font-size: 12.0pt;">You now have your
backup on Azure Cloud and you can restore it from anywhere where there is
internet to connect to cloud. You can restore backups to On-Premises and IaaS
(SQL running on Azure VM). The process to restore is same, you have to follow
the process of creating credentials and adding existing storage to SSMS. <o:p></o:p></span></div>
<div class="MsoNormalCxSpMiddle">
<br /></div>
<br />Swarndeep Singhhttp://www.blogger.com/profile/11550593701026635986noreply@blogger.com1tag:blogger.com,1999:blog-3633270974235726205.post-39132750418802048242019-01-28T12:10:00.002-05:002019-01-28T12:17:46.679-05:00Demo - Azure Logic App and Integration Service<span style="color: #b45f06; font-family: "verdana" , sans-serif; font-size: large;"><br /></span>
<span style="color: #b45f06; font-family: "verdana" , sans-serif; font-size: large;"><br /></span>
<span style="color: #b45f06; font-family: "verdana" , sans-serif; font-size: large;">What is Azure Integration Service</span><br />
<span style="color: #b45f06;"></span><span style="font-family: "verdana" , sans-serif;"></span><span style="font-size: large;"></span><br />
<br />
<div style="margin: 0px 0px 10.66px;">
<span style="font-family: "verdana" , sans-serif;">In modern technology, it has been becoming a common
requirement to have integration between various business processes (services or applications). Often times Solution providers give solutions by embedding
integration within the code like C#, Java etc. Developers have to ensure that besides
integrations, there should be some kind of communication between services, monitoring and security. A good
example could be that an ERP or Order System may be integrated with one of the vendor application.</span></div>
<div style="margin: 0px 0px 10.66px;">
<span style="font-family: "verdana" , sans-serif;">This entire process looks very simple to develop, though it may not be that simple to implement as developing a solution from scratch need planning, coding, triage, testing
and eventually time and money.</span></div>
<div style="margin: 0px 0px 10.66px;">
<span style="font-family: "verdana" , sans-serif;">Many of the application vendors now days expose APIs for data and services, hence making it available to integrate their business processes for data and service utilization. The purpose of Integration Service is to take advantage of APIs and integrate processes.</span></div>
<div style="margin: 0px 0px 10.66px;">
<span style="font-family: "verdana" , sans-serif;">Azure Integration service does exactly the same thing. With Azure Integration, APIs (Rest\SOAP), Service Buses (Messaging Queue) or Events can be utilized to setup Business Workflow using Logic Apps, hence integrating applications. The process and implementation can be broken down to following technologies:</span></div>
<ul>
<li><div style="margin: 0px 0px 10.66px;">
<span style="font-family: "verdana" , sans-serif;">Logic Apps</span></div>
</li>
<li><div style="margin: 0px 0px 10.66px;">
<span style="font-family: "verdana" , sans-serif;">APIs Management</span></div>
</li>
<li><div style="margin: 0px 0px 10.66px;">
<span style="font-family: "verdana" , sans-serif;">Service Bus</span></div>
</li>
<li><div style="margin: 0px 0px 10.66px;">
<span style="font-family: "verdana" , sans-serif;">Event Grid</span></div>
</li>
<li><div style="margin: 0px 0px 10.66px;">
<span style="font-family: "verdana" , sans-serif;">Data Gateway</span></div>
</li>
<li><div style="margin: 0px 0px 10.66px;">
<span style="font-family: "verdana" , sans-serif;">On-Premises Application</span></div>
</li>
</ul>
<div>
<span style="color: #b45f06; font-family: "verdana" , sans-serif;">Logic Apps</span></div>
<div>
<span style="color: #b45f06;"></span><span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<div>
<div style="margin: 0px 0px 10.66px;">
<span style="font-family: "verdana" , sans-serif;">Logic Apps are required to implement the business process or
you may call it process work flow with series of actions. Think of CRM system,
with any update in CRM you may want to send an email or you may want to access
on-premises SQL Server and update it. You may define system to system process,
user to system process, etc. Please note that Logic App is server-less implementation
(platform) i.e. you don’t need to have VM (infrastructure).</span></div>
<b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><span style="font-family: "verdana" , sans-serif;"></span></div>
<div>
<div style="margin: 0px 0px 10.66px;">
<span style="color: #b45f06; font-family: "verdana" , sans-serif;">API Management</span></div>
<div style="margin: 0px 0px 10.66px;">
<span style="font-family: "verdana" , sans-serif;">Most of the modern application vendors expose few of their
APIs externally (REST and SOAP) so that external applications can utilize its
data or services through these APIs. These APIs can be made available though
API Management extension in Azure Portal. </span></div>
<b></b><i></i><u></u><sub></sub><sup></sup><strike></strike>
<br />
<div style="margin: 0px 0px 10.66px;">
<span style="color: #b45f06; font-family: "verdana" , sans-serif;">Service Bus</span></div>
<div style="margin: 0px 0px 10.66px;">
<span style="font-family: "verdana" , sans-serif;">Service Bus is a trigger and important part of application
integration. One way to setup communication between applications is APIs, also
called Synchronous method of communication and in cases where APIs cannot made
available asynchronous approach may be required. This asynchronous way of
communication is called Service Bus. Service Bus essentially an MSMQ type of
service.</span></div>
<div style="margin: 0px 0px 10.66px;">
<span style="color: #b45f06; font-family: "verdana" , sans-serif;">Event Grid</span></div>
<span style="font-size: 11pt; line-height: 107%; margin: 0px;"><span style="font-family: "verdana" , sans-serif;">Event Grid is also a trigger. Instead of setting
up polling for application to check whether any new message has been received,
can be not too useful. Rather receiver can be notified via an event. An event
can be setup to monitor the queue and if a message is arrived then event can
invoke event handler.</span></span></div>
<div>
<b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<div>
<span style="color: #b45f06; font-family: "verdana" , sans-serif;">Data Gateway</span></div>
<div>
<span style="color: #b45f06;"></span><span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<div>
<span style="font-family: "verdana" , sans-serif;">Data Gateway is a tool installed on individual host on-premises to connect on-premises service or application with Azure Integration Service, also called hybrid solution.</span></div>
<div>
<span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<div>
<span style="color: #b45f06; font-family: "verdana" , sans-serif;">On-Premises Application</span></div>
<div>
<span style="color: #b45f06;"></span><span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<div>
<span style="font-family: "verdana" , sans-serif;">On-Premises Application is part of the business process that needs to be integrated, it could be BizTalk server connecting to other sources on Azure using Logic App.</span></div>
<div>
<span style="color: #b45f06;"></span><span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<div>
<span style="color: #b45f06; font-family: "verdana" , sans-serif;">Picture below shows high level architecture of Azure Integration Services</span></div>
<div>
<span style="color: #b45f06;"></span><span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-fohITRuWZYk/XE5_AKAjMiI/AAAAAAAAeao/JtUelq7gCv0BQZzms_0jUqaUB356G6HOQCLcBGAs/s1600/AzureIntegrationService.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: "verdana" , sans-serif;"><img border="0" data-original-height="533" data-original-width="635" height="335" src="https://1.bp.blogspot.com/-fohITRuWZYk/XE5_AKAjMiI/AAAAAAAAeao/JtUelq7gCv0BQZzms_0jUqaUB356G6HOQCLcBGAs/s400/AzureIntegrationService.png" width="400" /></span></a></div>
<div>
<span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<div>
<span style="font-family: "verdana" , sans-serif;">There can be different scenarios where APIs, Events Or Service Buses can be used to integrate. I would like to give a quick demo on how Azure and SQL Database can be integrated. The purpose of the Demo is to create Logic App that continuously monitors if a new file gets added to Drop Box, an entry should be made into Azure SQL Database.</span></div>
<div>
<span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<div>
<span style="font-family: "verdana" , sans-serif;">This demo would require following prerequisites:</span></div>
<div>
<span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<ul>
<li><span style="font-family: "verdana" , sans-serif;">A Drop Box Account</span></li>
<li><span style="font-family: "verdana" , sans-serif;">Azure SQL Database</span></li>
<li><span style="font-family: "verdana" , sans-serif;">Connection String of Azure SQL Database</span></li>
</ul>
<div>
<span style="color: #b45f06; font-family: "verdana" , sans-serif;">First create a Drop Box Account if you don't have already. </span></div>
<div>
<span style="color: #b45f06;"></span><span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<div>
<span style="font-family: "verdana" , sans-serif;">This is common scenario hence I am skipping demo of creating Drop Box Account.</span></div>
<div>
<span style="color: #b45f06;"></span><span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<div>
<span style="color: #b45f06; font-family: "verdana" , sans-serif;">Create Azure SQL Database</span></div>
<div>
<span style="color: #b45f06;"></span><span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<ul>
<li><span style="font-family: "verdana" , sans-serif;">If you already have Azure SQL Database then you can skip this step</span></li>
<li><span style="font-family: "verdana" , sans-serif;">Login to portal.azure.com</span></li>
<li><span style="font-family: "verdana" , sans-serif;">Click on create resource, search for SQL Database resource</span></li>
</ul>
<div>
<span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-dM1WsLLckvk/XE6G0Jz-ZvI/AAAAAAAAejE/2ec1o2MTts84HzFtoZ33WZ-h1VWyzAo4QCEwYBhgL/s1600/SelectResource.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: "verdana" , sans-serif;"><img border="0" data-original-height="327" data-original-width="817" height="256" src="https://4.bp.blogspot.com/-dM1WsLLckvk/XE6G0Jz-ZvI/AAAAAAAAejE/2ec1o2MTts84HzFtoZ33WZ-h1VWyzAo4QCEwYBhgL/s640/SelectResource.png" width="640" /></span></a></div>
</div>
<div>
<span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<ul>
<li><span style="font-family: "verdana" , sans-serif;">After selecting SQL Database resource, click on Create</span></li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-y5ZKN78Tv0k/XE6G0hr-MbI/AAAAAAAAejs/CRseXr0T-mIgPGAyki1D2Rx-fipoGa7HACEwYBhgL/s1600/createdatabase.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: "verdana" , sans-serif;"><img border="0" data-original-height="577" data-original-width="340" height="400" src="https://1.bp.blogspot.com/-y5ZKN78Tv0k/XE6G0hr-MbI/AAAAAAAAejs/CRseXr0T-mIgPGAyki1D2Rx-fipoGa7HACEwYBhgL/s400/createdatabase.png" width="235" /></span></a></div>
<div>
<span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><br />
<div>
<span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><br />
<ul>
<li><span style="font-family: "verdana" , sans-serif;">Enter SQL Database Details and click on create to submit deployment request</span></li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-oazcC0EZ_zo/XE6Gy1-89NI/AAAAAAAAej0/OMb8edySYA0eAC1dTsviMd9BTsyUGWwTQCEwYBhgL/s1600/NewlogicAppDeployment.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: "verdana" , sans-serif;"><img border="0" data-original-height="466" data-original-width="295" height="400" src="https://1.bp.blogspot.com/-oazcC0EZ_zo/XE6Gy1-89NI/AAAAAAAAej0/OMb8edySYA0eAC1dTsviMd9BTsyUGWwTQCEwYBhgL/s400/NewlogicAppDeployment.png" width="252" /></span></a></div>
<div>
<span style="color: #b45f06;"></span><span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<div>
<span style="color: #b45f06; font-family: "verdana" , sans-serif;">Modify Firewall Settings from Azure SQL Database</span></div>
<ul>
<li><span style="font-family: "verdana" , sans-serif;">Once Database gets created, you need to modify database firewall and add client IP of your network so that you could connect to database using SSMS on your machine.</span></li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-kPXe9vH6tA8/XE6GxvaUKLI/AAAAAAAAej4/ZE5Ji2shAhYlrOhXz3UulZMB6c7Sw87ZACEwYBhgL/s1600/EditDatabaseFirewallRule.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: "verdana" , sans-serif;"><img border="0" data-original-height="639" data-original-width="567" height="400" src="https://1.bp.blogspot.com/-kPXe9vH6tA8/XE6GxvaUKLI/AAAAAAAAej4/ZE5Ji2shAhYlrOhXz3UulZMB6c7Sw87ZACEwYBhgL/s400/EditDatabaseFirewallRule.png" width="353" /></span></a></div>
<div>
<span style="color: #b45f06; font-family: "verdana" , sans-serif;">Get Connection Details of SQL Database and create table to save new file record</span></div>
<ul>
<li><span style="font-family: "verdana" , sans-serif;">Now get the connection details of newly created database. For this go to resources and select Database resource, it should open properties and from there you can get Connection details.</span></li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-h2TsYmAE2gU/XE6G2fWFHGI/AAAAAAAAejs/O-tVEaWCSFIDmSvDRxnJO0bvIWj46EWZQCEwYBhgL/s1600/getConnectionDetails.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: "verdana" , sans-serif;"><img border="0" data-original-height="233" data-original-width="1175" height="124" src="https://2.bp.blogspot.com/-h2TsYmAE2gU/XE6G2fWFHGI/AAAAAAAAejs/O-tVEaWCSFIDmSvDRxnJO0bvIWj46EWZQCEwYBhgL/s640/getConnectionDetails.png" width="640" /></span></a></div>
<div>
<span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<div>
<span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<ul>
<li><span style="font-family: "verdana" , sans-serif;">Once you connect to this database from SSMS, create table in this database with following specs</span></li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-Ba89niyUcjk/XE6G1KDp7aI/AAAAAAAAejo/zylZJjyfqq85T9h5p9gO3mVe0FM-uXWkgCEwYBhgL/s1600/createtable.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: "verdana" , sans-serif;"><img border="0" data-original-height="94" data-original-width="282" src="https://3.bp.blogspot.com/-Ba89niyUcjk/XE6G1KDp7aI/AAAAAAAAejo/zylZJjyfqq85T9h5p9gO3mVe0FM-uXWkgCEwYBhgL/s1600/createtable.png" /></span></a></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<span style="color: #b45f06; font-family: "verdana" , sans-serif;">Design Logic App</span><br />
<ul>
<li><span style="font-family: "verdana" , sans-serif;">At this time you will have to start creating the Logic App. Select Logic App resource from resources and click on create.</span></li>
<li><span style="font-family: "verdana" , sans-serif;">Enter basic details of Logic App like Name, Subscription, Group and Location and submit the deployment request</span></li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-oazcC0EZ_zo/XE6Gy1-89NI/AAAAAAAAej0/OMb8edySYA0eAC1dTsviMd9BTsyUGWwTQCEwYBhgL/s1600/NewlogicAppDeployment.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: "verdana" , sans-serif;"><img border="0" data-original-height="466" data-original-width="295" height="400" src="https://1.bp.blogspot.com/-oazcC0EZ_zo/XE6Gy1-89NI/AAAAAAAAej0/OMb8edySYA0eAC1dTsviMd9BTsyUGWwTQCEwYBhgL/s400/NewlogicAppDeployment.png" width="252" /></span></a></div>
<div>
<span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<ul>
<li><span style="font-family: "verdana" , sans-serif;">This should open Logic App Designer. From Designer under choose action, search for DropBox and under Triggers, select When a file is created</span></li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-rFUNM60zY7s/XE6G0KPLbuI/AAAAAAAAejs/F1JXE6Ba754KMOso2e_8XAL1X9xTbik6QCEwYBhgL/s1600/configure_dropboxtrigger.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: "verdana" , sans-serif;"><img border="0" data-original-height="541" data-original-width="598" height="361" src="https://1.bp.blogspot.com/-rFUNM60zY7s/XE6G0KPLbuI/AAAAAAAAejs/F1JXE6Ba754KMOso2e_8XAL1X9xTbik6QCEwYBhgL/s400/configure_dropboxtrigger.png" width="400" /></span></a></div>
<div>
<span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<div>
<span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<div>
<span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<ul>
<li><span style="font-family: "verdana" , sans-serif;">It should ask you to authenticate your dropbox account and also select the root folder.</span></li>
<li><span style="font-family: "verdana" , sans-serif;">After completing dropbox configuration, add new step for SQL Server</span></li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-KFk7TMF78Co/XE6Gxt8-hxI/AAAAAAAAejo/uAGwelzjbksPo2b-YdB_0IDnvG8zrkFLgCEwYBhgL/s1600/EnterSQLDetails_I.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: "verdana" , sans-serif;"><img border="0" data-original-height="670" data-original-width="602" height="400" src="https://4.bp.blogspot.com/-KFk7TMF78Co/XE6Gxt8-hxI/AAAAAAAAejo/uAGwelzjbksPo2b-YdB_0IDnvG8zrkFLgCEwYBhgL/s400/EnterSQLDetails_I.png" width="358" /></span></a></div>
<div>
<span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<div>
<span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<ul>
<li><span style="font-family: "verdana" , sans-serif;">Add SQL Server connection details</span></li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-LvtdgyR_8ZY/XE6GyGb5g0I/AAAAAAAAejk/bneCjeJsrOQUEwAjfJ2UQ9R5MO8jaFnxQCEwYBhgL/s1600/EnterSQLDetails_II.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: "verdana" , sans-serif;"><img border="0" data-original-height="400" data-original-width="609" height="262" src="https://4.bp.blogspot.com/-LvtdgyR_8ZY/XE6GyGb5g0I/AAAAAAAAejk/bneCjeJsrOQUEwAjfJ2UQ9R5MO8jaFnxQCEwYBhgL/s400/EnterSQLDetails_II.png" width="400" /></span></a></div>
<ul>
<li><span style="font-family: "verdana" , sans-serif;">Next select the table name that was created earlier</span></li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-o2YeeXnaTK0/XE6G2lNOlXI/AAAAAAAAej0/6z5LHHQysbwycGA_F5twV8AqtySZlnhhwCEwYBhgL/s1600/selecttable.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: "verdana" , sans-serif;"><img border="0" data-original-height="371" data-original-width="624" height="237" src="https://4.bp.blogspot.com/-o2YeeXnaTK0/XE6G2lNOlXI/AAAAAAAAej0/6z5LHHQysbwycGA_F5twV8AqtySZlnhhwCEwYBhgL/s400/selecttable.png" width="400" /></span></a></div>
<div>
<span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<ul>
<li><span style="font-family: "verdana" , sans-serif;">Next, select parameters FileName and Date.</span></li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-tYfIPd_68KI/XE6Gz-vdmQI/AAAAAAAAejo/KF66LPAzx80ETBMX4zY2-Y8AyKMyWCdjACEwYBhgL/s1600/SelectParameters.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: "verdana" , sans-serif;"><img border="0" data-original-height="268" data-original-width="644" height="133" src="https://4.bp.blogspot.com/-tYfIPd_68KI/XE6Gz-vdmQI/AAAAAAAAejo/KF66LPAzx80ETBMX4zY2-Y8AyKMyWCdjACEwYBhgL/s320/SelectParameters.png" width="320" /></span></a></div>
<ul>
<li><span style="font-family: "verdana" , sans-serif;">Enter parameter details</span></li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-wvE1X7vT4d8/XE6GzStXrEI/AAAAAAAAejw/8pY5uORdElgvxxl_bpedAJYSPN8x-vDmwCEwYBhgL/s1600/SelectFilename.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: "verdana" , sans-serif;"><img border="0" data-original-height="437" data-original-width="1015" height="171" src="https://4.bp.blogspot.com/-wvE1X7vT4d8/XE6GzStXrEI/AAAAAAAAejw/8pY5uORdElgvxxl_bpedAJYSPN8x-vDmwCEwYBhgL/s400/SelectFilename.png" width="400" /></span></a></div>
<div>
<span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<div>
<span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-gJxip9T7uUY/XE6Gxu0KevI/AAAAAAAAejo/T2_zUXEp1f8rphnck7bVBpCLNrC7N3K3wCEwYBhgL/s1600/EnterParameters.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: "verdana" , sans-serif;"><img border="0" data-original-height="249" data-original-width="1065" height="92" src="https://3.bp.blogspot.com/-gJxip9T7uUY/XE6Gxu0KevI/AAAAAAAAejo/T2_zUXEp1f8rphnck7bVBpCLNrC7N3K3wCEwYBhgL/s400/EnterParameters.png" width="400" /></span></a></div>
<div>
<span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<ul>
<li><span style="font-family: "verdana" , sans-serif;">It should be all set, finally review all configurations</span></li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-FwrbTYd6QVI/XE6G10vZtGI/AAAAAAAAejo/KL21Lagix4EkbWMk4DqQFkBlRnaZk4TUwCEwYBhgL/s1600/final_configuration.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: "verdana" , sans-serif;"><img border="0" data-original-height="546" data-original-width="645" height="337" src="https://1.bp.blogspot.com/-FwrbTYd6QVI/XE6G10vZtGI/AAAAAAAAejo/KL21Lagix4EkbWMk4DqQFkBlRnaZk4TUwCEwYBhgL/s400/final_configuration.png" width="400" /></span></a></div>
<ul>
<li><span style="font-family: "verdana" , sans-serif;">Add a file to root folder</span></li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-mbfsnn_B_BE/XE6Nn9UStsI/AAAAAAAAekk/AGpV9k0cal8LHoj3Of1v-Gd3OiuPgPVWgCEwYBhgL/s1600/uploadfiletodropbox.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: "verdana" , sans-serif;"><img border="0" data-original-height="465" data-original-width="801" height="231" src="https://1.bp.blogspot.com/-mbfsnn_B_BE/XE6Nn9UStsI/AAAAAAAAekk/AGpV9k0cal8LHoj3Of1v-Gd3OiuPgPVWgCEwYBhgL/s400/uploadfiletodropbox.png" width="400" /></span></a></div>
<span style="font-family: "verdana" , sans-serif;"></span><br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<span style="color: #b45f06; font-family: "verdana" , sans-serif;">Verify that Logic App is working as designed</span><br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<ul>
<li><span style="font-family: "verdana" , sans-serif;">Execute the Logic App manually, it should execute anyways as per schedule as well</span></li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-cPKWcKnniQY/XE6Nh5eFk7I/AAAAAAAAeks/djnhNxG98M47kSoRaI2rRZnpzcHAsj5ogCEwYBhgL/s1600/ExecuteLogicApp.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: "verdana" , sans-serif;"><img border="0" data-original-height="109" data-original-width="711" height="61" src="https://2.bp.blogspot.com/-cPKWcKnniQY/XE6Nh5eFk7I/AAAAAAAAeks/djnhNxG98M47kSoRaI2rRZnpzcHAsj5ogCEwYBhgL/s400/ExecuteLogicApp.png" width="400" /></span></a></div>
<ul>
<li><span style="font-family: "verdana" , sans-serif;">Now if you go back to SQL and look at the table content it should have new file names and date new file was observed as per UTC time.</span></li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://1.bp.blogspot.com/-oDwajsO7k8Y/XE6Nh1igFCI/AAAAAAAAeks/3wPWG0VeLj46-08Xg2492zeROrbhbQ4DgCEwYBhgL/s1600/resultinsql.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: "verdana" , sans-serif;"><img border="0" data-original-height="179" data-original-width="270" src="https://1.bp.blogspot.com/-oDwajsO7k8Y/XE6Nh1igFCI/AAAAAAAAeks/3wPWG0VeLj46-08Xg2492zeROrbhbQ4DgCEwYBhgL/s1600/resultinsql.png" /></span></a></div>
<div>
<span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<div>
<span style="font-family: "verdana" , sans-serif;"></span><br /></div>
<div>
<span style="font-family: "verdana" , sans-serif;">This is all, you now have Azure Logic App monitoring your drop box and adding an entry in SQL if there is a new file found.</span></div>
Swarndeep Singhhttp://www.blogger.com/profile/11550593701026635986noreply@blogger.com0tag:blogger.com,1999:blog-3633270974235726205.post-58692591674646806732019-01-26T12:47:00.002-05:002019-01-28T12:12:12.094-05:00Python Multithreading and automation demonstration for DBAs<span style="font-family: "verdana" , sans-serif;">A few weeks ago, I started moving my SQL Server automation scripts from Power Shell to Python to add some data analysis capabilities. Just to give some background, I am responsible for 100s of servers and collect data from remote hosts worldwide and copy at centralized location in order to process it to get useful insights like monitoring, performance analysis, capacity planning etc.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Along with re-writing scripts, the motive was also to improve the scripts as the module was connecting to each remote server in iteration, it used to take very long time before it could complete the data processing.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">I decided to optimize my scripts by taking advantage of multi threading in Python while connecting to remote hosts in parallel. I also would like to point out a function from psycopg2.extras module called execute_values and it can make use of LIST that can be passed directly to function in case there are multiple rows and statements and saving you from writing loop.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Before demonstration, I would like to show facts how much time I saved using this approach in numbers comparing traditional method with Thread model:</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Without thread, the process used to take 45 seconds</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-rSO9Gt5eJqQ/XEtYicI8VlI/AAAAAAAAeYc/jvGWuLqxGa0pHTmOcj5KNGev3JpSuRSiQCLcBGAs/s1600/withoutthread.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: "verdana" , sans-serif;"><img border="0" data-original-height="79" data-original-width="529" height="47" src="https://2.bp.blogspot.com/-rSO9Gt5eJqQ/XEtYicI8VlI/AAAAAAAAeYc/jvGWuLqxGa0pHTmOcj5KNGev3JpSuRSiQCLcBGAs/s320/withoutthread.png" width="320" /></span></a></div>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">With thread, same process took only 761 milliseconds, a 60 times improvement</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-x1Cfxk4bt5U/XEtYnRCmHhI/AAAAAAAAeYg/Sz-dsVLKSgQ8fVpPB8GdOzm4UY_fn3vXwCLcBGAs/s1600/withthread.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: "verdana" , sans-serif;"><img border="0" data-original-height="63" data-original-width="431" height="46" src="https://4.bp.blogspot.com/-x1Cfxk4bt5U/XEtYnRCmHhI/AAAAAAAAeYg/Sz-dsVLKSgQ8fVpPB8GdOzm4UY_fn3vXwCLcBGAs/s320/withthread.png" width="320" /></span></a></div>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><br /></span><span style="font-family: "verdana" , sans-serif;">I am demonstrating one of my set of scripts that is responsible to get the list of databases from remote SQL Servers. As I am using threading in the demo, need to import module called threading, then map the function with thread object and finally start the thread.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<b><span style="color: #b45f06; font-family: "verdana" , sans-serif;">File Name: refreshDatabases.py</span></b><br />
<span style="font-family: "verdana" , sans-serif;"><b><span style="color: #b45f06;">Purpose:</span> </b>This is the main class to sync databases:</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="color: #b45f06; font-family: "verdana" , sans-serif;"><b>First need to import the modules required for this script:</b></span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<br />
<blockquote class="tr_bq">
<span style="font-family: "verdana" , sans-serif;">import json</span><br />
<span style="font-family: "verdana" , sans-serif;">import psycopg2</span><br />
<span style="font-family: "verdana" , sans-serif;">import psycopg2.extras as ex</span><br />
<span style="font-family: "verdana" , sans-serif;">import datetime</span><br />
<span style="font-family: "verdana" , sans-serif;">import sys</span><br />
<span style="font-family: "verdana" , sans-serif;">import threading</span><br />
<span style="font-family: "verdana" , sans-serif;"># Following modules are manually written separately just for the purpose of reusing objects: </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "verdana" , sans-serif;">import sqlRequestInJson</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "verdana" , sans-serif;">from pgdatabase import cursorfromconnectionpool as pgconnectionpool, Database as pgdatabase</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "verdana" , sans-serif;">from pgconnectionstring import connectionstring as pgconnectionstring</span></blockquote>
<span style="color: #b45f06; font-family: "verdana" , sans-serif;"><b>Next, get list of all IP addresses and ports of remote hosts to connect to.</b></span><br />
<blockquote class="tr_bq">
<span style="font-family: "verdana" , sans-serif;">class getdata:</span><br />
<span style="font-family: "verdana" , sans-serif;"><span style="white-space: pre;"> </span>def __init__(self):</span><br />
<span style="font-family: "verdana" , sans-serif;"><span style="white-space: pre;"> </span>self.query="select sl.ipaddress , sl.name , sl.serverid, sl.port from serverslist sl"</span><br />
<span style="font-family: "verdana" , sans-serif;"><span style="white-space: pre;"> </span>def return_serverlist(self):</span><br />
<span style="font-family: "verdana" , sans-serif;"><span style="white-space: pre;"> </span>cs = pgconnectionstring() # following line of code is using psycopg2 through a class written in different file, I am doing it to hide user name and passwords</span><br />
<span style="font-family: "verdana" , sans-serif;"><span style="white-space: pre;"> </span>pgdatabase.initialize(user=cs.user, password=cs.password, database=cs.database, host=cs.host)</span><br />
<span style="font-family: "verdana" , sans-serif;"> # Get servers list</span><br />
<span style="font-family: "verdana" , sans-serif;"><span style="white-space: pre;"> </span>with pgconnectionpool() as cursor:</span><br />
<span style="font-family: "verdana" , sans-serif;"><span style="white-space: pre;"> </span>cursor.execute(self.query)</span><br />
<span style="font-family: "verdana" , sans-serif;"><span style="white-space: pre;"> </span>result = cursor.fetchall()</span><br />
<span style="font-family: "verdana" , sans-serif;"><span style="white-space: pre;"> </span>return result</span></blockquote>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="color: #b45f06; font-family: "verdana" , sans-serif;"><b>This is the main working class that would collect and save data in tables</b></span><br />
<blockquote class="tr_bq">
<span style="font-family: "verdana" , sans-serif;">class update:</span><br />
<span style="font-family: "verdana" , sans-serif;"> # empty initialize class</span><br />
<span style="font-family: "verdana" , sans-serif;"> def __init__(self):</span><br />
<span style="font-family: "verdana" , sans-serif;"> pass</span><br />
<span style="font-family: "verdana" , sans-serif;"> # following function retuns cursor from postgres</span><br />
<span style="font-family: "verdana" , sans-serif;"> def updateData(self, script):</span><br />
<span style="font-family: "verdana" , sans-serif;"> cs = pgconnectionstring()</span><br />
<span style="font-family: "verdana" , sans-serif;"> pgdatabase.initialize(user=cs.user, password=cs.password, database=cs.database, host=cs.host)</span><br />
<span style="font-family: "verdana" , sans-serif;"> with pgconnectionpool() as cursor:</span><br />
<span style="font-family: "verdana" , sans-serif;"> cursor.execute(script)</span><br />
<span style="font-family: "verdana" , sans-serif;"> # Following would call the fuction return_serverlist defined in the class above to get list of servers to be connected to</span><br />
<span style="font-family: "verdana" , sans-serif;"> def returnRows(self): #self, serverid, serverip, name): </span><br />
<span style="font-family: "verdana" , sans-serif;"> gd=getdata()</span><br />
<span style="font-family: "verdana" , sans-serif;"> return gd.return_serverlist()</span><br />
<span style="font-family: "verdana" , sans-serif;"> # This is the thread function, this would create thread based on number of servers to be connected to</span><br />
<span style="font-family: "verdana" , sans-serif;"> def updateDatabasesThread(self, rows):</span><br />
<span style="font-family: "verdana" , sans-serif;"> # Empty thread list</span><br />
<span style="font-family: "verdana" , sans-serif;"> threadlist=[]</span><br />
<span style="font-family: "verdana" , sans-serif;"> for request in rows: </span><br />
<span style="font-family: "verdana" , sans-serif;"> lst=list(request['ipaddress'])</span><br />
<span style="font-family: "verdana" , sans-serif;"> # removing "\" from ip address as psycopg2 does not like "\", rather will provide port number for connection.</span><br />
<span style="font-family: "verdana" , sans-serif;"> if lst.count('\\')>0:</span><br />
<span style="font-family: "verdana" , sans-serif;"> lst=lst[0:request['ipaddress'].find('\\')]</span><br />
<span style="font-family: "verdana" , sans-serif;"> request['ipaddress']=''.join(lst)</span><br />
<span style="font-family: "verdana" , sans-serif;"> # The threading function takes paraters like fuction and arguments to be referencedd by each thread</span><br />
<span style="font-family: "verdana" , sans-serif;"> t=threading.Thread(target=self.updateDatabases, args=(request['serverid'], request['ipaddress'], request['port'],))</span><br />
<span style="font-family: "verdana" , sans-serif;"> # Adding thread to the list</span><br />
<span style="font-family: "verdana" , sans-serif;"> threadlist.append(t)</span><br />
<span style="font-family: "verdana" , sans-serif;"> # start the thread</span><br />
<span style="font-family: "verdana" , sans-serif;"> for thread in threadlist:</span><br />
<span style="font-family: "verdana" , sans-serif;"> try:</span><br />
<span style="font-family: "verdana" , sans-serif;"> thread.start()</span><br />
<span style="font-family: "verdana" , sans-serif;"> except:</span><br />
<span style="font-family: "verdana" , sans-serif;"> e="{}".format(sys.exc_info())</span><br />
<span style="font-family: "verdana" , sans-serif;"> print(e)</span><br />
<span style="font-family: "verdana" , sans-serif;"> # Following function will get database name from sql server and then would save into postgres</span><br />
<span style="font-family: "verdana" , sans-serif;"> def updateDatabases (self, serverid, ipaddr, port):</span><br />
<span style="font-family: "verdana" , sans-serif;"> currentDT = str(datetime.datetime.utcnow())</span><br />
<span style="font-family: "verdana" , sans-serif;"> sqlreq=sqlRequestInJson.sqlrequests()</span><br />
<span style="font-family: "verdana" , sans-serif;"> # get data from SQL Server and adding result to result variable</span><br />
<span style="font-family: "verdana" , sans-serif;"> result=sqlreq.execsql(ipaddr, "select name from sys.databases", port)</span><br />
<span style="font-family: "verdana" , sans-serif;"> cs = pgconnectionstring()</span><br />
<span style="font-family: "verdana" , sans-serif;"> pgdatabase.initialize(user=cs.user, password=cs.password, database=cs.database, host=cs.host)</span><br />
<span style="font-family: "verdana" , sans-serif;"> with pgconnectionpool() as cursor:</span><br />
<span style="font-family: "verdana" , sans-serif;"> dblist=[]</span><br />
<span style="font-family: "verdana" , sans-serif;"> for row in result['result']:</span><br />
<span style="font-family: "verdana" , sans-serif;"> try:</span><br />
<span style="font-family: "verdana" , sans-serif;"> values=(row['name'], serverid)</span><br />
<span style="font-family: "verdana" , sans-serif;"> # append database name and serverid in list to be used later with execute_values</span><br />
<span style="font-family: "verdana" , sans-serif;"> dblist.append(values)</span><br />
<span style="font-family: "verdana" , sans-serif;"> except:</span><br />
<span style="font-family: "verdana" , sans-serif;"> e="{}".format(sys.exc_info())</span><br />
<span style="font-family: "verdana" , sans-serif;"> print(e)</span><br />
<span style="font-family: "verdana" , sans-serif;"> # Following line of code will insert data into postgres, without using loop as it takes list that will be passed to insert values by function itself</span><br />
<span style="font-family: "verdana" , sans-serif;"> ex.execute_values(cursor,'insert into rtm.databases(databasename, serverid) values %s on conflict(serverid, databasename) DO NOTHING', dblist)</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "verdana" , sans-serif;"># finally put all together</span><br />
<span style="font-family: "verdana" , sans-serif;"># creating object from class</span><br />
<span style="font-family: "verdana" , sans-serif;">upd= update()</span><br />
<span style="font-family: "verdana" , sans-serif;"># return data from function</span><br />
<span style="font-family: "verdana" , sans-serif;">rows=upd.returnRows()</span><br />
<span style="font-family: "verdana" , sans-serif;">#Start thread</span><br />
<span style="font-family: "verdana" , sans-serif;">print("Started {}" .format(str(datetime.datetime.utcnow())))</span><br />
<span style="font-family: "verdana" , sans-serif;">upd.updateDatabasesThread(rows)</span><br />
<span style="font-family: "verdana" , sans-serif;">print("Ended {}" .format(str(datetime.datetime.utcnow())))</span></blockquote>
<span style="font-family: "verdana" , sans-serif;"> </span><br />
<span style="font-family: "verdana" , sans-serif;">As mentioned above about writing classes separately, Python is an Object Oriented scripting language, thus I created multiple classes in separate files to re-use the code and these are the supporting python class files to be used in the script above:</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<b><span style="color: #b45f06; font-family: "verdana" , sans-serif;">File Name: pgconnectionstring.py:</span></b><br />
<span style="font-family: "verdana" , sans-serif;"><span style="color: #b45f06;"><b>Purpose</b>:</span> save credentials in separate class and use these as properties in connection strings wherever needed</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<br />
<blockquote class="tr_bq">
<span style="font-family: "verdana" , sans-serif;">class connectionstring:</span><br />
<span style="font-family: "verdana" , sans-serif;"> def __init__(self):</span><br />
<span style="font-family: "verdana" , sans-serif;"> self.user="user"</span><br />
<span style="font-family: "verdana" , sans-serif;"> self.password="password"</span><br />
<span style="font-family: "verdana" , sans-serif;"> self.database="dbname"</span><br />
<span style="font-family: "verdana" , sans-serif;"> self.host="ip\hostname with port"</span></blockquote>
<b><span style="font-family: "verdana" , sans-serif;"><br /></span></b>
<b><span style="color: #b45f06; font-family: "verdana" , sans-serif;">File Name: pgdatabase.py</span></b><br />
<span style="font-family: "verdana" , sans-serif;"><b><span style="color: #b45f06;">Purpose:</span> </b>This class returns the data from Postgres in Data Dictionary format:</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<br />
<blockquote class="tr_bq">
<span style="font-family: "verdana" , sans-serif;">from psycopg2 import pool</span><br />
<span style="font-family: "verdana" , sans-serif;">from psycopg2 import extras</span><br />
<span style="font-family: "verdana" , sans-serif;">import psycopg2</span><br />
<span style="font-family: "verdana" , sans-serif;">class Database:</span><br />
<span style="font-family: "verdana" , sans-serif;"> connection_pool=None;</span><br />
<span style="font-family: "verdana" , sans-serif;"> @classmethod</span><br />
<span style="font-family: "verdana" , sans-serif;"> def initialize(cls,**kwargs):</span><br />
<span style="font-family: "verdana" , sans-serif;"> Database.connection_pool=psycopg2.connect(**kwargs);</span><br />
<span style="font-family: "verdana" , sans-serif;"> @classmethod</span><br />
<span style="font-family: "verdana" , sans-serif;"> def get_connection(cls):</span><br />
<span style="font-family: "verdana" , sans-serif;"> #return cls.__connectionpool.getconn();</span><br />
<span style="font-family: "verdana" , sans-serif;"> return cls.connection_pool;</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">class cursorfromconnectionpool:</span><br />
<span style="font-family: "verdana" , sans-serif;"> </span><br />
<span style="font-family: "verdana" , sans-serif;"> def __init__(self):</span><br />
<span style="font-family: "verdana" , sans-serif;"> self.connection = None</span><br />
<span style="font-family: "verdana" , sans-serif;"> </span><br />
<span style="font-family: "verdana" , sans-serif;"> def __enter__(self):</span><br />
<span style="font-family: "verdana" , sans-serif;"> self.connection=Database.connection_pool</span><br />
<span style="font-family: "verdana" , sans-serif;"> </span><br />
<span style="font-family: "verdana" , sans-serif;"> self.cursor = self.connection.cursor(cursor_factory=psycopg2.extras.DictCursor)</span><br />
<span style="font-family: "verdana" , sans-serif;"> return self.cursor</span><br />
<span style="font-family: "verdana" , sans-serif;"> </span><br />
<span style="font-family: "verdana" , sans-serif;"> def __exit__(self, exc_type, exc_val, exc_tb):</span><br />
<span style="font-family: "verdana" , sans-serif;"> if exc_val is not None:</span><br />
<span style="font-family: "verdana" , sans-serif;"> self.connection.rollback();</span><br />
<span style="font-family: "verdana" , sans-serif;"> else:</span><br />
<span style="font-family: "verdana" , sans-serif;"> self.cursor.close()</span><br />
<span style="font-family: "verdana" , sans-serif;"> self.connection.commit()</span></blockquote>
<span style="font-family: "verdana" , sans-serif;"> </span><br />
<span style="font-family: "verdana" , sans-serif;"> </span><br />
<span style="color: #b45f06; font-family: "verdana" , sans-serif;"><b>File Name: sqlRequestInJson</b>.py</span><br />
<span style="font-family: "verdana" , sans-serif;"><b><span style="color: #b45f06;">Purpose:</span> </b>This class returns the data from SQL in Data Dictionary format:</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<br />
<blockquote class="tr_bq">
<span style="font-family: "verdana" , sans-serif;">import pymssql</span><br />
<span style="font-family: "verdana" , sans-serif;">import sys</span><br />
<span style="font-family: "verdana" , sans-serif;">class sqlrequests:</span><br />
<span style="font-family: "verdana" , sans-serif;"> def execsql(self, server, script, port):</span><br />
<span style="font-family: "verdana" , sans-serif;"> </span><br />
<span style="font-family: "verdana" , sans-serif;"> try:</span><br />
<span style="font-family: "verdana" , sans-serif;"> connection=pymssql.connect(user='user', password='xxxx', database='mydb', host=server, as_dict=True,login_timeout=30, timeout=30, port=port)</span><br />
<span style="font-family: "verdana" , sans-serif;"> connection.autocommit(True)</span><br />
<span style="font-family: "verdana" , sans-serif;"> with connection.cursor() as cursor:</span><br />
<span style="font-family: "verdana" , sans-serif;"> cursor.execute(script)</span><br />
<span style="font-family: "verdana" , sans-serif;"> result=cursor.fetchall()</span><br />
<span style="font-family: "verdana" , sans-serif;"> connection.close()</span><br />
<span style="font-family: "verdana" , sans-serif;"> # instead of returning direct data, I am returning json data with result in result key and message in message key, this will be useful to read the exception from calling class</span><br />
<span style="font-family: "verdana" , sans-serif;"> return {'result':result,'message':'nothing'}</span><br />
<span style="font-family: "verdana" , sans-serif;"> except:</span><br />
<span style="font-family: "verdana" , sans-serif;"> e="{}".format(sys.exc_info())</span><br />
<span style="font-family: "verdana" , sans-serif;"> e=e.replace("'","*")</span><br />
<span style="font-family: "verdana" , sans-serif;"> # as metioned in comment above, following line of code will return exception to calling class instead of simply crashing</span><br />
<span style="font-family: "verdana" , sans-serif;"> return {'result':'exception','message':e}</span></blockquote>
<span style="font-family: "verdana" , sans-serif;">This demonstration involves multiple database servers including Microsoft SQL Server and Postgres. In order to execute this, you will have to create one table in one of the Postgres server where data will be stored. The table in Postgres database should have at least table with this spec: </span><span style="font-family: "verdana" , sans-serif;">select sl.ipaddress , sl.name , sl.serverid, sl.port from serverslist sl</span>Swarndeep Singhhttp://www.blogger.com/profile/11550593701026635986noreply@blogger.com0tag:blogger.com,1999:blog-3633270974235726205.post-60775842316607658632018-12-04T17:32:00.000-05:002018-12-04T17:32:02.105-05:00Background Intelligent Transfer Service - BITS<span style="font-family: Verdana;">BITS or Background Intelligent Transfer Service has been available for many years with Windows Servers, it is generally considered only as a background service for Web Servers, Application, etc., though it can be used by System Administrator, IT Administrators or DBAs too. As a Database Professional I find it very useful thus I would like to share a demo of this service. The purpose of BITS is simple, transfer files between source and destination with fault tolerance capabilities.</span><br />
<span style="font-family: Verdana;">Making it easy to use, BITS cmdlets are available with PowerShell too. The purpose of BITS as written on Microsoft Documentation gives more insight on its capabilities:</span><br />
<blockquote>
<span style="font-family: Verdana;">Background Intelligent Transfer Service (BITS) is used by programmers and system administrators to download files from or upload files to HTTP web servers and SMB file shares. BITS will take the cost of the transfer into consideration, as well as the network usage so that the user's foreground work has as little impact as possible. BITS also handles network interruptions, pausing and automatically resuming transfers, even after a reboot. BITS includes PowerShell cmdlets for creating and managing transfers as well as the BitsAdmin command-line utility.</span></blockquote>
<span style="font-family: Verdana;">Here is quick guide on using BITS with PowerShell:</span><br />
<span style="font-family: Verdana;"><br /></span>
<b><span style="color: #d19049; font-family: Verdana;">Importing Module in PowerShell</span></b><br />
<ul>
<li><span style="font-family: Verdana;">This will be a good practice to run PowerShell with elevated rights (Right Click and Run as administrator) or run in same security context each time, otherwise there may be inconsistencies as some of the resources may not be available.</span></li>
<li><span style="font-family: Verdana;">Once Powershell Opens, execute Import-Module BitsTransfer</span></li>
<li><span style="font-family: Verdana;">You should not get any message or prompt if Import was successful</span></li>
</ul>
<blockquote>
<a href="https://lh3.googleusercontent.com/-UKPcVAqnjA0/XAVjbOZNdsI/AAAAAAAAdPI/Z5lTCQYRhnUdvW05XKPE2R9HPm8_NGjOwCHMYCw/s1600-h/image%255B3%255D"><span style="font-family: Verdana;"><img alt="image" border="0" height="53" src="https://lh3.googleusercontent.com/-oyT-eJ3oo9M/XAVjcGK_c5I/AAAAAAAAdPM/RLeEjf72Bp0ENjJUZyFaPPppnO3K2eYuACHMYCw/image_thumb%255B1%255D?imgmax=800" style="background-image: none; display: inline;" title="image" width="459" /></span></a></blockquote>
<ul>
<li><span style="font-family: Verdana;">This demonstration has been tested with PowerShell Version 4 and 5. You may verify the version by executing $psversiontable.psversion from PS prompt.</span></li>
</ul>
<b><span style="color: #d19049; font-family: Verdana;">Pre-Requisites before starting transfer</span></b><br />
<ul>
<li><span style="font-family: Verdana;">Obviously you would need to know the source and destination locations and file to be transfer. Also make sure both locations are accessible from PS prompt.</span></li>
<li><span style="font-family: Verdana;">BITS provides two types of transfer modes, Synchronous and Asynchronous. </span></li>
<ul>
<li><span style="font-family: Verdana;">In Asynchronous mode BITS job will be registered and pointer will be returned to prompt, job will continue in background by service. </span></li>
<li><span style="font-family: Verdana;">In Synchronous mode, BITS job will be registered and pointer will not be returned to prompt unless transfer completes.</span></li>
</ul>
</ul>
<b><span style="color: #d19049; font-family: Verdana;">Limitation</span></b><br />
<ul>
<li><span style="font-family: Verdana;">The only major limitation with BITS is that it can only be run if user’s session is active, i.e. BITS commands cannot be scheduled by schedulers such as SQL Agent, Task Scheduler, etc., with only exception that user can disconnect the session without logging off from the Windows Session and the process will continue. If this restriction is removed then this will become my favorite file transfer utility.</span></li>
</ul>
<b><span style="color: #d19049; font-family: Verdana;">Cmdlets</span></b><br />
<ul>
<li><span style="font-family: Verdana;">To start\initiate transfer: <strong><em>start-BitsTransfer</em></strong> –Source [sourcepath] –Destination [DestinationLocation] –Asynchronous [If not specified then it becomes Synchronous]</span></li>
<li><span style="font-family: Verdana;">To pause transfer: <strong><em>suspend-BitsTransfer</em></strong> </span></li>
<li><span style="font-family: Verdana;">To resume transfer: <strong><em>resume-BitsTransfer</em></strong></span></li>
<li><span style="font-family: Verdana;">To modify existing transfer: <strong><em>set-BitsTransfer</em></strong></span></li>
<li><span style="font-family: Verdana;">To get existing transfer jobs: <strong><em>get-BitsTransfer</em></strong></span></li>
<li><span style="font-family: Verdana;">To stop\terminate transfer: <strong><em>remove-BitsTransfer</em></strong> </span></li>
<li><span style="font-family: Verdana;">To complete the transfer job:<strong> complete-BitsTransfer</strong></span></li>
</ul>
<b><span style="color: #d19049; font-family: Verdana;">Demonstration</span></b><br />
<ul>
<li><span style="font-family: Verdana;">To demonstrate, I will transfer a 800 GB file using BITS as shown in the image below and will use some of the commonly used parameters as well as will get more useful details out of the job.</span></li>
</ul>
<blockquote>
<a href="https://lh3.googleusercontent.com/-5erusdXVFqo/XAWPJ7O3nkI/AAAAAAAAdPc/rlCEfPm4PlggwahQXS7ycGD_PzuUHd1eQCHMYCw/s1600-h/image%255B13%255D"><span style="font-family: Verdana;"><img alt="image" border="0" height="531" src="https://lh3.googleusercontent.com/-9NsP_20senQ/XAWPKtVaQlI/AAAAAAAAdPg/wODz-U365M0uGZoV6bwYSQp5dxBNJRMbwCHMYCw/image_thumb%255B7%255D?imgmax=800" style="background-image: none; display: inline;" title="image" width="599" /></span></a></blockquote>
<span style="font-family: Verdana;"><br /></span>
<ul>
<li><span style="font-family: Verdana;">The source and destination are “C:\demo\source\SSMS-Setup-ENU.exe” and “\\swarns\demo\destination\” respectively</span></li>
</ul>
<span style="font-family: Verdana;"><br /></span>
<strong><span style="font-family: Verdana;">Starting Transfer in Asynchronous mode</span></strong><br />
<ul>
<li><em><span style="font-family: Verdana;">import-module bitstransfer</span></em></li>
<li><em><em><span style="font-family: Verdana;">start-bitsTransfer -Source "C:\demo\source\SSMS-Setup-ENU.exe" –Destination “\\swarns\demo\destination” –Asynchronous</span></em></em></li>
</ul>
<blockquote>
<em><em><em><a href="https://lh3.googleusercontent.com/-UDoTJtiXHAQ/XAWPLdbypcI/AAAAAAAAdPk/mOlGBYarPF4AUEQPXH8_s5pQ0NfNJxolwCHMYCw/s1600-h/image%255B17%255D"><span style="font-family: Verdana;"><img alt="image" border="0" height="165" src="https://lh3.googleusercontent.com/-xV2cygvBZM0/XAWPM1jxPhI/AAAAAAAAdPo/48e5Dl8OsO8YjOG2Jh_ueaMpaPiZjhlZwCHMYCw/image_thumb%255B9%255D?imgmax=800" style="background-image: none; display: inline;" title="image" width="669" /></span></a></em></em></em></blockquote>
<ul>
<li><span style="font-family: Verdana;">The image above shows the job has been registered and current job status as Connecting</span></li>
</ul>
<span style="font-family: Verdana;"><br /></span>
<strong><span style="font-family: Verdana;">Suspending the job</span></strong><br />
<ul>
<li><span style="font-family: Verdana;">I have intentionally suspended this job so that I can read properties of this job before copy finishes, to do that the cmdlet is suspend-bitstransfer</span></li>
<li><span style="font-family: Verdana;">To suspend you need to provide jobid as a parameter in two different ways, first is using PIPE and other is using variable. I am going to use PIPE and first need jobid</span></li>
<ul>
<li><em><span style="font-family: Verdana;">get-bitstransfer | select jobid</span></em></li>
</ul>
</ul>
<blockquote>
<a href="https://lh3.googleusercontent.com/-oYjs_Bk8Clw/XAWPNr3wsUI/AAAAAAAAdPs/esV4wnCx0G0HjJsrhr0Fe1x_wq-x3EELQCHMYCw/s1600-h/image%255B21%255D"><span style="font-family: Verdana;"><img alt="image" border="0" height="92" src="https://lh3.googleusercontent.com/-hAITHVjHCAA/XAWPOnvvaeI/AAAAAAAAdPw/IaoSuIs3Lsw1PNPn7x2AePpXXsl8i9NsACHMYCw/image_thumb%255B11%255D?imgmax=800" style="background-image: none; display: inline;" title="image" width="485" /></span></a></blockquote>
<ul><ul>
<li><em><span style="font-family: Verdana;">get-BitsTransfer -jobid 1c6eaea9-efb5-4e1c-bae9-64b79b5d8433 | suspend-BitsTransfer</span></em></li>
</ul>
</ul>
<em><span style="font-family: Verdana;"><br /></span></em>
<strong><span style="font-family: Verdana;">Reading BITS properties in easily readable format</span></strong><br />
<ul>
<li><span style="font-family: Verdana;">I have intentionally suspended this job so that I can read properties of this job before copy finishes, to do that the cmdlet is suspend-bitstransfer</span></li>
<li><em><span style="font-family: Verdana;">get-BitsTransfer -jobid 1c6eaea9-efb5-4e1c-bae9-64b79b5d8433 | select *</span></em></li>
</ul>
<blockquote>
<a href="https://lh3.googleusercontent.com/-KK-VkMFGJ7o/XAWPPeIrmGI/AAAAAAAAdP0/eQY8swYlpSEtM3Jq8Ddpw2Gw6lXlUakjQCHMYCw/s1600-h/image%255B33%255D"><span style="font-family: Verdana;"><img alt="image" border="0" height="403" src="https://lh3.googleusercontent.com/-3-a_HiPEm5s/XAWPRl2oyKI/AAAAAAAAdP4/WIG9oNDZyxY8k5l_-tjk6b-qjwHCsGzOwCHMYCw/image_thumb%255B19%255D?imgmax=800" style="background-image: none; display: inline;" title="image" width="859" /></span></a></blockquote>
<ul>
<li><span style="font-family: Verdana;">The image above shows basic output of command and this can be formatted to get more usable </span></li>
<li><span style="font-family: Verdana;">I have used the following scriptIf you want to test the following script, please write the following scriptlet in single line, I have intentionally divided the scriptlet at each Pipe to make it readable</span></li>
<ul>
<li><em><span style="font-family: Verdana;">Get-BitsTransfer -jobid 1c6eaea9-efb5-4e1c-bae9-64b79b5d8433 </span></em></li>
<li><em><span style="font-family: Verdana;">| SELECT *, @{name='Xferred_percent';expr={$_.BytesTransferred/$_.BytesTotal*100}}, @{name='Minutes'; expr={((Get-Date)-$_.creationtime).TotalMinutes}} </span></em></li>
<li><em><span style="font-family: Verdana;">|SELECT @{name='BytesPerMinute';expr={$_.BytesTransferred/$_.Minutes}}, @{name='EtaInMinutes';expr={$_.Minutes/$_.BytesTransferred*($_.BytesTotal-$_.BytesTransferred)}}, * </span></em></li>
<li><em><span style="font-family: Verdana;">| SELECT @{name='CompletionEstimate';expr={(Get-Date).AddMinutes($_.EtaInMinutes)}}, Xferred_percent, Minutes, BytesPerMinute, JobState | Format-Table</span></em></li>
</ul>
</ul>
<blockquote>
<a href="https://lh3.googleusercontent.com/-VW9gm1tcjKI/XAbklvUacbI/AAAAAAAAdSo/sSzMaKPHvq4sujZ5wV901b92bCb3cx6MACHMYCw/s1600-h/image%255B37%255D"><span style="font-family: Verdana;"><img alt="image" border="0" height="167" src="https://lh3.googleusercontent.com/-9fTjmO47zUo/XAbkm3h-CzI/AAAAAAAAdSs/GaQmbEA_SCkS6Eqpeju5SBEQJlKoQBm5ACHMYCw/image_thumb%255B21%255D?imgmax=800" style="background-image: none; display: inline;" title="image" width="912" /></span></a></blockquote>
<ul>
<li><span style="font-family: Verdana;">The script above may sound little bit complex, but let me simplify it below:</span></li>
<ul>
<li><span style="font-family: Verdana;">A PIPE “|” is used to pass the value to next cmdlet or expression, to define an expression, a hashtable “@{}” is used with name and expr tags. Calculations can be performed in expr tag. Next PIPE can access the expr by refering to name defined in hashtable.</span></li>
</ul>
</ul>
<blockquote>
<a href="https://lh3.googleusercontent.com/-1ZM2pRMtZMA/XAb_BkKW9PI/AAAAAAAAdTw/PgomaY1gmVkuQ85unLTdiNnb7bE_yyM4ACHMYCw/s1600-h/image%255B42%255D"><span style="font-family: Verdana;"></span></a><span style="font-family: Verdana;"><a href="https://lh3.googleusercontent.com/-ThM_HyY4Jl4/XAb_DOqfBxI/AAAAAAAAdT0/PLCzad8P1GsctBgL80OS9Zf5j1HVVj6EQCHMYCw/s1600-h/image%255B44%255D"><img alt="image" border="0" height="161" src="https://lh3.googleusercontent.com/-ZAB_NzsCAbI/XAbkrkgN6MI/AAAAAAAAdS4/bentipRpWGwILjeokg61MqhBMuoTtkxzgCHMYCw/image_thumb%255B26%255D?imgmax=800" style="background-image: none; display: inline;" title="image" width="1573" /></a></span></blockquote>
<strong><span style="font-family: Verdana;">Last Step</span></strong><br />
<ul>
<li><span style="font-family: Verdana;">To resume the suspended job, the cmdlet will be <em>get-BitsTransfer -jobid 1c6eaea9-efb5-4e1c-bae9-64b79b5d8433 | resume-BitsTransfer –Asynchronous #Optional</em></span></li>
<li><span style="font-family: Verdana;">Once transfer completes, if you started job with Asynchronous file transfer, this would require you to manually complete the job by issuing <em>get-BitsTransfer -jobid 1c6eaea9-efb5-4e1c-bae9-64b79b5d8433 | remove-BitsTransfer </em></span></li>
</ul>
<blockquote>
<a href="https://lh3.googleusercontent.com/-1CCuYI0UaFw/XAbksd2px0I/AAAAAAAAdS8/MdZwi1mznQ4RwIHiPfFkvzq6VhbaiIAqACHMYCw/s1600-h/image%255B48%255D"><img alt="image" border="0" height="50" src="https://lh3.googleusercontent.com/-Ia6nG8Ckt94/XAbktHgBbuI/AAAAAAAAdTA/1GxRgQGWBBc6sn7QWASnFOH-yAHyDZuSwCHMYCw/image_thumb%255B28%255D?imgmax=800" style="background-image: none; display: inline;" title="image" width="857" /></a><br />
<br /></blockquote>
<b><span style="color: #d19049; font-family: Verdana;">Finally</span></b><br />
<blockquote>
<span style="font-family: Verdana;">This service is robust, runs very well, I never got into any issues after transferring bunch of files. I have used robocopy too for many transfers, but could not read transfer statistics asynchronously. At the same time the inability to use BITS if user did not login, reduces its usage for many. I wish if there was no such restriction. Thanks for reading this article, please leave your comments if you find it useful.</span></blockquote>
<blockquote>
<strong><span style="color: #d19049; font-family: Verdana;"><br /></span></strong></blockquote>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
Swarndeep Singhhttp://www.blogger.com/profile/11550593701026635986noreply@blogger.com0tag:blogger.com,1999:blog-3633270974235726205.post-81569099813663485052018-11-05T17:29:00.000-05:002018-11-06T11:05:45.732-05:00Git and GitHub for Version Control on Windows<span style="font-family: "verdana";">Git is Version Control System also known as VCS that you install on your local machine and use it to check in, check out, commit your code just like any other VCS like TFS. However, in case of multiple developers working together can upload or merge their changes in centralized location called GitHub (also, can have in house Git Server).</span><br />
<span style="font-family: "verdana";">Here is quick guide on using Git with GitHub.</span><br />
<span style="font-family: "verdana";"><br /></span>
<span style="font-family: "verdana";"><br /></span>
<b><span style="color: #d19049; font-family: "verdana"; font-size: medium;">Getting Git for Windows</span></b><br />
<ul>
<li><span style="font-family: "verdana";">Git for Windows can be downloaded from </span><a href="https://gitforwindows.org/"><span style="font-family: "verdana";">https://gitforwindows.org</span></a></li>
</ul>
<blockquote>
<a href="https://lh3.googleusercontent.com/-6v8RkNO_D_s/W-Cz6VTtv1I/AAAAAAAAcpc/p-BEf9NmyOwQ2vK6FjQGwQin7NSbNK7cgCHMYCw/s1600-h/image%255B3%255D"><span style="font-family: "verdana";"><img alt="image" border="0" height="148" src="https://lh3.googleusercontent.com/-hGTNduHU5Bw/W-Cz7HWHfrI/AAAAAAAAcpg/yBRh18C9O8QLlOBDq4oyFBN3dddIapnqgCHMYCw/image_thumb%255B1%255D?imgmax=800" style="background-image: none; display: inline;" title="image" width="260" /></span></a><br />
<span style="font-family: "verdana";"><br /></span></blockquote>
<ul>
<li><span style="font-family: "verdana";">Go through the installation process after downloading</span></li>
</ul>
<blockquote>
<span style="font-family: "verdana";"><br /></span>
<a href="https://lh3.googleusercontent.com/-IVaJvtKebtI/W-DAHkBQNWI/AAAAAAAAcpw/TGlJKDG9T54vplKuBvOpHWNX0hgVtcGWgCHMYCw/s1600-h/image%255B7%255D"><span style="font-family: "verdana";"><img alt="image" border="0" height="303" src="https://lh3.googleusercontent.com/-5ZjwTAsCImA/W-DAIDG4gwI/AAAAAAAAcp0/8WsNqCwniWQsBBSiaqnVQhekJAw5LYD_wCHMYCw/image_thumb%255B3%255D?imgmax=800" style="background-image: none; display: inline;" title="image" width="390" /></span></a><br />
<span style="font-family: "verdana";"><br /></span></blockquote>
<ul>
<li><span style="font-family: "verdana";">By default Git Bash and GUI will be integrated with Windows Explorer, but can be disabled while installing.</span></li>
</ul>
<blockquote>
<a href="https://lh3.googleusercontent.com/-tNGvj1I_hzM/W-DAI0kRCvI/AAAAAAAAcp4/XFmZHo_qBIIocKReidjdSNu8d5KxR1K0gCHMYCw/s1600-h/image%255B11%255D"><span style="font-family: "verdana";"><img alt="image" border="0" height="305" src="https://lh3.googleusercontent.com/-_ukv6eaVJMc/W-DAJacpxgI/AAAAAAAAcp8/xh33UTc3078yaRkdaWJt_Zos50k2D1WpgCHMYCw/image_thumb%255B5%255D?imgmax=800" style="background-image: none; display: inline;" title="image" width="397" /></span></a><br />
<span style="font-family: "verdana";"><br /></span></blockquote>
<ul>
<li><span style="font-family: "verdana";">You may keep default options during installation process, default options would work for most of users.</span></li>
</ul>
<span style="font-family: "verdana";"><br /></span>
<b><span style="color: #d19049; font-family: "verdana"; font-size: medium;">Setting up GitHub Account and Settings</span></b><br />
<ul>
<li><span style="font-family: "verdana";">Open </span><a href="https://github.com/" title="https://github.com/"><span style="font-family: "verdana";">https://github.com/</span></a><span style="font-family: "verdana";"> and create your account or Login if you already have account.</span></li>
<li><span style="font-family: "verdana";">You have to add a project on GitHub where you would be creating repositories, each project can have multiple repositories and branches</span></li>
</ul>
<blockquote>
<a href="https://lh3.googleusercontent.com/-6drRhVIcOxA/W-DAKOYRdoI/AAAAAAAAcqA/dooMkgNMhCUO9OBpiu3zOrYe7JkHM-aigCHMYCw/s1600-h/image%255B18%255D"><span style="font-family: "verdana";"><img alt="image" border="0" height="355" src="https://lh3.googleusercontent.com/-MFKFIhYUP_I/W-DAK8L2mBI/AAAAAAAAcqE/oWynyEk0-IQ9eYyaD4fJ26Mja3tv2woTwCHMYCw/image_thumb%255B8%255D?imgmax=800" style="background-image: none; display: inline;" title="image" width="427" /></span></a></blockquote>
<ul>
<li><span style="font-family: "verdana";">Click on create repository to add and commit repository immediately.</span></li>
</ul>
<span style="color: #d19049; font-family: "verdana";"><strong>Adding files to repository</strong></span><br />
<ul>
<li><span style="font-family: "verdana";">You may directly add files and folders to GitHub using Web Portal GUI or by using CLI also known as Git Bash. </span></li>
<li><span style="font-family: "verdana";">Git bash was installed as part of Git installation.</span></li>
</ul>
<span style="color: #d19049; font-family: "verdana";"><strong>Adding files from Web Portal GUI</strong></span><br />
<ul>
<li><span style="font-family: "verdana";">Adding files from Web Portal is very simple, you may simply Upload or Create New file. </span></li>
<li><span style="font-family: "verdana";">Also, note that using Git Hub does not require you to install Git for Windows as it is completely web based. </span></li>
<li><span style="font-family: "verdana";">You would get option to Upload or Create New file as soon as you go into Repository as shown below:</span></li>
</ul>
<blockquote>
<a href="https://lh3.googleusercontent.com/-yqOQvNsmr6U/W-DALUIWo9I/AAAAAAAAcqI/TZ-xTfXIjeMW2r7vPr8dHsqGp-jReMGsACHMYCw/s1600-h/image%255B23%255D"><span style="font-family: "verdana";"><img alt="image" border="0" height="393" src="https://lh3.googleusercontent.com/-hZJIEKVk8y4/W-DAMJYpFTI/AAAAAAAAcqM/9VNS5vRkWC034JAX-Fx4puMME76RwZk0QCHMYCw/image_thumb%255B11%255D?imgmax=800" style="background-image: none; display: inline;" title="image" width="686" /></span></a><br />
<span style="font-family: "verdana";"><br /></span></blockquote>
<ul>
<li><span style="font-family: "verdana";">Once you select the file(s) as shown above, the file(s) should be committed</span></li>
</ul>
<blockquote>
<a href="https://lh3.googleusercontent.com/-kBrJ8jp3aaQ/W-DAMi4YbCI/AAAAAAAAcqQ/3gkVZpk-qXstH68vrkZZGhpt0-Pj_rg2gCHMYCw/s1600-h/image%255B27%255D"><span style="font-family: "verdana";"><img alt="image" border="0" height="445" src="https://lh3.googleusercontent.com/-ixfgC_h2Tug/W-DANEiRCVI/AAAAAAAAcqU/PYctGhL10DMIWAawHCWLSsARkwjIy0QIgCHMYCw/image_thumb%255B13%255D?imgmax=800" style="background-image: none; display: inline;" title="image" width="599" /></span></a></blockquote>
<ul>
<li><span style="font-family: "verdana";">Add comments to commit and press Commit Changes to apply changes, this will complete the check in process using URL or Web Portal of GitHub.</span></li>
</ul>
<span style="color: #d19049; font-family: "verdana";"><strong>Adding files using Git Bash</strong></span><br />
<span style="color: #d19049; font-family: "verdana";"><strong><br /></strong></span>
<span style="font-family: "verdana";">This process first requires you to create Clone of Repository from GitHub to local and then make your changes in local repository, once done then you can upload your changes to GitHub using Git Bash. Step by step process is given below.</span><br />
<ul>
<li><span style="font-family: "verdana";">Open Git Bash program. (Git Bash accepts linux like commands, for example: cd, pwd, ls, etc.)</span></li>
<ul><ul>
<li><span style="font-family: "verdana"; font-size: xx-small;">If you would like to change current directory to C drive then command will be “cd /c”</span></li>
<li><span style="font-family: "verdana"; font-size: xx-small;">Same way if you would like to see content of current directory then command is “ls”</span></li>
<li><span style="font-family: "verdana"; font-size: xx-small;">To get current directory (aka Working Directory) path the command “pwd”</span></li>
</ul>
</ul>
<li><span style="font-family: "verdana";">The first step requires to clone the repository from GitHub.</span></li>
<li><span style="font-family: "verdana";">In this demonstration the directory used to keep clone is c:\github hence the command to change directory will be “cd /c/github”. </span></li>
</ul>
<blockquote>
<a href="https://lh3.googleusercontent.com/-YSc8kgjDtN8/W-DAN2YnXHI/AAAAAAAAcqY/scDCZQ5V3u4ylY6SmlbJCxvSmotz8QIywCHMYCw/s1600-h/image%255B31%255D"><span style="font-family: "verdana";"><img alt="image" border="0" height="254" src="https://lh3.googleusercontent.com/-Ux3-uOKhLHg/W-DAOSGvhUI/AAAAAAAAcqc/qQt1MtT-LzUp16Q4Ya4XMYR0fICcsGDvwCHMYCw/image_thumb%255B15%255D?imgmax=800" style="background-image: none; display: inline;" title="image" width="560" /></span></a></blockquote>
<ul>
<li><span style="font-family: "verdana";">Also you would require git URL of your repository. You may get git URL from github repository page, by selecting option Clone or download as per screenshot below</span></li>
</ul>
<blockquote>
<a href="https://lh3.googleusercontent.com/-CY7kC__3jhY/W-DAOxxZjFI/AAAAAAAAcqg/oAJ0GnEV8IINPAVOHEtDTLt5twn4C4-PQCHMYCw/s1600-h/image%255B49%255D"><span style="font-family: "verdana";"><img alt="image" border="0" height="207" src="https://lh3.googleusercontent.com/-pOTCzH1Yxpk/W-DAPqC0JXI/AAAAAAAAcqk/Ln7MPn1E6bIkQPBCLdO5ZZCHX6ZZwwYDQCHMYCw/image_thumb%255B22%255D?imgmax=800" style="background-image: none; display: inline;" title="image" width="585" /></span></a></blockquote>
<span style="font-family: "verdana";"><br /></span>
<br />
<ul>
<li><span style="font-family: "verdana";">Make sure that you are in working directory where you want to clone the Repository and execute git clone command “git clone [git URL]”</span></li>
</ul>
<blockquote>
<a href="https://lh3.googleusercontent.com/-ChjoMI6U7dA/W-DAQauhQEI/AAAAAAAAcqo/OCAecbn96V0H2n5Yaz7Q-8HVwe3S_jJ8gCHMYCw/s1600-h/image%255B54%255D"><span style="font-family: "verdana";"><img alt="image" border="0" height="291" src="https://lh3.googleusercontent.com/-X6LxSG1iqk4/W-DAQ_sLEkI/AAAAAAAAcqs/ofScBhGEGZEU33gdlpNmSqRaG1lpXBaMACHMYCw/image_thumb%255B25%255D?imgmax=800" style="background-image: none; display: inline;" title="image" width="453" /></span></a><br />
<span style="font-family: "verdana";"><br /></span></blockquote>
<ul>
<li><span style="font-family: "verdana";">Git will use your current identity (Login name or ID) against changes and activities you would perform, you may want to change it to your preferred user name using config command. </span></li>
<li><span style="font-family: "verdana";">If you add global switch to config command the changes will be applied to all repositories, otherwise changes will be applied to current repository only.</span></li>
</ul>
<blockquote>
<a href="https://lh3.googleusercontent.com/-gfxYfgSmT8c/W-DARRjactI/AAAAAAAAcqw/0_hMVFclx7Y0sbWRPWB32W7cqFWXhR3lgCHMYCw/s1600-h/image%255B58%255D"><span style="font-family: "verdana";"><img alt="image" border="0" height="104" src="https://lh3.googleusercontent.com/-CDRNuS3m_Bw/W-DAR69DQ8I/AAAAAAAAcq0/5gt_SmC--XUtLaO46qAnq-sjUAb_n1PZACHMYCw/image_thumb%255B27%255D?imgmax=800" style="background-image: none; display: inline;" title="image" width="467" /></span></a></blockquote>
<ul>
<li><span style="font-family: "verdana";">Global config below</span></li>
</ul>
<blockquote>
<a href="https://lh3.googleusercontent.com/-VcHnT05SUhw/W-DASk2-zgI/AAAAAAAAcq4/gUJ6V_JXcsUAdEYBua4ukjK479j3_1EVACHMYCw/s1600-h/image%255B62%255D"><span style="font-family: "verdana";"><img alt="image" border="0" height="59" src="https://lh3.googleusercontent.com/-C3E8_rrrDA8/W-DATBp1guI/AAAAAAAAcq8/kCtCxFMGCpUS6qQbs-2k7zQZELj_zWoXgCHMYCw/image_thumb%255B29%255D?imgmax=800" style="background-image: none; display: inline;" title="image" width="444" /></span></a></blockquote>
<ul>
<li><span style="font-family: "verdana";">Before you could make changes like adding files etc. you will have to checkout the repository. In previous steps you cloned the repository.</span></li>
<li><span style="font-family: "verdana";">Command to checkout repository is “git checkout master” (master is main copy and you can create branches from master, for example development or test branch)</span></li>
</ul>
<blockquote>
<a href="https://lh3.googleusercontent.com/-SM9CUMITjqo/W-DAT7U-I0I/AAAAAAAAcrA/DeIR5tpleY4bxl4xQWpILyIIelWtqvnRgCHMYCw/s1600-h/image%255B66%255D"><span style="font-family: "verdana";"><img alt="image" border="0" height="69" src="https://lh3.googleusercontent.com/-IGkpF5bwQRo/W-DAUUvwkxI/AAAAAAAAcrE/AKTKOqL0qt8jIlBeaqxEbqsTZyNdWMj9gCHMYCw/image_thumb%255B31%255D?imgmax=800" style="background-image: none; display: inline;" title="image" width="450" /></span></a></blockquote>
<ul>
<li><span style="font-family: "verdana";">Now you can add files to the working directory or create new, once done add file(s) to repository “git add [filename]”</span></li>
</ul>
<blockquote>
<a href="https://lh3.googleusercontent.com/-4vHCfjaWm8E/W-DAVKVj5QI/AAAAAAAAcrI/14AAMCh_B-YCdNULyc0ZDsVwxfurfmnqgCHMYCw/s1600-h/image%255B70%255D"><span style="font-family: "verdana";"><img alt="image" border="0" height="47" src="https://lh3.googleusercontent.com/-Gvo5KqE_2HU/W-DAVheivDI/AAAAAAAAcrM/z0lnxzk9zlM_NQY52it3so72JcinlYNcwCHMYCw/image_thumb%255B33%255D?imgmax=800" style="background-image: none; display: inline;" title="image" width="450" /></span></a></blockquote>
<ul>
<li><span style="font-family: "verdana";">The next step is to commit changes in local repository using command “git commit –m “comments”</span></li>
</ul>
<blockquote>
<a href="https://lh3.googleusercontent.com/-LVAW7FKyhAY/W-DAWX5JpnI/AAAAAAAAcrQ/lEe66wKD_xsDoyTESxPXm5mBk7q7z2JjQCHMYCw/s1600-h/image%255B74%255D"><span style="font-family: "verdana";"><img alt="image" border="0" height="36" src="https://lh3.googleusercontent.com/-5bF_SMZQaLo/W-DAXLSEodI/AAAAAAAAcrU/mHrXrN8lvVYznls3tuRw_xInOX_OM9qzQCHMYCw/image_thumb%255B35%255D?imgmax=800" style="background-image: none; display: inline;" title="image" width="459" /></span></a></blockquote>
<ul>
<li><span style="font-family: "verdana";">The final step in the process is to push the changes and the command is “git push”</span></li>
</ul>
<blockquote>
<a href="https://lh3.googleusercontent.com/-mz9SrzxtaCM/W-DAX6td7EI/AAAAAAAAcrY/zRg0CxidFhIp_NK56FZDrBLrbOWXXIOLACHMYCw/s1600-h/image%255B78%255D"><span style="font-family: "verdana";"><img alt="image" border="0" height="144" src="https://lh3.googleusercontent.com/-nsytLFDD5cw/W-DAY2ZX5qI/AAAAAAAAcrc/YGslItiiXLgp66ZQ8k-U9_IBGb6pdFTOACHMYCw/image_thumb%255B37%255D?imgmax=800" style="background-image: none; display: inline;" title="image" width="463" /></span></a></blockquote>
<ul>
<li><span style="font-family: "verdana";">To validate, you may go to Git Hub URL and you should see latest changes you made from Git Bash.</span></li>
</ul>
<blockquote>
<a href="https://lh3.googleusercontent.com/-SgU2s4uhT-4/W-DAZXamvyI/AAAAAAAAcrg/NYBKVjYplFIcZVocRNjOlVz_cXhYR2zmACHMYCw/s1600-h/image%255B82%255D"><span style="font-family: "verdana";"><img alt="image" border="0" height="155" src="https://lh3.googleusercontent.com/-2NJRMceBw4s/W-DAaG2VXbI/AAAAAAAAcrk/7MxwjgJJxjMOrVHQn_L3IPJ_9g1zckEqQCHMYCw/image_thumb%255B39%255D?imgmax=800" style="background-image: none; display: inline;" title="image" width="703" /></span></a></blockquote>
<blockquote>
<span style="font-family: "verdana";"><br /></span></blockquote>
<blockquote>
<span style="font-family: "verdana";"><br /></span></blockquote>
<blockquote>
<span style="font-family: "verdana";"><br /></span></blockquote>
<span style="font-family: "verdana";"></span><br />
<span style="font-family: "verdana";"></span><br />
<span style="font-family: "verdana";"></span><br />
<span style="font-family: "verdana";"></span><br />
<span style="font-family: "verdana";"></span><br />
<span style="font-family: "verdana";"></span><br />
<span style="font-family: "verdana";"></span><br />
<span style="font-family: "verdana";"></span><br />
<br />Swarndeep Singhhttp://www.blogger.com/profile/11550593701026635986noreply@blogger.com0Suwanee, GA 30024, USA34.0514898 -84.071299733.9462428 -84.2326612 34.1567368 -83.9099382tag:blogger.com,1999:blog-3633270974235726205.post-86110080610017819972017-02-25T13:57:00.001-05:002017-03-02T14:08:31.451-05:00SQL Server TDE (Data at Rest Encryption)<span style="color: #b45f06; font-family: "verdana" , sans-serif;"><b><br /></b></span>
<span style="color: #b45f06; font-family: "verdana" , sans-serif;"><span style="color: black;"><iframe allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/fF57RqmlEBQ?ecver=1" width="560"></iframe></span></span><br />
<span style="color: #b45f06; font-family: "verdana" , sans-serif;"><span style="color: black;"><br /></span></span>
<span style="color: #b45f06; font-family: "verdana" , sans-serif;"><b><br /></b></span>
<span style="color: #b45f06; font-family: "verdana" , sans-serif;"><b>What is TDE ?</b></span><br />
<span style="font-family: "verdana" , sans-serif;"><b><br /></b></span>
<span style="font-family: "verdana" , sans-serif;">Transparent Data Encryption (TDE) is used by Microsoft, Oracle, and other Database provider companies to encrypt data files. This solves the compliance issue generally known as Data at Rest Encryption.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">TDE was first introduced by Microsoft with SQL Server 2008. TDE is available with Evaluation, Developer and Enterprise Editions only. (Also Datacenter Editions in some older versions).</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="color: #b45f06; font-family: "verdana" , sans-serif;"><b>How TDE works ?</b></span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">With TDE Database Files are encrypted, hence, prevents the Data Files from exploitation if data files or backups are copied out with bad intentions. </span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="color: #b45f06; font-family: "verdana" , sans-serif;"><b>Some Facts about TDE</b></span><br />
<br />
<ul>
<li><span style="font-family: "verdana" , sans-serif;">During Backup, if compression is enabled, it cannot take much advantage from compression due to the encryption.</span></li>
<li><span style="font-family: "verdana" , sans-serif;">If any of the database is encrypted on an instance, TempDB is anyways encrypted.</span></li>
<li><span style="font-family: "verdana" , sans-serif;">TDE only encrypts Data at Rest. Data in Motion, Data in Transit or Data in Memory is not encrypted.</span></li>
<li><span style="font-family: "verdana" , sans-serif;">Any File groups which are Read-Only, won't be encrypted, hence TDE implementation will fail.</span></li>
<li><span style="font-family: "verdana" , sans-serif;">Once TDE is enabled, Mirroring or Log Shipped databases on the other side will also need be encrypted as TDE keeps Transaction Logs Encrypted.</span></li>
<li><span style="font-family: "verdana" , sans-serif;">Even though the Certificate Expires, it still encrypts database. Certificate Expiration is more of compliance related and you can set custom expiry date with EXPIRY_DATE option while creating the certificate, by default it is a year.</span></li>
</ul>
<br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><b><span style="color: #b45f06;">Encryption Hierarchy</span> <span style="font-size: xx-small;">(https://msdn.microsoft.com/en-us/library/bb934049.aspx)</span></b></span><br />
<br />
<ul>
<li><span style="font-family: "verdana" , sans-serif;">Encryption Hierarchy starts with Windows level Data Protection API (DPAPI). During the setup or installation of SQL Server Instance, the Service Master Key is encrypted with DPAPI. </span></li>
<li><span style="font-family: "verdana" , sans-serif;">Service Master Encrypts the Database Master Key on Master database.</span></li>
<li><span style="font-family: "verdana" , sans-serif;">Using Database Master key, a Certificate on Master Database is created. </span></li>
<li><span style="font-family: "verdana" , sans-serif;">The Certificate on Master Database is used by all other databases on same instance to create Database Encryption Key (DEK). </span></li>
<li><span style="font-family: "verdana" , sans-serif;">Finally the DEK is used to Encrypt the entire User Database.</span></li>
</ul>
<br />
<span style="color: #b45f06; font-family: "verdana" , sans-serif;"><b>Implementing TDE</b></span><br />
<br />
<ol>
<li><i style="font-family: Verdana, sans-serif;">Create Master Key on Master Database</i></li>
<li><i style="font-family: Verdana, sans-serif;">Create Certificate protected by Master Key on Master Database</i></li>
<li><i style="font-family: Verdana, sans-serif;">Create Database Encryption Key using Certificate on User Database that has to be encrypted</i></li>
<li><i style="font-family: Verdana, sans-serif;">Change the Database Option setting to Encryption</i></li>
<li><i style="font-family: Verdana, sans-serif;">Backup Certificate and Private Key at safe place (optional but recommended)</i></li>
</ol>
<br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="color: #b45f06; font-family: "verdana" , sans-serif;"><b>Demo</b></span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><i><b>Create Master Key</b></i></span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="color: blue; font-family: "verdana" , sans-serif;">Use Master</span><br />
<span style="color: blue; font-family: "verdana" , sans-serif;">Go</span><br />
<span style="color: blue; font-family: "verdana" , sans-serif;">Create Master Key</span><br />
<span style="color: blue; font-family: "verdana" , sans-serif;">Encryption By Password ='@$trongPa$$word@'</span><br />
<span style="color: blue; font-family: "verdana" , sans-serif;">Go</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><i><b>Create Certificate</b></i></span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="color: blue; font-family: "verdana" , sans-serif;">use master</span><br />
<span style="color: blue; font-family: "verdana" , sans-serif;">Go</span><br />
<span style="color: blue; font-family: "verdana" , sans-serif;">create Certificate TDE_CERT</span><br />
<span style="color: blue; font-family: "verdana" , sans-serif;">WITH SUBJECT ='TDE Certificate'</span><br />
<span style="color: blue; font-family: "verdana" , sans-serif;">Go</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><i><b>Create DEK </b>(Database Encryption Key) </i>using the certificate created in last step. This step has to be run on the database where the TDE has to be enabled</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="color: blue; font-family: "verdana" , sans-serif;">Use myDB</span><br />
<span style="color: blue; font-family: "verdana" , sans-serif;">Go</span><br />
<span style="color: blue; font-family: "verdana" , sans-serif;">Create Database Encryption Key</span><br />
<span style="color: blue; font-family: "verdana" , sans-serif;">with algorithm = AES_256</span><br />
<span style="color: blue; font-family: "verdana" , sans-serif;">Encryption By Server Certificate TDE_CERT;</span><br />
<span style="color: blue; font-family: "verdana" , sans-serif;">GO</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><i>Finally <b>Enable TDE</b> for the database</i></span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="color: blue; font-family: "verdana" , sans-serif;">use master</span><br />
<span style="color: blue; font-family: "verdana" , sans-serif;">Go</span><br />
<span style="color: blue; font-family: "verdana" , sans-serif;">Alter database myDB</span><br />
<span style="color: blue; font-family: "verdana" , sans-serif;">Set encryption on</span><br />
<span style="color: blue; font-family: "verdana" , sans-serif;">Go</span><br />
<span style="color: blue; font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">You can check the status of encryption by using DMV: sys.dm_database_encryption_keys</span><br />
<span style="color: blue; font-family: "verdana" , sans-serif;"><br /></span>
<span style="color: blue; font-family: "verdana" , sans-serif;">select encryption_state, percent_complete, * from sys.dm_database_encryption_keys</span><br />
<span style="color: blue; font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Encryption_States:</span><br />
<span style="font-family: "verdana" , sans-serif;">0 - No Encryption</span><br />
<span style="font-family: "verdana" , sans-serif;">1 = Unencrypted</span><br />
<span style="font-family: "verdana" , sans-serif;">2 = Encryption in Progress</span><br />
<span style="font-family: "verdana" , sans-serif;">3 = Encrypted</span><br />
<span style="font-family: "verdana" , sans-serif;">4 = Key Change in Progress</span><br />
<span style="font-family: "verdana" , sans-serif;">5 = Decryption in Progress (Disabling TDE)</span><br />
<span style="font-family: "verdana" , sans-serif;">6 = Protection change in progress</span><br />
<span style="color: blue; font-family: "verdana" , sans-serif;"><br /></span>
<span style="color: blue; font-family: "verdana" , sans-serif;"><br /></span>
<b><span style="color: blue; font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><i>Backup Certificate</i></span></b><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span><span style="color: blue; font-family: "verdana" , sans-serif;">Use Master</span><br />
<span style="color: blue; font-family: "verdana" , sans-serif;">Go</span><br />
<span style="color: blue; font-family: "verdana" , sans-serif;">backup certificate TDE_CERT</span><br />
<span style="color: blue; font-family: "verdana" , sans-serif;">To FIle='C:\encryption\TDE_CERT.cer'</span><br />
<span style="color: blue; font-family: "verdana" , sans-serif;">with private key (file='C:\encryption\pkey.key' ,encryption by password ='@$trongPa$$word@')</span><br />
<span style="color: blue; font-family: "verdana" , sans-serif;">Go</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;">Make sure to keep the Certificate and Private key at safe place. Without Certificate and Private Key, database recovery will be impossible.</span><br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<br />
<span style="font-family: "verdana" , sans-serif;"><br /></span>
<span style="font-family: "verdana" , sans-serif;"><br /></span>
Swarndeep Singhhttp://www.blogger.com/profile/11550593701026635986noreply@blogger.com6tag:blogger.com,1999:blog-3633270974235726205.post-62623361589217624832017-01-03T18:26:00.001-05:002017-01-03T18:26:39.046-05:00SQL Server Stops sending database mails - How to Fix and How to resend failed Emails without restarting the SQL Server<div>
<span style="font-family: Verdana, sans-serif;">Database mail is a nice feature, it is generally intended for internal notifications to DBAs, DBEs, etc.</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">But sometimes Database Mail feature is taken too far. I come across feedback where production support teams mention that SQL Server stopped sending emails to clients. Well, SQL Server should not be used for sending mass emails and attachments, especially to clients or end users, it does not only impact SQL Server performance but not safe too.</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">Anyways, principles on a side for this blog.</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">I assume you already tried these steps and this did not help:</span></div>
<div>
<ul>
<li><span style="font-family: Verdana, sans-serif;">The recipients' email addresses were checked for correctness.</span></li>
<li><span style="font-family: Verdana, sans-serif;">The SMTP server was up and running.</span></li>
<li><span style="font-family: Verdana, sans-serif;">SMTP Server was reachaable, there was no firewall between SQL Server and SMTP server and the port was opened in firewall.</span></li>
</ul>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">Next, Try these steps:</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<ul>
<li><span style="font-family: Verdana, sans-serif;">Open SSMS:</span></li>
<li><span style="font-family: Verdana, sans-serif;">Stop Mail Service</span></li>
</ul>
<blockquote class="tr_bq">
<span style="font-family: Verdana, sans-serif;"><span style="color: blue;">USE MSDB<br />GO<br />sysmail_stop_sp<br />GO</span></span></blockquote>
<br />
<ul>
<li><span style="font-family: Verdana, sans-serif;"> Start Mail Service</span></li>
</ul>
<br />
<blockquote class="tr_bq">
<span style="color: blue; font-family: Verdana, sans-serif;">USE MSDB<br />GO<br />sysmail_start_sp<br />GO</span></blockquote>
</div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span><div>
<span style="font-family: Verdana, sans-serif;">This will refresh the Extended Procedure. If this does not help then go to the next step:</span></div>
</div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<ul>
<li><span style="font-family: Verdana, sans-serif;">Open SSMS:</span></li>
<li><span style="font-family: Verdana, sans-serif;">Stop Mail Service</span></li>
</ul>
<blockquote class="tr_bq">
<span style="color: blue; font-family: Verdana, sans-serif;">USE MSDB<br />GO<br />sysmail_stop_sp<br />GO</span></blockquote>
<br />
<ul>
<li><span style="font-family: Verdana, sans-serif;"> Kill <span style="color: blue;">DatabaseMail.exe </span>process from Windows Task Manager</span></li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://4.bp.blogspot.com/-YMWVJMgpx7s/WGwr3E0zoRI/AAAAAAAAIoM/TYwD0fgrFmA7Z1WM_oUADnbD1ABtIkUAgCEw/s1600/killDBMail.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: Verdana, sans-serif;"><img border="0" height="35" src="https://4.bp.blogspot.com/-YMWVJMgpx7s/WGwr3E0zoRI/AAAAAAAAIoM/TYwD0fgrFmA7Z1WM_oUADnbD1ABtIkUAgCEw/s400/killDBMail.png" width="400" /></span></a></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<br />
<ul>
<li><span style="font-family: Verdana, sans-serif;">Start Mail Service </span></li>
</ul>
<br />
<blockquote class="tr_bq">
<span style="color: blue; font-family: Verdana, sans-serif;">USE MSDB<br />GO<br />sysmail_start_sp<br />GO</span></blockquote>
</div>
<div>
<ul>
<li><span style="font-family: Verdana, sans-serif;">This would also bring up the DatabaseMail.exe process.</span></li>
</ul>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
</div>
<div>
<span style="font-family: Verdana, sans-serif;">Database mail should now work. Any emails awaiting in queue should be picked up though any emails which were failed already will not be sent. Though you can manually resend those emails utilizing metadata from system table "sysmail_faileditems".</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<blockquote class="tr_bq">
<span style="color: blue; font-family: Verdana, sans-serif;">declare </span><span style="color: blue; font-family: Verdana, sans-serif;">@recipients varchar(max), @cc varchar(max), @subject nvarchar(max), @body nvarchar(max), @format varchar(10), @attachment varchar(max)</span></blockquote>
<br />
<blockquote class="tr_bq">
<span style="color: blue; font-family: Verdana, sans-serif;">DECLARE failedemails CURSOR FOR</span></blockquote>
<br />
<blockquote class="tr_bq">
<span style="color: blue; font-family: Verdana, sans-serif;">Select recipients, copy_recipients, [subject], body, body_format, file_attachments from msdb.dbo.sysmail_faileditems where send_request_date >= 'If you want to filter with days, enter here'</span></blockquote>
<br />
<blockquote class="tr_bq">
<span style="color: blue; font-family: Verdana, sans-serif;">OPEN failedemails<br />fetch next from failedemails<br />into @recipients, @cc, @subject, @body, @format, @attachment<br />while @@fetch_status = 0<br />begin<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>EXEC msdb.dbo.sp_send_dbmail<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>@recipients = @recipients,<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>@copy_recipients = @cc,<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>@body = @body,<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>@subject = @subject,<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>@body_format = @format,<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>@file_attachments = @attachment;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>fetch next from failedemails<br />into @recipients, @cc, @subject, @body, @format, @attachment<br />end</span></blockquote>
<br />
<blockquote class="tr_bq">
<span style="color: blue; font-family: Verdana, sans-serif;">close failedemails;<br />deallocate failedemails;</span></blockquote>
</div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">That's it. </span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<pre style="font-family: Consolas, Courier, monospace !important; font-size: 13px; overflow: auto; padding: 5px; word-wrap: normal;">
</pre>
</div>
</div>
<div>
</div>
Swarndeep Singhhttp://www.blogger.com/profile/11550593701026635986noreply@blogger.com0tag:blogger.com,1999:blog-3633270974235726205.post-24439138673750787462016-09-07T11:33:00.000-04:002016-09-07T17:33:31.893-04:00SSRS 2014 - IE 11 - Toolbar items may render in multiple rows instead of one row.<span style="font-family: Arial, Helvetica, sans-serif;">I have been facing issues with SSRS 2008 R2, The reports were freezing and not showing any data. Microsoft did not provide any support as SQL 2008 R2. MS anyways closed for any new enhancements SQL 2008 variants.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">We upgraded to SSRS 2014, reports started working and data was rendered. Wait, now the toolbar started appearing in multiple rows. For smaller resolution screens, this was not acceptable. I could not find any solution or fix by Microsoft for SSRS 2014, though I could find a workaround that worked for me.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">This workaround requires me to modify the ReportViewer.aspx file.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">The ReportViewer.aspx file is located under Pages Folder at <span style="color: blue;">%ProgramFiles%\Microsoft SQL Server\MSRS12.MSSQLSERVER\Reporting Services\ReportServer\Pages.</span><span style="color: blue;"> </span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="color: blue;"><br /></span>
<span style="color: blue;">The folder name and path may differ based on the SQL Version and installation location, the path provided above is generalized.</span></span><br />
<ol>
<li><span style="font-family: Arial, Helvetica, sans-serif;">Take backup of original ReportViewer.aspx file, just in case the changes have to be restored.</span></li>
<li><span style="font-family: Arial, Helvetica, sans-serif;">Open ReportViewer.aspx, </span></li>
<ul>
<li><span style="font-family: Arial, Helvetica, sans-serif;">find meta Tag</span><div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-08SiYYjqgxA/V9AvbTjScpI/AAAAAAAAIUk/qGLHJacdoF82F1UQVzUJ_EsXLvgDIn64ACLcB/s1600/CaptureIE5.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: Arial, Helvetica, sans-serif;"><img border="0" height="33" src="https://2.bp.blogspot.com/-08SiYYjqgxA/V9AvbTjScpI/AAAAAAAAIUk/qGLHJacdoF82F1UQVzUJ_EsXLvgDIn64ACLcB/s320/CaptureIE5.PNG" width="320" /></span></a></div>
</li>
<li><span style="font-family: Arial, Helvetica, sans-serif;">Replace the content property with <span style="color: blue;">content="I</span><span style="color: blue;">E=EmulateIE10; IE=Edge"</span><span style="color: blue;"> in the tag</span></span></li>
</ul>
<li><span style="font-family: Arial, Helvetica, sans-serif;">Restart the SSRS service</span></li>
<li><span style="font-family: Arial, Helvetica, sans-serif;">Try the report now, it should work</span></li>
<li><span style="font-family: Arial, Helvetica, sans-serif;">It it does not work, then try different options in the content, example: IE=EmulateIE7 etc.</span></li>
</ol>
<div>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Arial, Helvetica, sans-serif;">Changing this option will try to Emulate the Report with version specified in order.</span></div>
<ol><ul>
</ul>
</ol>
Swarndeep Singhhttp://www.blogger.com/profile/11550593701026635986noreply@blogger.com3tag:blogger.com,1999:blog-3633270974235726205.post-78243624191594795532016-05-18T16:18:00.000-04:002016-05-18T16:18:12.781-04:00How to reload Missing SQL Server Performance Counters<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-size: 13.5pt;">Recently I was working on one of the servers to analyze the performance using Performance Counters which were collected historically for a long period of time.</span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 13.5pt;"><br />
</span> <span style="font-family: "arial" , "helvetica" , sans-serif; font-size: 13.5pt;">I noticed some of the needed counters were missing for the collection. </span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br />
</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-size: 13.5pt;"><span style="font-family: "arial" , "helvetica" , sans-serif;">So what was happening with that server where performance counters were missing? After running the following query on current snapshot of performance counters, I did not get the result. SQL Server was not reporting any counters. </span></span><br />
<span style="font-size: 13.5pt;"><span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
<o:p><a href="http://3.bp.blogspot.com/-57mnVPzbAe4/VzzJmGgIs8I/AAAAAAAAIBg/oDx1X26xSmAlJv2xSWFWBW1soShdYrpEwCK4B/s1600/Capture.PNG" imageanchor="1"><img border="0" height="318" src="https://3.bp.blogspot.com/-57mnVPzbAe4/VzzJmGgIs8I/AAAAAAAAIBg/oDx1X26xSmAlJv2xSWFWBW1soShdYrpEwCK4B/s400/Capture.PNG" width="400" /></a><br />
</o:p></div>
<div class="MsoNormal">
<!--[if gte vml 1]><v:shapetype
id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t"
path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"> <v:stroke joinstyle="miter"/> <v:formulas> <v:f eqn="if lineDrawn pixelLineWidth 0"/> <v:f eqn="sum @0 1 0"/> <v:f eqn="sum 0 0 @1"/> <v:f eqn="prod @2 1 2"/> <v:f eqn="prod @3 21600 pixelWidth"/> <v:f eqn="prod @3 21600 pixelHeight"/> <v:f eqn="sum @0 0 1"/> <v:f eqn="prod @6 1 2"/> <v:f eqn="prod @7 21600 pixelWidth"/> <v:f eqn="sum @8 21600 0"/> <v:f eqn="prod @7 21600 pixelHeight"/> <v:f eqn="sum @10 21600 0"/> </v:formulas> <v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/> <o:lock v:ext="edit" aspectratio="t"/> </v:shapetype><v:shape id="Picture_x0020_1" o:spid="_x0000_i1025" type="#_x0000_t75"
style='width:327pt;height:321.75pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\SWARND~1.SIN\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png"
o:title=""/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]--><o:p></o:p></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;">After doing some research I found that there is one configuration file that lists all the performance counters which SQL Server loads. The name of the performance counter configuration file is generally perfsqlctr.ini or perf-<instance name="">sqlctr.ini located in Binn directory.<o:p></o:p></instance></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;">To precisely get the file name and location, you may take help from Registry.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br />
</span></div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
</div>
<ol>
<li><span style="font-family: "arial" , "helvetica" , sans-serif; text-indent: -0.25in;">In Registry Go to HKLM\SYSTEM\CurrentControlSet\services\<instancename></instancename></span></li>
<li><span style="font-family: "arial" , "helvetica" , sans-serif; text-indent: -0.25in;">Extract the value from Key ImagePath until Binn</span></li>
<li><span style="font-family: "arial" , "helvetica" , sans-serif; text-indent: -0.25in;">Go to HKLM\SYSTEM\CurrentControlSet\services\[InstanceName]<instancename>\Performance</instancename></span></li>
<li><span style="font-family: "arial" , "helvetica" , sans-serif; text-indent: -0.25in;">Extract the value from key PerfIniFile</span></li>
<li><span style="font-family: "arial" , "helvetica" , sans-serif; text-indent: -0.25in;">Merge the values from #2 and #4, that is the file name which has all of the counters.</span></li>
</ol>
<div style="text-indent: -24px;">
<div class="MsoNormal" style="text-indent: 0px;">
<span style="font-family: arial, helvetica, sans-serif;">Now you got all of the file names needed, follow these steps to reload the counters.</span></div>
</div>
<ol>
<li><span style="font-family: "arial" , "helvetica" , sans-serif; text-indent: -0.25in;">Open file in text editor, make sure that all of the needed counters are there in the file, if not there then add counter while matching the format of existing counters.</span></li>
<li><span style="font-family: "arial" , "helvetica" , sans-serif; text-indent: -0.25in;">Unload the Counters</span></li>
<ul>
<li><span style="font-family: "arial" , "helvetica" , sans-serif; text-indent: -0.25in;">If Default Instance then run following command from shell.</span></li>
<ul>
<li><span style="text-indent: -1.5in;"><span style="font-family: "courier new" , "courier" , monospace;"><i>Unlodctr MSSQLSERVER</i></span></span></li>
</ul>
<li><span style="font-family: "arial" , "helvetica" , sans-serif; text-indent: -0.25in;">If Named Instance then run the following command from shell.</span></li>
<ul>
<li><i><span style="font-family: "courier new" , "courier" , monospace;">Unlodctr MSSQL$[ServiceName]</span></i></li>
</ul>
</ul>
<li><span style="font-family: "arial" , "helvetica" , sans-serif; text-indent: -0.25in;">Restart the MSSQL Service for that instance</span></li>
<li><span style="font-family: "arial" , "helvetica" , sans-serif; text-indent: -0.25in;">Reload the counters with following command from shell.</span></li>
<ul><ul>
<li><span style="text-indent: -1.5in;"><i><span style="font-family: "courier new" , "courier" , monospace;">Lodctr [path\file you got in #5]</span></i></span></li>
</ul>
</ul>
<li><span style="font-family: "arial" , "helvetica" , sans-serif; text-indent: -0.25in;">Restart MSSQLService for the instance</span></li>
</ol>
<div style="text-indent: -24px;">
<div class="MsoNormal" style="text-indent: 0px;">
<span style="font-family: "arial" , "helvetica" , sans-serif;">It worked for me, I could see the counters.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><a href="http://2.bp.blogspot.com/-yvd4qmqHlYU/VzzNc9RAz9I/AAAAAAAAIBs/ji8vGPvPkNcOFxuU0kUqufvOqqyU7E3qQCK4B/s1600/Capture1.PNG" imageanchor="1"><img border="0" height="372" src="https://2.bp.blogspot.com/-yvd4qmqHlYU/VzzNc9RAz9I/AAAAAAAAIBs/ji8vGPvPkNcOFxuU0kUqufvOqqyU7E3qQCK4B/s400/Capture1.PNG" width="400" /></a></span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br />
</span> <span style="font-family: "arial" , "helvetica" , sans-serif;">If you still see the issues, then please make sure that the registry keys as discussed above are accessible by Service Account of SQL Service. Then repeat steps between 2 and 4.</span></div>
</div>
Swarndeep Singhhttp://www.blogger.com/profile/11550593701026635986noreply@blogger.com0tag:blogger.com,1999:blog-3633270974235726205.post-26630521387434280292015-11-09T15:24:00.001-05:002015-11-09T15:24:13.262-05:00In Memory OLTP or Memory Optimized OLTPIf an enterprise server has to be upgraded to boost performance then memory can be the first and foremost resource that can be considered as a quick and cheap upgrade. Memory is not only cheap , but also very easy to install. If server supports, memory can be added without bringing the server down for maintenance.<br />
<br />
Starting with SQL Server 2014, Microsoft introduced In Memory Tables also known as Memory Optimized Tables or In Memory OLTP. Memory optimized tables can take advantage of additional Memory (RAM) to provide better performance.<br />
<br />
As name suggests, the data in these tables remain in memory when SQL Service is running. This does not mean that data will always vanish away when server is powered off or service interrupts. SQL Server keeps copy of data in Logs (write ahead log), if data has to be retained, the pages from log will be loaded back to memory optimized tables.<br />
<br />
While defining the table you can specify whether the durability of the table will be Schema only or Schema and Data both.<br />
<br />
Memory Optimized Table is brand new concept for SQL 2014 and the allocation works little differently from regular indices. Unlike regular tables, data in Memory Optimized table is stored in streams also called Data Streams. These Tables don't use IAM (Index Allocation Map) to link extent chain, because of this reason each Memory Optimized Table requires at least one index to link the data.<br />
<br />
These are the requirements for Memory Optimized Tables are:<br />
<br />
1. File Group designated for Memory Optimized Data,<br />
2. Data Files in Memory Optimized File Group.<br />
3. Disable Broker (or any feature that enables Event Notification) for that database. It is not supported.<br />
4. At least one Index per Memory Optimized Table. Index can be Hash Index or Range Index. Hash Indexes use Buckets to organize and point the underlying data, and Range Indexes are the regular indexes using "BW"-Tree architecture.<br />
<br />
You can either create a new Memory Optimized Database or you can add Memory Optimized Data file to existing database also.<br />
<br />
Here is the small example to introduce with Memory Optimized OLTP/Table.<br />
<br />
<br />
<b><u>Create Database</u></b><br />
<br />
CREATE DATABASE [MYDB]<br />
CONTAINMENT = NONE<br />
ON PRIMARY<br />
(NAME ='DataFile',<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>FILENAME='H:\SQLDATAFILES\MYDB_DATAFILE.MDF',<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>SIZE = 4096KB,<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>MAXSIZE = 10240KB,<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>FILEGROWTH=1024KB<br />
)<br />
LOG ON<br />
(NAME = 'LogFile',<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>FILENAME='H:\SQLDATAFILES\MYDB_LOGFILE.LDF',<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>SIZE=4096,<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>MAXSIZE=UNLIMITED,<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>FILEGROWTH=10%<br />
)<br />
<br />
<br />
<b><u>Disable Broker</u></b><br />
<br />
<br />
IF EXISTS (SELECT * FROM SYS.DATABASES WHERE NAME = 'MYDB' AND IS_BROKER_ENABLED = 1)<br />
ALTER DATABASE MYDB SET DISABLE_BROKER<br />
<br />
<br />
<b><u>Add Memory Optimized File Group and Data File</u></b><br />
<b><u><br /></u></b>
<br />
ALTER DATABASE MYDB<br />
ADD FILEGROUP [MYDB_MEMORY_OPTIMIZED_GROUP] <b>CONTAINS MEMORY_OPTIMIZED_DATA</b><br />
<br />
ALTER DATABASE MYDB<br />
ADD FILE<br />
(NAME='MYDB_MEM_OPT_DAT',<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>FILENAME='H:\SQLDATAFILES\MYDB_MEM_OPT_DAT',<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>MAXSIZE=UNLIMITED<br />
<br />
) TO FILEGROUP [MYDB_MEMORY_OPTIMIZED_GROUP]<br />
<br />
<br />
<b><u>Create Table</u></b><br />
<br />
USE MYDB;<br />
<br />
CREATE TABLE MYDB_INMEMORY_TABLE<br />
(<br />
COLUMN1 INT IDENTITY(1,1) NOT NULL PRIMARY KEY NONCLUSTERED,<br />
COLUMN2 INT NOT NULL <b>INDEX INDEX1 HASH WITH (BUCKET_COUNT=1000)</b>,<br />
COLUMN3 CHAR(100) COLLATE LATIN1_GENERAL_100_BIN2 NOT NULL INDEX INDEX2<br />
)<br />
WITH (<b>MEMORY_OPTIMIZED=ON</b>, <b>DURABILITY=SCHEMA_AND_DATA</b>)<br />
<br />
<br />
It is all done and ready to use. Though it is recommended to create resource pooling on memory for the database so that memory utilization can be maintained and monitored.<br />
<br />
<b><u>Create Resource Pool</u></b><br />
<br />
IF NOT EXISTS(SELECT * FROM SYS.RESOURCE_GOVERNOR_RESOURCE_POOLS WHERE NAME = 'POOL_MYDB')<br />
BEGIN<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>CREATE RESOURCE POOL POOL_MYDB WITH (MAX_MEMORY_PERCENT=10);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>ALTER RESOURCE GOVERNOR RECONFIGURE;<br />
END<br />
<br />
<b><u>Map Resource Pool and Database</u></b><br />
<br />
EXEC sp_xtp_bind_db_resource_pool 'MYDB', 'POOL_MYDB';<br />
<br />
<b><u>Take Database Offline and Online again to apply the changes</u></b><br />
<br />
USE MASTER;<br />
ALTER DATABASE MYDB SET OFFLINE WITH ROLLBACK IMMEDIATE;<br />
ALTER DATABASE MYDB SET ONLINE;<br />
<br />
<br />
<br />
Please leave your feedback, if you like this article or have any comments, below.<br />
<div>
<br /></div>
<b><u><br /></u></b>
Swarndeep Singhhttp://www.blogger.com/profile/11550593701026635986noreply@blogger.com0tag:blogger.com,1999:blog-3633270974235726205.post-61496196134078076712015-10-06T21:08:00.001-04:002019-02-14T14:23:03.704-05:00About Me<br />
<div class="separator" style="clear: both; text-align: justify;"><a href="https://4.bp.blogspot.com/-cL1rmobf_Ik/W-HJD0ZQibI/AAAAAAAAcvc/UfAClBsjRJsNSeW1AeRe6L2y0LSXUX6OwCLcBGAs/s1600/profilephoto_wide.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="263" data-original-width="789" src="https://4.bp.blogspot.com/-cL1rmobf_Ik/W-HJD0ZQibI/AAAAAAAAcvc/UfAClBsjRJsNSeW1AeRe6L2y0LSXUX6OwCLcBGAs/s1600/profilephoto_wide.png" /></a></div><br />
<div style="text-align: justify;"><b style="color: #073763; font-family: verdana, sans-serif; text-align: justify;">Swarndeep Singh</b><span style="color: #073763; font-family: "verdana" , sans-serif;"> is a SQL Server Solutions Specialist with expertise in Performance Turning, Database Designing, Cloud Computing, Database Security, Data Analysis, BI and Auditing. He uses scripting including T-SQL, Powershell and Python in his day to day work. He is also fond of working with other technologies like Postgresql, C#, Web Services, AWS and Azure. </span><br />
<span style="color: #073763; font-family: "verdana" , sans-serif;"><br />
</span> <br />
<div style="text-align: justify;"><span style="color: #073763; font-family: "verdana" , sans-serif;">In his free time he likes to write blogs on his blog at https://www.swarndeep.com. Swarndeep lives in Georgia, USA and working full time as Database Manager.</span></div><br />
</div><br />
Swarndeep Singhhttp://www.blogger.com/profile/11550593701026635986noreply@blogger.comtag:blogger.com,1999:blog-3633270974235726205.post-49110066964044860812015-10-02T21:51:00.000-04:002015-10-05T13:24:15.173-04:00A glance at SQL Server Statistics<div class="tr_bq">
<b>Statistics </b>are sometimes ignored when it comes to Performance Tuning. Statistics can play a big role in identifying recurring slowness.</div>
<br />
Before executing any query, SQL Engine Optimizer should know in advance some information, like the number of records, page density, indexes etc. If updated information is available, the query optimizer will use best execution plan to execute the query.<br />
<br />
Before go further on this, here is an example, an online store makes sure that they have enough stock in warehouse that is ready to ship to meet the demand. But their system is broken and online ordering system is unaware of stock quantities in warehouse, then probably online ordering system will order item directly from distributor which will take longer time for item delivery.<br />
<br />
On the other hand if online store has outdated information that their warehouse has enough stock, the online order will be mistakenly sent to warehouse, which then be re-routed to the distributor.<br />
<br />
Both of these scenarios have bad impacts because information was outdated somewhere.<br />
<br />
This example may not fit 100% with SQL Server statistics but it is very close.<br />
<br />
Let's take a look at SQL Server with same example. Store A has 10 warehouses in a state at different zip code locations. Store decided to merge all warehouses in one big warehouse to reduce overhead cost.<br />
<br />
After the physical change, this information has been updated in database, by simply updating affecting zip codes to one zip code. Note that the index is built on Zip code. There is an pre-existing index on the zipcode column.<br />
<br />
Order entry system complains that after merging the Zip codes, the system is little sluggish. The reason of this sluggishness lies behind mass updates. The reason behind this issue could most probably be outdated statistics. Let's take this example:<br />
<br />
<br />
<ul>
<li>Create a table:</li>
</ul>
<blockquote class="tr_bq">
<span style="color: purple;">CREATE TABLE [dbo].[Warehouse_Inventory](<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>[ItemCode] [varchar](50) NOT NULL,<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>[ZipCode] [int] NOT NULL<br />
) ON [PRIMARY]<br />
GO</span></blockquote>
<br />
<ul>
<li>Now insert some data:</li>
</ul>
<br />
<br />
<blockquote class="tr_bq">
<span style="color: purple;">declare @zip int, @inventory int<br />
set @zip = 1<br />
while (@zip < 200000)<br />
begin<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>set @inventory = @zip+22.5<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>insert into [dbo].[Warehouse_Inventory]<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>select 'Inventory ' + cast(@inventory as varchar(10)), @zip<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>select @zip = @zip+1<br />
end</span></blockquote>
<br />
<br />
<ul>
<li>Create a non clustered index on zip code:</li>
</ul>
<br />
<br />
<span style="color: purple;"></span><br />
<blockquote class="tr_bq">
<span style="color: purple;">CREATE NONCLUSTERED INDEX [ClusteredIndex-myindex] ON [dbo].[Warehouse_Inventory]</span><br />
<span style="color: purple;">(</span><br />
<span style="color: purple;">[ZipCode] ASC</span><br />
<span style="color: purple;">)</span><br />
<span style="color: purple;">GO</span></blockquote>
<span style="color: purple;">
</span>
<br />
<ul>
<li> Let's run our first query to get inventory from location 30001. Only 1 row should be returned.</li>
</ul>
<blockquote class="tr_bq">
<span style="color: purple;">select zipcode from [Warehouse_Inventory] where ZipCode = 30001 OPTION (RECOMPILE)</span></blockquote>
<br />
<br />
Query used the index as expected, let's look at the index statistics. See from the screenshot below the Estimated and Actual number of rows matches. What query optimizer estimated, same was returned. This sounds good.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-N8q6Oym9RAM/Vg71ihG-vRI/AAAAAAAAHPM/FIxxiv2i1QI/s1600/BeforeUpdate.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="http://2.bp.blogspot.com/-N8q6Oym9RAM/Vg71ihG-vRI/AAAAAAAAHPM/FIxxiv2i1QI/s1600/BeforeUpdate.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Execution Plan after creating Index</td></tr>
</tbody></table>
<br />
<br />
Since the zip codes were updated, about 90% of the warehouses are moved to one zip code, 30001. In table, we need to update those 90% of the zip codes.<br />
<br />
<br />
<blockquote class="tr_bq">
<span style="color: purple;">update [dbo].[Warehouse_Inventory]<br />
set zipcode = 30001<br />
where zipcode < 180000</span></blockquote>
<br />
Without making any further changes, without rebuilding the indexes etc., running the same query again should return 179,000 rows. Let's look at the same index execution plan created by query optimizer.<br />
<br />
Query optimizer estimated only 1 row to be returned, though there were 179,000 rows expected.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-2G1fQAkN7hI/Vg739l2HMFI/AAAAAAAAHPY/tjaA_uJC2bo/s1600/AfterUpdate.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-2G1fQAkN7hI/Vg739l2HMFI/AAAAAAAAHPY/tjaA_uJC2bo/s1600/AfterUpdate.png" /></a></div>
<br />
<br />
Now, let's fix the statistic by updating it manually.<br />
<blockquote class="tr_bq">
<span style="color: purple;">update statistics dbo.warehouse_inventory.</span></blockquote>
After updating the statistics the number of rows estimated by query optimizer are 179,000. This is what we wanted to see in execution plan.<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-iGyr5Iut-e0/Vg763kYZ3fI/AAAAAAAAHPs/os_2j5_ZUmY/s1600/AfterUpdatestat.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-iGyr5Iut-e0/Vg763kYZ3fI/AAAAAAAAHPs/os_2j5_ZUmY/s1600/AfterUpdatestat.png" /></a></div>
<br />
If query optimizer sends wrong estimate then probably wrong execution plan can be picked which can cause some performance sluggishness.<br />
<br />
Here is the query that can be used to find out how many modifications were made to statistics. This can probably help in devising a custom solution for some of the indexes which are updated throughout the day in production application.<br />
<br />
<blockquote class="tr_bq">
<span style="color: purple;">SELECT<br />
[sp].[object_id],<br />
OBJECT_NAME([sp].[object_id]) AS 'ObjectName',<br />
[sp].[stats_id] AS 'StatID',<br />
[st].[name] AS 'StatName',<br />
[sp].[last_updated] AS 'LastTimeStatUpdated',<br />
[sp].[modification_counter] AS 'NumberOfModifications'<br />
FROM [sys].[stats] AS [st]<br />
OUTER APPLY sys.dm_db_stats_properties ([st].[object_id],[st].[stats_id]) AS [sp]<br />
where OBJECT_NAME([sp].[object_id]) is not null<br />
and OBJECT_NAME([sp].[object_id]) not like 'sys%'<br />
and OBJECT_NAME([sp].[object_id]) in ('Warehouse_Inventory')</span></blockquote>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-omx-KsRisCQ/Vg7-uEG6EKI/AAAAAAAAHP4/AYNy5hmR8U4/s1600/GetStatistics.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="167" src="http://2.bp.blogspot.com/-omx-KsRisCQ/Vg7-uEG6EKI/AAAAAAAAHP4/AYNy5hmR8U4/s400/GetStatistics.png" width="400" /></a></div>
<br />
The example above is very simple and probably you may not see any major difference in performance, it was just to demonstrate how to proceed with Statistiscs.<br />
<br />
There are some options that SQL Server provides at database level. These options are Auto Update Statistics and Auto Update Statistics Asynchronously.<br />
<br />
<b>Auto Update Statistics:</b> If while executing the query, the statistics found outdated by a ratio then update the statistics before executing the query.<br />
<br />
<b>Auto Update Statistics Asynchronously:</b> If while executing the query, the statistics found outdated by a ratio and statistics update request will be sent to engine in background.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-aAlFNVPvGo0/Vg8AFPh3RyI/AAAAAAAAHQE/eGyet8XTafo/s1600/UpdateStatisticsScreen.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="272" src="http://4.bp.blogspot.com/-aAlFNVPvGo0/Vg8AFPh3RyI/AAAAAAAAHQE/eGyet8XTafo/s400/UpdateStatisticsScreen.png" width="400" /></a></div>
<br />
One or both of these options can be switched on. Since all servers have different load, environment, usage, thus be little careful before opting these options. In General, OLTP may respond very well to ASYNC, though database warehouses have SYNC options go well.Swarndeep Singhhttp://www.blogger.com/profile/11550593701026635986noreply@blogger.com1Suwanee, GA 30024, USA34.0514898 -84.071299733.9462428 -84.2326612 34.1567368 -83.9099382tag:blogger.com,1999:blog-3633270974235726205.post-35390153905012317732012-09-27T16:55:00.001-04:002012-09-27T16:55:16.637-04:00Replication Errors–Investigation and FixReplication in SQL Server is one of the features I like the most. I use Replication for many applications including Report Server, Data Warehouse and data processing. <br />
It is very common to see that when Replication fails, generally we Re-Initialize entire replication. There are certain scenarios when Re-Initializing the replication is not favorable, for example when database/tables being replicated are in TBs and takes hours to create new snapshots or when subscribers have snapshot less subscription. <br />
In such scenarios, DBAs have limited time to investigate the problem and to reach to the root cause and fix the root cause before subscription expires. I have also faced these issues many times myself, however, 99% times I have been able to fix the issues before subscription expires and even before anyone else notices. Here is the procedure with example: <br />
<ul><li>For this test I have created one table called “Test_repl” in Test database, here is the script:</li>
</ul><blockquote><span style="background-color: #cccccc;">CREATE TABLE [dbo].[test_repl](<br />
[ID] [int] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,<br />
[Name] [varchar](50) NOT NULL,<br />
CONSTRAINT [PK_test_repl] PRIMARY KEY CLUSTERED <br />
(<br />
[ID] ASC<br />
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]<br />
) ON [PRIMARY]</span></blockquote><ul><li>Above table will be replicated to another database named “Test_Subscriber”</li>
<li>Added a row in publisher table “Test.dbo.Test_repl”, since this is the first row in table, the ID column will get value ‘1’ from auto increment.</li>
</ul><blockquote><span style="background-color: #cccccc;">insert into test_repl (Name) select 'XYZ'</span></blockquote><ul><li>Make sure that the row has been replicated from publisher to subscriber.</li>
<li>Make sure that there is no error in replication monitor for this publisher.</li>
</ul><blockquote><a href="http://lh5.ggpht.com/-eJv5TO16Z7o/UGS7zvSqM4I/AAAAAAAACGA/4Xlg8c65OMw/s1600-h/image%25255B14%25255D.png"><img alt="image" border="0" height="117" src="http://lh6.ggpht.com/-n67f_mWSwrs/UGS70joXESI/AAAAAAAACGI/pTX3JTabt-s/image_thumb%25255B8%25255D.png?imgmax=800" style="background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="453" /></a></blockquote><ul><li>Now delete the row at subscriber.</li>
</ul><blockquote><span style="background-color: #cccccc;">delete from Test_Subscriber.dbo.test_repl<br />
where ID = 1</span></blockquote><ul><li><span style="background-color: white;"></span>Now modify the row from publisher and update XYZ to WXYZ. It should break the replication with critical error.</li>
<span style="background-color: #cccccc;">update test.dbo.test_repl
set Name = 'WXYZ'
where ID = 1</span>
<li>Replication Monitor now shows error in distribution agent:</li>
</ul><blockquote><a href="http://lh4.ggpht.com/-URNaw9iT55Q/UGS71TG6aAI/AAAAAAAACGQ/mGZNPUq5ZNs/s1600-h/image%25255B18%25255D.png"><img alt="image" border="0" height="111" src="http://lh6.ggpht.com/-WYq5_8ml4mY/UGS71xbaAZI/AAAAAAAACGY/67fSBXXM4wo/image_thumb%25255B10%25255D.png?imgmax=800" style="background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="461" /></a></blockquote><ul><li>If we assume that there are thousands of rows but don’t know which row caused the problem following steps will guide us how to find that row.</li>
<li>There are few requirements, like we should know the Database name being published and it’s publisher id. To know this run the following query. In the following query we passed database name in the where clause. Remember the ID from below query. Following query will run against Distribution database.</li>
</ul><blockquote><span style="background-color: #cccccc;">select id from MSpublisher_databases where publisher_db ='Test' -- for database id</span></blockquote><ul><li>Run the following query to get the Top 100 errors in replication, it should display all recent errors. We may also run the query with time stamp filter. Following query will run against Distribution database.</li>
</ul><blockquote><span style="background-color: #cccccc;">select top 100 * from msrepl_errors<br />
where command_id > 0<br />
order by time desc</span></blockquote><ul><li>From above query, copy the XACT_sqlno and command_id.</li>
</ul><blockquote><a href="http://lh3.ggpht.com/-j_kujUv3BwY/UGS72qwEZ2I/AAAAAAAACGg/WpCm0UHuHjE/s1600-h/image%25255B22%25255D.png"><img alt="image" border="0" height="99" src="http://lh6.ggpht.com/-QuxD0b6W6nE/UGS73MxdsbI/AAAAAAAACGo/5GOqAMTI0mU/image_thumb%25255B12%25255D.png?imgmax=800" style="background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="450" /></a></blockquote><ul><li>So far we have collected publisher_id, Xact_sqlno and command_id. These values will be passed against the following SP. Following query will run against Distribution database.</li>
</ul><blockquote><span style="background-color: #cccccc;">declare @seq nchar(22)<br />
set @seq = '0x0000001A00000113000400000000'<br />
exec sp_browsereplcmds @xact_seqno_start = @Seq<span style="background-color: lime;"> -- this xact_seqno</span><br />
, @xact_seqno_end = @Seq <span style="background-color: lime;">-- -- this xact_seqno</span><br />
, @command_id = 1<span style="background-color: lime;"> -- this the command_id got from queries ran earlier</span><br />
, @publisher_database_id = 1</span><span style="background-color: lime;"> -- Here put the publisher_id</span></blockquote><ul><li>Above query will return lot of information, however, the information we are looking for is command (text). Here is the list.</li>
</ul><blockquote><a href="http://lh6.ggpht.com/-SYurF6b7Rpg/UGS736Kq_OI/AAAAAAAACGw/e9xx18kycp8/s1600-h/image%25255B31%25255D.png"><img alt="image" border="0" height="83" src="http://lh6.ggpht.com/-QQmX_QIH59s/UGS74YucU4I/AAAAAAAACG4/_2W-KVvDjyQ/image_thumb%25255B17%25255D.png?imgmax=800" style="background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="image" width="468" /></a></blockquote><ul><li>Try to interpret the text in command column, basically it is running sp_MSupd_dbotest_repl procedure which is trying to update primary key 1 to ‘WXYZ’ on subscriber database. So now we know that data in the table belonging to primary key 1 is missing. Manually insert this row in subscriber, start the distributor agent again, it should fix the issue. in case we are unable to interpret the SP, then we may open the SP text from subscriber database. Here is the query to insert the row in subscriber.</li>
</ul><blockquote><span style="background-color: #cccccc;">use Test_Subscriber<br />
set identity_insert Test_Subscriber.dbo.test_repl on<br />
insert into Test_Subscriber.dbo.test_repl (ID, Name)<br />
select ID, Name from test.dbo.test_repl where ID = 1<br />
set identity_insert Test_Subscriber.dbo.test_repl off</span></blockquote>Hope this will be useful information. if you like this post, I appreciate you leaving your comments.<br />
<br />
<br />
Swarndeep Singhhttp://www.blogger.com/profile/11550593701026635986noreply@blogger.com0tag:blogger.com,1999:blog-3633270974235726205.post-37607330456880773262011-12-19T13:20:00.001-05:002011-12-19T13:46:45.211-05:00Setting up Anonymous Access for Reporting Services in SQL Server 2008 R2.<strong><u>DISCLAIMER: ANONYMOUS ACCESS IS NOT RECOMMENDED as it may give direct access to your report server or report objects to any one who knows the URL of your reporting services. Additional security measurements are required while handling with anonymous access.</u></strong><br />
Microsoft has made some fundamental modifications with SQL Server 2008 Reporting Services security architecture. Reporting Services and Web Component now do not need IIS or Web Server as Reporting Services now run on it's own http.sys and serves the reports request from within http.sys.<br />
The biggest challenge I faced while configuring Reporting Services was Anonymous Access as Anonymous Access is no more an option available to be configured easily. To enable Anonymous Access you need to configure config files and also compile dll to provide extension to Reporting Services to allow Anonymous access.<br />
Here are the steps which can be performed to enable Anonymous Access in Reporting Services.<br />
<br />
<ul>
<li><span style="font-size: small;">Change the authentication mode in rsreportserver.config to Custom</span></li>
</ul>
<blockquote>
<div align="left">
<span style="background-color: white; color: #4f81bd;"><Authentication></span></div>
<div align="left">
<span style="background-color: white; color: #4f81bd;"><AuthenticationTypes></span></div>
<div align="left">
<span style="background-color: white; color: #4f81bd;"><Custom/></span></div>
<div align="left">
<span style="background-color: white; color: #4f81bd;"></AuthenticationTypes></span></div>
<div align="left">
<span style="background-color: white; color: #4f81bd;"><EnableAuthPersistence>true</EnableAuthPersistence></span></div>
<div align="left">
<span style="background-color: white; color: #4f81bd;"></Authentication></span></div>
</blockquote>
<ul>
<li>Change the Authentication mode in web.config file in ReportServer to None. Also change the Impersonation to false.</li>
</ul>
<blockquote>
<span style="color: #4f81bd;"><authentication mode="None" /></span><br />
<span style="color: #4f81bd;"><identity impersonate="false"/></span></blockquote>
<ul>
<li>Compile the code from this <a href="https://sites.google.com/site/swarnpublic/home/anonymouseaccess/Microsoft.Samples.ReportingServices.AnonymousSecurity.cs?attredirects=0&d=1">location</a> to bin folder as Microsoft.Samples.ReportingServices.AnonymousSecurity.dll Or copy it from this <a href="https://sites.google.com/site/swarnpublic/home/anonymouseaccess/Microsoft.Samples.ReportingServices.AnonymousSecurity.dll?attredirects=0&d=1">location</a> and paste it to bin folder in ReportServer.</li>
<li>Add Extensions in rsreportserver.config </li>
<ul>
<li>Add the additional extension in Security Tag</li>
</ul>
</ul>
<blockquote>
<span style="color: #4f81bd;"><Security></span><br />
<span style="color: #4f81bd;"><Extension Name="None" Type="Microsoft.Samples.ReportingServices.AnonymousSecurity.Authorization, Microsoft.Samples.ReportingServices.AnonymousSecurity" /></span><br />
<span style="color: #4f81bd;"></Security></span></blockquote>
<ul> <ul>
<li>Add the additional extension in Authentication Tag</li>
</ul>
</ul>
<blockquote>
<span style="color: #4f81bd;"><Authentication></span><br />
<span style="color: #4f81bd;"><Extension Name="None" Type="Microsoft.Samples.ReportingServices.AnonymousSecurity.AuthenticationExtension, Microsoft.Samples.ReportingServices.AnonymousSecurity" /></span><br />
<span style="color: #4f81bd;"></Authentication></span></blockquote>
<ul>
<li>Add the following codegroup to configure the code access security in rssrvpolicy.config</li>
</ul>
<blockquote>
<span style="color: #4f81bd;"><CodeGroup</span><br />
<span style="color: #4f81bd;">class="UnionCodeGroup"</span><br />
<span style="color: #4f81bd;">version="1"</span><br />
<span style="color: #4f81bd;">PermissionSetName="FullTrust"</span><br />
<span style="color: #4f81bd;">Name="Private_assembly"</span><br />
<span style="color: #4f81bd;">Description="This code group grants custom code full trust. "></span><br />
<span style="color: #4f81bd;"><IMembershipCondition</span><br />
<span style="color: #4f81bd;">class="UrlMembershipCondition"</span><br />
<span style="color: #4f81bd;">version="1"</span><br />
<span style="color: #4f81bd;">Url="C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer\bin\Microsoft.Samples.ReportingServices.AnonymousSecurity.dll"</span><br />
<span style="color: #4f81bd;">/></span><br />
<span style="color: #4f81bd;"></CodeGroup></span></blockquote>
Restart the reporting services, Anonymous Access should work.Swarndeep Singhhttp://www.blogger.com/profile/11550593701026635986noreply@blogger.com92Herndon, VA 20170, USA38.9808589 -77.384119738.9314854 -77.4630837 39.0302324 -77.3051557tag:blogger.com,1999:blog-3633270974235726205.post-69170912183964115672011-10-21T16:04:00.000-04:002011-10-21T16:04:55.402-04:00Cannot print report from Microsoft Reporting Services 2000 report.This is a security issue with Reporting Services 2000 SP2. To fix this issue apply the patch from KB Article <a href="http://www.microsoft.com/download/en/details.aspx?id=16628">KB954609</a> on Reporting Server..<br />
<br />
Once this patch is installed, reboot is not required. Clients will get a request to install a component on their machines if they click on print (One time only). Once installed, it will allow to print reports.Swarndeep Singhhttp://www.blogger.com/profile/11550593701026635986noreply@blogger.com0tag:blogger.com,1999:blog-3633270974235726205.post-39232920781834111312010-08-30T21:16:00.000-04:002010-09-01T13:20:24.116-04:00Database Backup Growth Report Script<div style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size: small;">Following Script will return the real-time database backup growth report for Week or Month or Year. Script was developed and tested in SQL 10.0, however, with small changes it can be used in SQL 2000 or SQL 2005.</span></div><blockquote style="color: #45818e; font-family: "Courier New", Courier, monospace;">CREATE proc usp_RPT_Backup_Growth (@dbname varchar(100), @type varchar(100), @servername varchar(100), @year varchar(4), @freq varchar(10)) <br />
as <br />
if (@freq='Week') <br />
begin <br />
with bkupreport(database_name, Type, backup_size, server_name, unit_num, year_num) as ( <br />
select a.database_name, <br />
case a.type when 'D' then 'Full' <br />
when 'I' then 'Diff' <br />
when 'L' then 'Log' end as Type <br />
,avg(a.compressed_backup_size) Total_Backup_Size <br />
,a.server_name <br />
,DATEPART(wk,a.backup_start_date) 'WeekNumber', DATEPART(year,a.backup_start_date) 'YearNumber' <br />
from msdb.dbo.backupset a with (nOLOCK) <br />
where /*a.backup_start_date between (GETDATE()-32) and GETDATE() <br />
and */a.database_name = @dbname and a.type =@type and a.server_name = @servername <br />
and DATEPART(year,a.backup_start_date) = @year <br />
group by a.database_name, a.type, a.server_name, DATEPART(wk,a.backup_start_date) <br />
, DATEPART(year,a.backup_start_date) <br />
) <br />
select a.database_name, a.Type, a.backup_size, a.server_name, a.unit_num, a.year_num <br />
,Cast((100. * (a.backup_size - b.backup_size)) / b.backup_size As numeric(18,2)) As 'Growth' from bkupreport a <br />
left outer join bkupreport b with (NOLOCK) <br />
on b.unit_num+1 = a.unit_num <br />
order by a.unit_num <br />
end <br />
if (@freq='Month') <br />
begin <br />
with bkupreport(database_name, Type, backup_size, server_name, unit_num, year_num) as ( <br />
select a.database_name, <br />
case a.type when 'D' then 'Full' <br />
when 'I' then 'Diff' <br />
when 'L' then 'Log' end as Type <br />
,avg(a.compressed_backup_size) Total_Backup_Size <br />
,a.server_name <br />
,DATEPART(MM,a.backup_start_date) 'MonthNumber', DATEPART(year,a.backup_start_date) 'YearNumber' <br />
from msdb.dbo.backupset a with (nOLOCK) <br />
where /*a.backup_start_date between (GETDATE()-32) and GETDATE() <br />
and */a.database_name = @dbname and a.type =@type and a.server_name = @servername <br />
and DATEPART(year,a.backup_start_date) = @year <br />
group by a.database_name, a.type, a.server_name, DATEPART(MM,a.backup_start_date) <br />
, DATEPART(year,a.backup_start_date) <br />
) <br />
select a.database_name, a.Type, a.backup_size, a.server_name, a.unit_num, a.year_num <br />
,Cast((100. * (a.backup_size - b.backup_size)) / b.backup_size As numeric(18,2)) As 'Growth' from bkupreport a <br />
left outer join bkupreport b with (NOLOCK) <br />
on b.unit_num+1 = a.unit_num <br />
order by a.unit_num <br />
end <br />
if (@freq='Year') <br />
begin <br />
with bkupreport(database_name, Type, backup_size, server_name, unit_num, year_num) as ( <br />
select a.database_name, <br />
case a.type when 'D' then 'Full' <br />
when 'I' then 'Diff' <br />
when 'L' then 'Log' end as Type <br />
,avg(a.compressed_backup_size) Total_Backup_Size <br />
,a.server_name <br />
,0 'MonthNumber', DATEPART(year,a.backup_start_date) 'YearNumber' <br />
from msdb.dbo.backupset a with (nOLOCK) <br />
where a.database_name = @dbname and a.type =@type and a.server_name = @servername <br />
group by a.database_name, a.type, a.server_name, DATEPART(year,a.backup_start_date) <br />
, DATEPART(year,a.backup_start_date) <br />
) <br />
select a.database_name, a.Type, a.backup_size, a.server_name, a.unit_num, a.year_num <br />
,Cast((100. * (a.backup_size - b.backup_size)) / b.backup_size As numeric(18,2)) As 'Growth' from bkupreport a <br />
left outer join bkupreport b with (NOLOCK) <br />
on b.year_num+1 = a.year_num <br />
order by a.unit_num <br />
end <br />
GO</blockquote>Swarndeep Singhhttp://www.blogger.com/profile/11550593701026635986noreply@blogger.com0tag:blogger.com,1999:blog-3633270974235726205.post-89053721587392879222010-06-08T10:24:00.000-04:002010-06-08T10:25:35.422-04:00SQL Server 2008 SP1 CU#8Microsoft released CU#8 for SQL Server 2008 SP1. Use the following direct URL for more information.<br />
<br />
http://blogs.msdn.com/b/sqlreleaseservices/archive/2010/05/17/cumulative-update-8-for-sql-server-2008-service-pack-1.aspxSwarndeep Singhhttp://www.blogger.com/profile/11550593701026635986noreply@blogger.com0tag:blogger.com,1999:blog-3633270974235726205.post-90754153155064737822010-05-02T22:07:00.000-04:002010-05-02T22:07:16.077-04:00Changing ‘sa’ password in MS SQL Server, if 'sa' password is misplaced or forgotten.Sometimes there might be a situation when DBA may forget ‘sa’ password and there is no other way to login to SQL Server, in that situation DBA may reset the ‘sa’ password or add another user with SA rights.<br />
To do this, first Stop SQL Server and then start SQL Server with –m option in startup parameter to start SQL in single user mode.<br />
<br />
Then login to Windows with Domain Administrator and use sqlcmd utility to connect to sql server. Once connected, write t-sql commands to reset ‘sa’ password or add another domain user with SA rights. After completion, stop SQL Server, remove –m option from startup parameters and restart sql server.<br />
<br />
To reset sa password, use the following script.<br />
<br />
C:\Users\Administrator>sqlcmd -E -Ssql2k8 <br />
1> alter login sa with password = 'password' <br />
2> go <br />
1> <br />
<br />
This procedure has been tested with SQL Server 2008, where server was already added to domain.Swarndeep Singhhttp://www.blogger.com/profile/11550593701026635986noreply@blogger.com0tag:blogger.com,1999:blog-3633270974235726205.post-89324174537718454132009-12-22T16:56:00.000-05:002009-12-22T16:56:54.146-05:00Data Collection (MDW) in SQL Server for performance monitoring.With Microsoft SQL Server 2008, Microsoft has incorporated new performance tool called Data Collector, also known as MDW – Management Data Warehouse and also Known as Performance Studio.<br />
With MDW, you can collect SQL Server performance information, IO usage, disk usage, memory usage, locks, blocking, queries taking longer time, couple of performance counters etc. The useful information it collects can be preserved for long time and can be analyzed for the purpose of troubleshooting.<br />
MDW creates it’s own database warehouse (MDW) to collect information. There are pre-configured collection sets including Server Activity, Query Statistics and Disk Usage. The data collected in MDW is published in SQL Server Management studio with very useful reports. This feature is not configured by default and can be found under Management in Object Explorer of SQL Server Management Studio.<br />
<br />
<br />
<a href="http://lh4.ggpht.com/_hMJMOVWGz9k/SzE_n_jrICI/AAAAAAAABfU/pMFhu6Tncqk/s1600-h/image%5B2%5D.png"><img alt="image" border="0" height="220" src="http://lh4.ggpht.com/_hMJMOVWGz9k/SzE_oAeOc7I/AAAAAAAABfY/KInDTW1286Y/image_thumb.png?imgmax=800" style="border-width: 0px; display: inline;" title="image" width="244" /></a> <br />
<br />
As mentioned above this feature is by default disabled, this can be enabled and configured by selecting ‘Configure Management Data Warehouse wizard’ option after right clicking on Data Collection.<br />
<br />
<a href="http://lh5.ggpht.com/_hMJMOVWGz9k/SzE_oetmcBI/AAAAAAAABfc/_pr9vWZJzzg/s1600-h/image%5B5%5D.png"><img alt="image" border="0" height="157" src="http://lh4.ggpht.com/_hMJMOVWGz9k/SzE_o4NnnGI/AAAAAAAABfg/lX3-nm0jZQE/image_thumb%5B1%5D.png?imgmax=800" style="border-width: 0px; display: inline;" title="image" width="244" /></a> <br />
<br />
Selecting ‘Configure Management Data Warehouse’ starts a wizard as shown below to configure data warehouse.<br />
<br />
<a href="http://lh3.ggpht.com/_hMJMOVWGz9k/SzE_pboIvsI/AAAAAAAABfk/kajgq17eX9U/s1600-h/image%5B8%5D.png"><img alt="image" border="0" height="220" src="http://lh5.ggpht.com/_hMJMOVWGz9k/SzE_ptGVxfI/AAAAAAAABfo/6SrkPUvPOjM/image_thumb%5B2%5D.png?imgmax=800" style="border-width: 0px; display: inline;" title="image" width="244" /></a> <br />
<br />
First part of configuration is to create Database Warehouse and second part is where you setup data collection.<br />
In the following part, we are setting the database for first time, and selected option “Create or upgrade a management data warehouse”.<br />
<br />
<a href="http://lh5.ggpht.com/_hMJMOVWGz9k/SzE_pyEcIhI/AAAAAAAABfs/OrbjTX4XXhQ/s1600-h/image%5B11%5D.png"><img alt="image" border="0" height="219" src="http://lh6.ggpht.com/_hMJMOVWGz9k/SzE_qEPEiYI/AAAAAAAABfw/alQcdSWw_AI/image_thumb%5B3%5D.png?imgmax=800" style="border-width: 0px; display: inline;" title="image" width="244" /></a> <br />
<br />
Create New database to collect information by select New option from following screen.<br />
<br />
<a href="http://lh6.ggpht.com/_hMJMOVWGz9k/SzE_qScLw6I/AAAAAAAABf0/JWqaVNWS8g8/s1600-h/image%5B14%5D.png"><img alt="image" border="0" height="218" src="http://lh5.ggpht.com/_hMJMOVWGz9k/SzE_qsZN98I/AAAAAAAABf4/uqLdl924wng/image_thumb%5B4%5D.png?imgmax=800" style="border-width: 0px; display: inline;" title="image" width="244" /></a> <br />
<br />
<br />
<br />
<br />
<a href="http://lh6.ggpht.com/_hMJMOVWGz9k/SzE_q1KFmiI/AAAAAAAABf8/rwxJrIxgd4A/s1600-h/image%5B17%5D.png"><img alt="image" border="0" height="218" src="http://lh5.ggpht.com/_hMJMOVWGz9k/SzE_rbxOyUI/AAAAAAAABgA/zsmuME9eurM/image_thumb%5B5%5D.png?imgmax=800" style="border-width: 0px; display: inline;" title="image" width="244" /></a> <br />
<br />
From the following screen, select Login and map MDW users to that Login or Logins. There are three roles for MDW, admin, writer and reader. You may either create a single Login and give admin or you may give appropriate rights to Logins, as per your requirements.<br />
<br />
<a href="http://lh5.ggpht.com/_hMJMOVWGz9k/SzE_rh-5dkI/AAAAAAAABgE/R-1mqAqy508/s1600-h/image%5B20%5D.png"><img alt="image" border="0" height="220" src="http://lh3.ggpht.com/_hMJMOVWGz9k/SzE_sCrN-3I/AAAAAAAABgI/ReBHK0DJPqc/image_thumb%5B6%5D.png?imgmax=800" style="border-width: 0px; display: inline;" title="image" width="244" /></a> <br />
<br />
Review the information before clicking on Finish.<br />
<br />
<a href="http://lh5.ggpht.com/_hMJMOVWGz9k/SzE_sZLOnxI/AAAAAAAABgM/BoBsfD1zj94/s1600-h/image%5B23%5D.png"><img alt="image" border="0" height="220" src="http://lh5.ggpht.com/_hMJMOVWGz9k/SzE_tfWSVWI/AAAAAAAABgQ/wtytc6pH9QI/image_thumb%5B7%5D.png?imgmax=800" style="border-width: 0px; display: inline;" title="image" width="244" /></a> <br />
<a href="http://lh3.ggpht.com/_hMJMOVWGz9k/SzE_tsd3SSI/AAAAAAAABgU/9kkPdWtqb2s/s1600-h/image%5B26%5D.png"><img alt="image" border="0" height="219" src="http://lh3.ggpht.com/_hMJMOVWGz9k/SzE_tyRmp6I/AAAAAAAABgY/tLTB5BoIkfI/image_thumb%5B8%5D.png?imgmax=800" style="border-width: 0px; display: inline;" title="image" width="244" /></a> <br />
<br />
Since the database has been configured, the next part is to set the data collection. In case if MDW database has been setup on another server, this will be your first step for this server.<br />
<br />
<a href="http://lh5.ggpht.com/_hMJMOVWGz9k/SzE_uPYbnSI/AAAAAAAABgc/kam9rXn7nSA/s1600-h/image%5B29%5D.png"><img alt="image" border="0" height="219" src="http://lh5.ggpht.com/_hMJMOVWGz9k/SzE_vBz3BlI/AAAAAAAABgg/esxoWudlSsY/image_thumb%5B9%5D.png?imgmax=800" style="border-width: 0px; display: inline;" title="image" width="244" /></a> <br />
<br />
Data collector collects some information from traces and other parts which it keeps locally in a folder before pushing it to database. In the following Window you may chose directory to keep this information.<br />
<br />
<a href="http://lh6.ggpht.com/_hMJMOVWGz9k/SzE_ve93rBI/AAAAAAAABgk/yVjNVTZhV40/s1600-h/image%5B35%5D.png"><img alt="image" border="0" height="220" src="http://lh5.ggpht.com/_hMJMOVWGz9k/SzE_vi15ZKI/AAAAAAAABgo/rBOTZAfFtUI/image_thumb%5B11%5D.png?imgmax=800" style="border-width: 0px; display: inline;" title="image" width="244" /></a> <br />
<br />
Review the information before clicking on Finish.<br />
<br />
<a href="http://lh4.ggpht.com/_hMJMOVWGz9k/SzE_vxaTt-I/AAAAAAAABgs/3Ot5oAtqABM/s1600-h/image%5B38%5D.png"><img alt="image" border="0" height="220" src="http://lh6.ggpht.com/_hMJMOVWGz9k/SzE_wIi0JeI/AAAAAAAABgw/w8OPFOv9tig/image_thumb%5B12%5D.png?imgmax=800" style="border-width: 0px; display: inline;" title="image" width="244" /></a> <br />
<a href="http://lh4.ggpht.com/_hMJMOVWGz9k/SzE_wevtflI/AAAAAAAABg0/ACCFusBBNs0/s1600-h/image%5B41%5D.png"><img alt="image" border="0" height="220" src="http://lh4.ggpht.com/_hMJMOVWGz9k/SzE_wvV0ZuI/AAAAAAAABg4/0gqVqUkMV5c/image_thumb%5B13%5D.png?imgmax=800" style="border-width: 0px; display: inline;" title="image" width="244" /></a> <br />
<br />
Once this process is completed, Next step is to schedule the jobs, configure the maximum retain period of collection.<br />
<br />
<a href="http://lh5.ggpht.com/_hMJMOVWGz9k/SzE_xC4jpOI/AAAAAAAABg8/T7lKkCJU1As/s1600-h/image%5B44%5D.png"><img alt="image" border="0" height="240" src="http://lh4.ggpht.com/_hMJMOVWGz9k/SzE_yv6sn7I/AAAAAAAABhA/6Ze2VG4Zod8/image_thumb%5B14%5D.png?imgmax=800" style="border-width: 0px; display: inline;" title="image" width="244" /></a> <br />
<br />
Right click on Disk Usage, select Properties. In the property Window review and change the information like the frequency of collection, default service account to run jobs associated with current collector. You can also configure the ‘Retain data’ property and specify number of days you want to keep the information.<br />
<br />
<a href="http://lh4.ggpht.com/_hMJMOVWGz9k/SzE_zGnSbiI/AAAAAAAABhE/khEBO248k6A/s1600-h/image%5B47%5D.png"><img alt="image" border="0" height="204" src="http://lh4.ggpht.com/_hMJMOVWGz9k/SzE_0A2SyaI/AAAAAAAABhI/2tT8APJltbM/image_thumb%5B15%5D.png?imgmax=800" style="border-width: 0px; display: inline;" title="image" width="244" /></a> <br />
<br />
Follow the same practice for all three collector sets. Once it will configure correctly you will see reports and useful information by right clicking on Data Collection and selecting the appropriate report, as shown in following screen shot.<br />
<br />
<a href="http://lh4.ggpht.com/_hMJMOVWGz9k/SzE_1kNYnJI/AAAAAAAABhM/CUYwMEkUwlw/s1600-h/image%5B50%5D.png"><img alt="image" border="0" height="106" src="http://lh6.ggpht.com/_hMJMOVWGz9k/SzE_13OtOyI/AAAAAAAABhQ/9yuzh_3tNAU/image_thumb%5B16%5D.png?imgmax=800" style="border-width: 0px; display: inline;" title="image" width="244" /></a> <br />
<br />
Server Activity report will look like as shown below.<br />
<br />
<a href="http://lh5.ggpht.com/_hMJMOVWGz9k/SzE_2e0eYyI/AAAAAAAABhU/aJD5n8rR45U/s1600-h/image%5B53%5D.png"><img alt="image" border="0" height="200" src="http://lh5.ggpht.com/_hMJMOVWGz9k/SzE_2sIVsJI/AAAAAAAABhY/DV4UGQMikI8/image_thumb%5B17%5D.png?imgmax=800" style="border-width: 0px; display: inline;" title="image" width="244" /></a> <br />
<br />
By default it will show you data for last four hours, however you can change the date and range you want to see the reports. As shown below, click on calendar icon and select date range and number minutes/hours you want to see the report.<br />
<br />
<a href="http://lh4.ggpht.com/_hMJMOVWGz9k/SzE_20ejh2I/AAAAAAAABhc/UDoMwkKYoMo/s1600-h/image%5B56%5D.png"><img alt="image" border="0" height="35" src="http://lh3.ggpht.com/_hMJMOVWGz9k/SzE_3Ov56XI/AAAAAAAABhg/zjb5YxkGYWY/image_thumb%5B18%5D.png?imgmax=800" style="border-width: 0px; display: inline;" title="image" width="244" /></a> <br />
<br />
In this case, the report will be shown for data collected for 15 minutes starting 4 PM.<br />
<br />
<a href="http://lh5.ggpht.com/_hMJMOVWGz9k/SzE_3tZBfjI/AAAAAAAABhk/gi8ab43V9as/s1600-h/image%5B62%5D.png"><img alt="image" border="0" height="119" src="http://lh4.ggpht.com/_hMJMOVWGz9k/SzE_3xJHAcI/AAAAAAAABho/_-F237a0Bvo/image_thumb%5B20%5D.png?imgmax=800" style="border-width: 0px; display: inline;" title="image" width="244" /></a> <br />
<br />
Following same way, you can view other reports as well. You may explore this feature to understand this and get used to this.<br />
This is a great and may save money for your organization, if you are planning to buy third party monitoring tool for SQL Server.Swarndeep Singhhttp://www.blogger.com/profile/11550593701026635986noreply@blogger.com3tag:blogger.com,1999:blog-3633270974235726205.post-72238711343170415242009-11-30T15:39:00.000-05:002009-11-30T16:10:43.156-05:00Real time performance analysis of Stored ProceduresBy assuming that there are no Hardware issues with SQL Server, but still SQL Server performance is not up to the mark, following query can provide some useful information for troubleshooting.<br />
<br />
select a.*, p.query_plan , p.number <br />
from sys.dm_exec_procedure_stats as a <br />
cross apply sys.dm_exec_query_plan(a.plan_handle) as p <br />
where a.object_id=object_id('[sch].[User_SP]')<br />
There are some very useful columns returned by this query, those are:<br />
<br />
<u><b>cached_time</b></u> : Recent Recompile Time<br />
<b><u>last_worker_time</u></b> : Execution time in micro seconds<br />
<b><u>last_physical_reads</u></b>: Number of pages read from physical storage system.<br />
<u><b>last_logical_reads</b></u>: Number of pages read from buffer, instead of physical storage.<br />
<b><u>query_plan</u></b>: XML representation of query plan, which was used during recent sp run.<br />
<br />
The tables in query just keeps the last event i.e. only one record. Adding this query in job allows to store the information in temporary table and after couple of minutes you can get enough details for investigation. For single procedure, more than one query plan may exist. You may compare query plans to find out the differences.<br />
<br />
In one of the real time scenarios, I realized that number of logical reads were few millions, for just returning 100 rows. There was issue with one of the join that caused more number of logical reads.<br />
<br />
This is not the end, you may also compare physical reads with logical reads. Also consider frequency of procedure being recompiling. Too much recompiling may cause overhead to CPU.<br />
<br />
<b>Note</b>: Logical Reads over Physical reads are good. More logical reads shows that the query is getting it’s data from buffer, more physical reads are sign of potential IO bottleneck.Swarndeep Singhhttp://www.blogger.com/profile/11550593701026635986noreply@blogger.com1tag:blogger.com,1999:blog-3633270974235726205.post-10901909047251025742009-11-09T13:54:00.000-05:002009-11-09T14:00:05.029-05:00How to enable Replication on Publisher (SQL 2008)<a href="http://talksql.blogspot.com/2009/10/replication-on-sql-server-2008.html">Introduction to Replication.</a><br />
<br />
Before enabling Replication on Publisher you must decide where you want to run the distribution database. Distribution database keeps track of logs to be replicated among subscribers.<br />
Keeping distribution database on same server as publisher may cause IO bottlenecks, depending upon hardware configuration and existing load on server.<br />
Follow the steps to below to enable Distribution and Replication. These steps will add distribution server on selected server.<br />
1. Open SQL Server Management Studio, Connect to SQL Server and Expand SQL Server where you wish to enable publishing and distribution.<br />
<br />
<a href="http://lh4.ggpht.com/_hMJMOVWGz9k/SvhjWgXV8oI/AAAAAAAABWQ/wuikgxy3ce4/s1600-h/image%5B2%5D.png"><img alt="image" border="0" height="175" src="http://lh5.ggpht.com/_hMJMOVWGz9k/SvhjXKF0rbI/AAAAAAAABWU/9uzv88436kU/image_thumb.png?imgmax=800" style="border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;" title="image" width="188" /></a><br />
<br />
2. Right click on Replication in Object Explorer, then select Configure Distribution. This will start “Configure Distribution Wizard”.<br />
<br />
<a href="http://lh6.ggpht.com/_hMJMOVWGz9k/SvhjXZL0OeI/AAAAAAAABWY/KgWcUrqDNGM/s1600-h/image%5B11%5D.png"><img alt="image" border="0" height="220" src="http://lh3.ggpht.com/_hMJMOVWGz9k/SvhjX53TQAI/AAAAAAAABWc/8wo1lc95y2M/image_thumb%5B3%5D.png?imgmax=800" style="border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;" title="image" width="244" /></a><br />
<br />
3. In case distribution is already setup somewhere, then select appropriate option,<br />
<br />
<a href="http://lh5.ggpht.com/_hMJMOVWGz9k/SvhjYCikI1I/AAAAAAAABWg/5WvSLzHZXxQ/s1600-h/image%5B14%5D.png"><img alt="image" border="0" height="221" src="http://lh6.ggpht.com/_hMJMOVWGz9k/SvhjYU7ciII/AAAAAAAABWk/bhtMH2OQKrg/image_thumb%5B4%5D.png?imgmax=800" style="border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;" title="image" width="244" /></a><br />
<br />
4. In the following screenshot, notice that Snapshot Folder location is a network location. It is a good idea to keep it as network location, so that sql server agent can running on another server can access this location in case of pull subscription.<br />
<br />
<a href="http://lh5.ggpht.com/_hMJMOVWGz9k/SvhjY0yFm0I/AAAAAAAABWo/enZr4oT1-Tk/s1600-h/image%5B17%5D.png"><img alt="image" border="0" height="219" src="http://lh4.ggpht.com/_hMJMOVWGz9k/SvhjZLJ3ncI/AAAAAAAABWs/PznOVLLQ5rM/image_thumb%5B5%5D.png?imgmax=800" style="border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;" title="image" width="244" /></a><br />
<br />
5. Enter the location to create data files,<br />
<a href="http://lh6.ggpht.com/_hMJMOVWGz9k/SvhjZXvQGmI/AAAAAAAABWw/tG_hZKIqNSw/s1600-h/image%5B20%5D.png"><img alt="image" border="0" height="220" src="http://lh4.ggpht.com/_hMJMOVWGz9k/SvhjZ0dwCiI/AAAAAAAABW0/N0IEZZtWwsg/image_thumb%5B6%5D.png?imgmax=800" style="border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;" title="image" width="244" /></a><br />
<br />
6. From the following screen, you can add publisher server to distribution list. Click on Add button and select “Add SQL Server Publisher” to add SQL Server publisher. There is one more option available to add Oracle Publisher too. You may add more than one publisher here.<br />
<br />
<a href="http://lh6.ggpht.com/_hMJMOVWGz9k/SvhjaIuhkrI/AAAAAAAABW4/v4Fmd4pmj1k/s1600-h/image%5B26%5D.png"><img alt="image" border="0" height="219" src="http://lh4.ggpht.com/_hMJMOVWGz9k/SvhjaZiKCLI/AAAAAAAABW8/vyrjjG5y1Jw/image_thumb%5B8%5D.png?imgmax=800" style="border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;" title="image" width="244" /></a><br />
<br />
7. From the below screen select password for remote connection to distribution database.<br />
<br />
<a href="http://lh6.ggpht.com/_hMJMOVWGz9k/SvhjaxFil_I/AAAAAAAABXA/Aj1XRIM-dyI/s1600-h/image%5B23%5D.png"><img alt="image" border="0" height="219" src="http://lh5.ggpht.com/_hMJMOVWGz9k/SvhjbD90AuI/AAAAAAAABXE/FLzcorPF9fs/image_thumb%5B7%5D.png?imgmax=800" style="border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;" title="image" width="244" /></a><br />
<br />
8. From the following window, you can either select to Configure distribution, or generate the t-sql to configure distribution manually or both.<br />
<br />
<a href="http://lh3.ggpht.com/_hMJMOVWGz9k/Svhjbb5NBYI/AAAAAAAABXI/MZ_5S2zKY6E/s1600-h/image%5B29%5D.png"><img alt="image" border="0" height="219" src="http://lh5.ggpht.com/_hMJMOVWGz9k/SvhjbhRW7FI/AAAAAAAABXM/CTPMDXuqIPg/image_thumb%5B9%5D.png?imgmax=800" style="border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;" title="image" width="244" /></a><br />
<br />
9. Read the summary of actions below before configuring the distribution.<br />
<br />
<a href="http://lh6.ggpht.com/_hMJMOVWGz9k/SvhjcCoJngI/AAAAAAAABXQ/trTQgc3fsPc/s1600-h/image%5B32%5D.png"><img alt="image" border="0" height="218" src="http://lh3.ggpht.com/_hMJMOVWGz9k/SvhjcWwtaDI/AAAAAAAABXU/qWr2fyrnl14/image_thumb%5B10%5D.png?imgmax=800" style="border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;" title="image" width="244" /></a> <br />
<br />
10. Click Finish to complete the Configuration.Swarndeep Singhhttp://www.blogger.com/profile/11550593701026635986noreply@blogger.com0tag:blogger.com,1999:blog-3633270974235726205.post-5135208229564366472009-10-31T00:48:00.001-04:002009-11-09T13:56:48.089-05:00Replication on SQL Server 2008.One of the High Availability feature of SQL Server is Replication. Replication shares the selected tables, views or procedures among other servers. In fact Replication is not fully High Availability solution, but it can helpful for reporting servers and Warehouse etc.<br />
There are three models of Replication supported by SQL Server 2008. Transaction Replication, Merge Replication and Snapshot Replication. <br />
<strong>Snapshot Replication </strong>This is most simplest model of Replication. Snapshot Replication just restores the initial set of data and does not support any incremental restore of logs.<br />
<strong>Agent:</strong> Snapshot Agent, Distribution Agent<br />
<strong>Transactional Replication</strong> This is most common replication model. Typically this Model starts with initial snapshot. Using this model, Log Reader service reads the transactions and send them over to Distribution Server. Distribution server then distributes the transactions to all subscribers. This entire process by default runs continuously, however this can be scheduled to run on specific intervals.<br />
<strong>Agents:</strong> Snapshot Agent, Log Reader Agent, Distribution Agent.<br />
<div align="center"><a href="http://lh4.ggpht.com/_hMJMOVWGz9k/SuynTnsVjOI/AAAAAAAABVo/_1VjvIK4hKE/s1600-h/image%5B3%5D.png"><img alt="image" border="0" height="398" src="http://lh5.ggpht.com/_hMJMOVWGz9k/SuynTyMRDRI/AAAAAAAABVs/_FdJqz6sWhc/image_thumb%5B1%5D.png?imgmax=800" style="border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" width="212" /></a>Figure Courtesy SQL Server BOL: Transaction Replication<br />
</div><strong>Merge Replication</strong> Merge Replication is Similar to Transaction Replication, Merge Replication also typically starts with Snapshot of initial data. Once initial snapshot is applied, it merges the changes occurred at publisher or subscriber. <br />
Merge Replication requires UniqueIdentifier type column in each published table. If this column type is not already added, it adds this column. To track changes, Merge Replication also adds Insert, Delete and Update Triggers for each of the articles (aka Published Objects). These triggers use the UniqueIdentifier type column in each table to identify the changes, which was added above.<br />
<strong>Agents</strong>: Snapshot Agent, Merge Agent.<br />
<div align="center"><a href="http://lh6.ggpht.com/_hMJMOVWGz9k/Suytz4kuUMI/AAAAAAAABVw/e98tRlWD9AI/s1600-h/image%5B7%5D.png"><img alt="image" border="0" height="339" src="http://lh3.ggpht.com/_hMJMOVWGz9k/Suyt0eJtp1I/AAAAAAAABV0/7BmPPvHzCD8/image_thumb%5B3%5D.png?imgmax=800" style="border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" width="232" /></a>Figure Courtesy SQL Server BOL: Transaction Replication<br />
</div><div align="left">There can either be Push Subscription or Pull Subscription. In case of Push Subscription, Distribution Agent and Merge Agent runs at the Distributor. However, in case of Pull Subscription, Distribution Agent and Merge Agent runs at Subscriber.<br />
</div><div align="left">Each agent of Replication is well described on BOL too. Please click <a href="http://msdn.microsoft.com/en-us/library/ms152501.aspx">here</a>.<br />
<br />
<a href="http://talksql.blogspot.com/2009/11/how-to-enable-replication-on-publisher.html">Enabling Distribution on SQL Server 2008</a>.<br />
</div>Swarndeep Singhhttp://www.blogger.com/profile/11550593701026635986noreply@blogger.com0tag:blogger.com,1999:blog-3633270974235726205.post-32732485723387668892009-10-05T23:21:00.000-04:002010-02-10T16:53:09.574-05:00Windows NT user or group 'Domain\User' not found. Check the name again. (Microsoft SQL Server, Error: 15401)When you add new Domain Login to SQL Server, you may see error Windows NT user or group 'Domain\User' not found. Check the name again. (Microsoft SQL Server, Error: 15401).<br />
<br />
This error message is very general and it does not explain any specific problem or reason itself. Microsoft has a very good article to fix this issue at http://support.microsoft.com/kb/324321/en-us.<br />
<br />
However, there is another scenario which is not covered in above article (at the time when writing this article) or may be I am the first person who faced this issue.<br />
<br />
This scenario can be reproduced on Windows 2008 Server with SQL 2008 Server where the Domain Controller is Windows 2000 server. On Windows 2008 server, 2 new policies have been enabled by default that encrypts the secure channel data when new LOGIN request is sent to Domain Controller by Domain member(Also SQL Server). In this scenario, Domain Controller is Windows 2000, thus it does not understand the encrypted request thus refuses the LOGINrequest. All you need to do is to fix this behavior in Windows 2008 (SQL Server) to not to send encrypted secure channel data to Domain Controller. To do this follow the steps below and it should fix the issue.<br />
<ol><li>From the SQL Server running Windows 2008 R2, Click Start-> Run and type the command GPEDIT.MSC. This will open the Policy Editor.</li>
<li>From Policy Editor Expand “Computer configuration” - > Windows Settings -> Security Setttings -> Local Policies -> Security Options.</li>
<li>You will see all security policies on right hand side window. Make changes into the following two policies. </li>
</ol><ul><ul><li>Domain member: Digitally encrypt secure channel data (when possible) – Disable this policy<br />
</li>
<li>Domain member: Digitally sign secure channel data (when possible) – Disable this policy </li>
</ul></ul>After making these changes, close the policy editor and reboot the box. (Not SQL Server, but restart entire system).<br />
<br />
In case your local policy does not allow you to make changes, you may have to make changes using Group Policy Management Console. Instructions to install GPMC are <a href="http://blogs.technet.com/askds/archive/2008/07/07/installing-gpmc-on-windows-server-2008-and-windows-vista-service-pack-1.aspx">located at</a> http://blogs.technet.com/askds/archive/2008/07/07/installing-gpmc-on-windows-server-2008-and-windows-vista-service-pack-1.aspx.<br />
<br />
<ul><li>Run gpmc.msc (Group Policy Management)</li>
</ul><ul><li>Expand your Domain</li>
</ul><ul><li>Go to <group objects="" policy=""> and select <default domain="" policy=""> and then follow steps 2 and 3 from above.</default></group></li>
</ul>Swarndeep Singhhttp://www.blogger.com/profile/11550593701026635986noreply@blogger.com7tag:blogger.com,1999:blog-3633270974235726205.post-35165138186740680442009-09-25T16:52:00.000-04:002009-09-25T17:13:06.861-04:00SQL Server Virtualization<div style="font-family: Verdana,sans-serif;"><b><span style="font-size: large;">Introduction</span></b><br />
</div><div style="font-family: Verdana,sans-serif;"><br />
</div><div class="MsoNormal" style="font-family: Verdana,sans-serif;">When I first heard SQL Server Virtualization, I made an assumption that it is a new feature of SQL Server that provides Virtualization at SQL Server Level, that is not the case. SQL Server Virtualization is nothing but running SQL Server Instance on Virtual Machine. SQL Server Virtualization is one of the hottest topics these days, especially after Microsoft has launched Microsoft Hyper-V (AKA Microsoft Hyper-Visor) and VMware ESX Server. In more technical terms Virtual Machines are also known as Hyper-Visors. As far as SQL Server is concerned, there is nothing specific you need to configure on SQL Server for Virtualization. The only configurations are made using Virtualization Software and sometimes system BIOS. The Original HyperVisor was developed at IBM in the 1960s called CP/CMS.<br />
<br />
</div><div style="font-family: Verdana,sans-serif;">Type of Virtual Machine Or HyperVisor or Virtual Machine Monitors or Virtualizations:<br />
<br />
<ul><li><b>Type 1: Hosted.</b><b> </b></li>
</ul><br />
<ul><li><b>Type 2: Native or Bare-Metal.</b></li>
</ul><b> <br />
</b><br />
<b><o:p></o:p></b><br />
</div><div style="font-family: Verdana,sans-serif;"><b><span style="font-size: 11pt; line-height: 115%;">Type 1</span></b><span style="font-size: 11pt; line-height: 115%;"> hypervisors are the common virtual machine monitors mostly used. In this scenario, Virtual Machine Monitor or VM tool is installed or Hosted on Operating System. This is why it is called Hosted Virtualization too. Thus Virtual Machine Communicates with Operating System for all of its resources Requirements. VMware Server, Microsoft Virtual PC are some of the famous Virtual Machine Monitors. Following is the basic architecture of Hosted Virtualization.</span><br />
</div><div class="separator" style="clear: both; font-family: Verdana,sans-serif; text-align: center;"><span style="font-size: 11pt; line-height: 115%;"> </span><a href="http://4.bp.blogspot.com/_hMJMOVWGz9k/Sr0r9vVKk8I/AAAAAAAAAvs/vFoHjFS_UTg/s1600-h/Hoted+VM.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/_hMJMOVWGz9k/Sr0r9vVKk8I/AAAAAAAAAvs/vFoHjFS_UTg/s320/Hoted+VM.jpg" /></a><br />
</div><div style="font-family: Verdana,sans-serif;"><b><span style="font-size: 11pt; line-height: 115%;">Type 2</span></b><span style="font-size: 11pt; line-height: 115%;"> hypervisors run on host's hardware and communicates directly with the Hardware instead of communicating with hardware through Host OS. The hardware resources and I/O are shared among virtualized OSs. That is why it is also called Bare-Metal Virtualization. It is also possible to assign specific devices to specific Virtualized OS, this is called partitioning. VMware ESX Server, Microsoft Hyper-V, Citrix Xen, LynuxWorks are some of the software available in market. Following is a basic architecture of Bare Metal Virtualization. </span><br />
</div><div style="font-family: Verdana,sans-serif;"><br />
</div><div class="separator" style="clear: both; font-family: Verdana,sans-serif; text-align: center;"><a href="http://1.bp.blogspot.com/_hMJMOVWGz9k/Sr0r7LEpSRI/AAAAAAAAAvc/uDkshfzslMY/s1600-h/BareMetal+VM.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/_hMJMOVWGz9k/Sr0r7LEpSRI/AAAAAAAAAvc/uDkshfzslMY/s320/BareMetal+VM.jpg" /></a><br />
</div><div style="font-family: Verdana,sans-serif;"><br />
</div><span style="font-size: large;"><b><span style="font-family: Verdana,sans-serif;">Why or Why not use SQL Virtualization.</span></b></span><br />
<br />
<span style="font-family: Verdana,sans-serif;">When Total Cost of Ownership is your concern then Virtualization is the answer. Since virtualization runs on single set of hardware, thus the cost of buying new hardware can be reduced. Also need to consider that the performance of Virtualization will not be as good as running individual machine, because SQL Virtualization does not only includes SQL Server, it also includes Operating System, and other required tools for OS and SQL Server. There can be three priorities of an organization, Performance, Integrity, Cost. If Performance is only concern then avoid using virtualization because at some point you may notice lack of enough resources to run environments in virtualization. If integrity or cost is the concern then one may consider virtualization.</span><br />
<br />
<br />
<span style="font-size: large;"><b><span style="font-family: Verdana,sans-serif;">Conclusion</span></b></span><br />
<br />
<span style="font-family: Verdana,sans-serif;">Virtualization is a nice technology and can save hundred thousand of dollars for organization, though there is downside too. If planned wisely, the downsides can be avoided.</span><br />
<span style="font-family: Verdana,sans-serif;">The best ever plan for most of the organizations can be consider deploying SQL Virtualization on Development, UAT or any non-production environment and avoid deploying SQL Virtualization on production environment as much as possible unless you have one of the best hardware that can give good performance even if multiple OS are installed with SQL Server.</span><br />
<span style="font-family: Verdana,sans-serif;">Installing multiple instances on same Operating System should also be considered while planning for SQL virtualization.</span>Swarndeep Singhhttp://www.blogger.com/profile/11550593701026635986noreply@blogger.com0