<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>SQLDBPOOL.COM</title>
	<atom:link href="http://sqldbpool.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://sqldbpool.com</link>
	<description>Articles on SQL Server and MySQL</description>
	<lastBuildDate>Thu, 26 Jan 2012 03:31:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='sqldbpool.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/61033c99c4f07025d9a57671bd6aa687?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>SQLDBPOOL.COM</title>
		<link>http://sqldbpool.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://sqldbpool.com/osd.xml" title="SQLDBPOOL.COM" />
	<atom:link rel='hub' href='http://sqldbpool.com/?pushpress=hub'/>
		<item>
		<title>Happy Republic Day</title>
		<link>http://sqldbpool.com/2012/01/25/happy-republic-day-2/</link>
		<comments>http://sqldbpool.com/2012/01/25/happy-republic-day-2/#comments</comments>
		<pubDate>Wed, 25 Jan 2012 22:58:02 +0000</pubDate>
		<dc:creator>Jugal Shah</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://sqldbpool.com/?p=1603</guid>
		<description><![CDATA[Filed under: SQL Server<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1603&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img src="http://sqldbpool.files.wordpress.com/2012/01/hrd.jpg?w=630" alt="" title="HRD"   class="alignnone size-full wp-image-1604" /></p>
<br />Filed under: <a href='http://sqldbpool.com/category/notes/sql-server-notes/'>SQL Server</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqldbpool.wordpress.com/1603/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqldbpool.wordpress.com/1603/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqldbpool.wordpress.com/1603/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqldbpool.wordpress.com/1603/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqldbpool.wordpress.com/1603/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqldbpool.wordpress.com/1603/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqldbpool.wordpress.com/1603/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqldbpool.wordpress.com/1603/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqldbpool.wordpress.com/1603/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqldbpool.wordpress.com/1603/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqldbpool.wordpress.com/1603/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqldbpool.wordpress.com/1603/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqldbpool.wordpress.com/1603/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqldbpool.wordpress.com/1603/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1603&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqldbpool.com/2012/01/25/happy-republic-day-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<georss:point>18.520469 73.856621</georss:point>
		<geo:lat>18.520469</geo:lat>
		<geo:long>73.856621</geo:long>
		<media:content url="http://0.gravatar.com/avatar/246a03e5bd256f9361fdf78e944f9c3d?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JShah</media:title>
		</media:content>

		<media:content url="http://sqldbpool.files.wordpress.com/2012/01/hrd.jpg" medium="image">
			<media:title type="html">HRD</media:title>
		</media:content>
	</item>
		<item>
		<title>Different ways to check the SQL Server Instance Port number</title>
		<link>http://sqldbpool.com/2012/01/18/different-ways-to-check-the-sql-server-instance-port-number/</link>
		<comments>http://sqldbpool.com/2012/01/18/different-ways-to-check-the-sql-server-instance-port-number/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 00:35:59 +0000</pubDate>
		<dc:creator>Jugal Shah</dc:creator>
				<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>
		<category><![CDATA[SQL Server 2011 (Denali)]]></category>

		<guid isPermaLink="false">http://sqldbpool.wordpress.com/?p=1593</guid>
		<description><![CDATA[Problem: If there are multiple SQL instances running on the same computer, it is difficult to identify the instance port number. You can use the below solution to find the instance specific port numbers. Solution: You can check the list of port number used by the SQL Server instances using one of the below way. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1593&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Problem:</strong> If there are multiple <a class="zem_slink" title="SQL" href="http://www.iso.org/iso/catalogue_detail.htm?csnumber=45498" rel="homepage">SQL</a> instances running on the same computer, it is difficult to identify the instance <a class="zem_slink" title="Port number" href="http://en.wikipedia.org/wiki/Port_number" rel="wikipedia">port number</a>. You can use the below solution to find the instance specific port numbers.</p>
<p><strong>Solution: </strong>You can check the list of port number used by the SQL Server instances using one of the below way.</p>
<p><span style="text-decoration:underline;"><strong>Soln 1# Using SQL Server <a class="zem_slink" title="Configuration management" href="http://en.wikipedia.org/wiki/Configuration_management" rel="wikipedia">Configuration Manager</a><br />
</strong></span></p>
<ul style="margin-left:45pt;">
<li>Go to SQL Server Configuration Manager</li>
<li><a class="zem_slink" title="Select (SQL)" href="http://en.wikipedia.org/wiki/Select_%28SQL%29" rel="wikipedia">Select</a> <strong>Protocols for SQL2005/2008</strong> under <strong>SQL server Network Configuration</strong></li>
<li>Right click on <a class="zem_slink" title="Transmission Control Protocol" href="http://en.wikipedia.org/wiki/Transmission_Control_Protocol" rel="wikipedia">TCP</a>/<a class="zem_slink" title="Internet Protocol" href="http://en.wikipedia.org/wiki/Internet_Protocol" rel="wikipedia">IP</a> and select <strong>Properties</strong></li>
<li>Select the <strong><a class="zem_slink" title="IP address" href="http://en.wikipedia.org/wiki/IP_address" rel="wikipedia">IP Addresses</a></strong>-tab</li>
<li>In the section <strong>IP ALL</strong>, you can see the ports</li>
</ul>
<p><span style="text-decoration:underline;"><strong>Soln 2#From Registry Values<br />
</strong></span><strong>SQL Server 2005<br />
</strong>Type the regedit command in Run window and check the below registry values.HKEY_LOCAL_MACHINE\SOFTWARE\<a class="zem_slink" title="Microsoft" href="http://maps.google.com/maps?ll=47.6395972222,-122.12845&amp;spn=1.0,1.0&amp;q=47.6395972222,-122.12845 (Microsoft)&amp;t=h" rel="geolocation">Microsoft</a>\Microsoft SQL Server\MSSQL.#</p>
<p>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\ MSSQL.#\ MSSQLServer\ SuperSocketNetLib\TCP\IPAll</p>
<p><strong><a class="zem_slink" title="Microsoft SQL Server" href="http://www.microsoft.com/sqlserver" rel="homepage">SQL Server 2008</a><br />
</strong><strong><em>Default instance</em><br />
</strong>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQLServer\SuperSocketNetLib\TCP\IPAll</p>
<p><strong><em>Named instance</em><br />
</strong>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.(InstanceName)\MSSQLServer\SuperSocketNetLib\TCP\IPAll</p>
<p><span style="text-decoration:underline;"><strong>Soln 3# <a class="zem_slink" title="Data logger" href="http://en.wikipedia.org/wiki/Data_logger" rel="wikipedia">Error Log</a><br />
</strong></span>Query the error log as below to get the port number.</p>
<p>EXEC xp_readerrorlog 0,1,&#8221;Server is listening on&#8221;,Null</p>
<p><span style="text-decoration:underline;"><strong>Soln 4# Command Prompts<br />
</strong></span>Execute the below command from the command prompt.</p>
<p>Netstat -abn<span style="text-decoration:underline;"><br />
</span></p>
<br />Filed under: <a href='http://sqldbpool.com/category/notes/sql-scripts/'>SQL Scripts</a>, <a href='http://sqldbpool.com/category/notes/sql-server-notes/'>SQL Server</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2008/'>SQL Server 2008</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2008-r2/'>SQL Server 2008 R2</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2011-denali/'>SQL Server 2011 (Denali)</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqldbpool.wordpress.com/1593/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqldbpool.wordpress.com/1593/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqldbpool.wordpress.com/1593/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqldbpool.wordpress.com/1593/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqldbpool.wordpress.com/1593/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqldbpool.wordpress.com/1593/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqldbpool.wordpress.com/1593/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqldbpool.wordpress.com/1593/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqldbpool.wordpress.com/1593/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqldbpool.wordpress.com/1593/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqldbpool.wordpress.com/1593/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqldbpool.wordpress.com/1593/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqldbpool.wordpress.com/1593/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqldbpool.wordpress.com/1593/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1593&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqldbpool.com/2012/01/18/different-ways-to-check-the-sql-server-instance-port-number/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<georss:point>18.520469 73.856621</georss:point>
		<geo:lat>18.520469</geo:lat>
		<geo:long>73.856621</geo:long>
		<media:content url="http://0.gravatar.com/avatar/246a03e5bd256f9361fdf78e944f9c3d?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JShah</media:title>
		</media:content>
	</item>
		<item>
		<title>Performance Tuning Series</title>
		<link>http://sqldbpool.com/2012/01/06/performance-tuning-series/</link>
		<comments>http://sqldbpool.com/2012/01/06/performance-tuning-series/#comments</comments>
		<pubDate>Fri, 06 Jan 2012 07:56:24 +0000</pubDate>
		<dc:creator>Jugal Shah</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://sqldbpool.wordpress.com/?p=1586</guid>
		<description><![CDATA[Lock Pages in Memory You can prevent the Windows operating system from paging out the buffer pool memory of the SQL Server process by locking the memory that is allocated for the buffer pool in physical memory. You lock the memory by assigning the Lock pages in memory user right to the user account that [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1586&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img src="http://sqldbpool.files.wordpress.com/2012/01/010612_0755_performance1.png?w=630" alt="" />
	</p>
<p><img src="http://sqldbpool.files.wordpress.com/2012/01/010612_0755_performance2.png?w=630" alt="" />
	</p>
<p><img src="http://sqldbpool.files.wordpress.com/2012/01/010612_0755_performance3.png?w=630" alt="" />
	</p>
<p><img src="http://sqldbpool.files.wordpress.com/2012/01/010612_0755_performance4.png?w=630" alt="" />
	</p>
<p><strong>Lock Pages in Memory</strong>
	</p>
<p>You can prevent the Windows operating system from paging out the buffer pool memory of the SQL Server process by locking the memory that is allocated for the buffer pool in physical memory. You lock the memory by assigning the <strong>Lock pages in memory</strong> user right to the user account that is used as the startup account of the SQL Server service.
</p>
<p><strong>Model Database </strong>Whenever we create a new database, it will use model as template. Configure model DB for the Auto Shrink OFF, Auto Update/Create Statistics on
</p>
<p><strong>Maximum Worker Threads:</strong>  Based on the load increase the maximum work thread.<strong><br />
		</strong>
	</p>
<p>Address Windowing Extensions (AWE) is an API that allows a 32-bit application to manipulate physical memory beyond 4 GB memory limit. The AWE mechanism technically is not necessary on 64-bit platform. It is, however, present there. Memory pages that are allocated through the AWE mechanism are referred as <em>locked pages</em> on the 64-bit platform.
</p>
<p>On both 32-bit and 64-bit platforms, memory that is allocated through the AWE mechanism cannot be paged out. This can be beneficial to the application. (This is one of the reasons for using AWE mechanism on 64-bit platform.) This also affects the amount of RAM that is available to the system and to other applications, which might have detrimental effects. For this reason, in order to use AWE, the <strong>Lock Pages in Memory</strong> privilege must be granted for the account that runs SQL Server.
</p>
<p>
 </p>
<p><img src="http://sqldbpool.files.wordpress.com/2012/01/010612_0755_performance5.png?w=630" alt="" />
	</p>
<p>
 </p>
<p><strong>Please note:<br />
</strong></p>
<ul>
<li>Turn auto-shrink off.
</li>
<li>Make sure auto-update of statistics is turned on.
</li>
<li>If a database is read only, set it to read only.
</li>
<li>Use triggers very judiciously. They mostly operate in the background making them difficult to monitor and troubleshoot.
</li>
<li>Be very careful of auto growth settings on the database. 10% auto growth will be fine when the database is 500mb. It makes a huge difference when the system is 50gb. For larger databases, change the setting to grow by a fixed amount rather than a percentage of total database size.
</li>
<li><strong>Files and FileGroups </strong>
		</li>
<li>Other factors that can affect the performance of your system include the way the files and file groups are laid out. You should be creating multiple files for your databases to optimize performance. A baseline for this would be to create one file for the logs, another for the data (defined by the clustered index), and another for non-clustered indexes. Additional files may be necessary to separate out BLOB data or XML data or unusually active tables, each onto its own file, and where possible, onto its own disk. This has been found to be true even on SAN systems because distributing the load takes further advantage of the architecture of the SAN.
</li>
<li><strong>Data Types </strong>
		</li>
<li>Define the data types that you need, not what you think you might need someday. A phone number is a string, not a number. Define the length of field that you need and enforce that length.
</li>
</ul>
<p><img src="http://sqldbpool.files.wordpress.com/2012/01/010612_0755_performance6.png?w=630" alt="" />
	</p>
<p><img src="http://sqldbpool.files.wordpress.com/2012/01/010612_0755_performance7.png?w=630" alt="" />.
</p>
<p><img src="http://sqldbpool.files.wordpress.com/2012/01/010612_0755_performance8.png?w=630" alt="" />
	</p>
<p><img src="http://sqldbpool.files.wordpress.com/2012/01/010612_0755_performance9.png?w=630" alt="" />
	</p>
<p><img src="http://sqldbpool.files.wordpress.com/2012/01/010612_0755_performance10.png?w=630" alt="" />
	</p>
<p><img src="http://sqldbpool.files.wordpress.com/2012/01/010612_0755_performance11.png?w=630" alt="" />
	</p>
<p><img src="http://sqldbpool.files.wordpress.com/2012/01/010612_0755_performance12.png?w=630" alt="" />
	</p>
<br />Filed under: <a href='http://sqldbpool.com/category/notes/sql-server-notes/'>SQL Server</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqldbpool.wordpress.com/1586/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqldbpool.wordpress.com/1586/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqldbpool.wordpress.com/1586/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqldbpool.wordpress.com/1586/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqldbpool.wordpress.com/1586/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqldbpool.wordpress.com/1586/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqldbpool.wordpress.com/1586/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqldbpool.wordpress.com/1586/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqldbpool.wordpress.com/1586/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqldbpool.wordpress.com/1586/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqldbpool.wordpress.com/1586/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqldbpool.wordpress.com/1586/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqldbpool.wordpress.com/1586/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqldbpool.wordpress.com/1586/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1586&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqldbpool.com/2012/01/06/performance-tuning-series/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/246a03e5bd256f9361fdf78e944f9c3d?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JShah</media:title>
		</media:content>

		<media:content url="http://sqldbpool.files.wordpress.com/2012/01/010612_0755_performance1.png" medium="image" />

		<media:content url="http://sqldbpool.files.wordpress.com/2012/01/010612_0755_performance2.png" medium="image" />

		<media:content url="http://sqldbpool.files.wordpress.com/2012/01/010612_0755_performance3.png" medium="image" />

		<media:content url="http://sqldbpool.files.wordpress.com/2012/01/010612_0755_performance4.png" medium="image" />

		<media:content url="http://sqldbpool.files.wordpress.com/2012/01/010612_0755_performance5.png" medium="image" />

		<media:content url="http://sqldbpool.files.wordpress.com/2012/01/010612_0755_performance6.png" medium="image" />

		<media:content url="http://sqldbpool.files.wordpress.com/2012/01/010612_0755_performance7.png" medium="image" />

		<media:content url="http://sqldbpool.files.wordpress.com/2012/01/010612_0755_performance8.png" medium="image" />

		<media:content url="http://sqldbpool.files.wordpress.com/2012/01/010612_0755_performance9.png" medium="image" />

		<media:content url="http://sqldbpool.files.wordpress.com/2012/01/010612_0755_performance10.png" medium="image" />

		<media:content url="http://sqldbpool.files.wordpress.com/2012/01/010612_0755_performance11.png" medium="image" />

		<media:content url="http://sqldbpool.files.wordpress.com/2012/01/010612_0755_performance12.png" medium="image" />
	</item>
		<item>
		<title>Happy New Year 2012</title>
		<link>http://sqldbpool.com/2011/12/31/happy-new-year-2012/</link>
		<comments>http://sqldbpool.com/2011/12/31/happy-new-year-2012/#comments</comments>
		<pubDate>Sat, 31 Dec 2011 18:01:18 +0000</pubDate>
		<dc:creator>Jugal Shah</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://sqldbpool.com/?p=1570</guid>
		<description><![CDATA[Dear Readers, Wish you all very happy and prosperous New Year 2012. Thanks, Jugal Shah Filed under: SQL Server<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1570&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Dear Readers,</strong></p>
<p>Wish you all very happy and prosperous New Year 2012.</p>
<p><a href="http://sqldbpool.files.wordpress.com/2011/12/happy-5.gif"><img src="http://sqldbpool.files.wordpress.com/2011/12/happy-5.gif?w=630" alt="" title="happy 5"   class="alignnone size-full wp-image-1571" /></a></p>
<p>Thanks,<br />
Jugal Shah</p>
<br />Filed under: <a href='http://sqldbpool.com/category/notes/sql-server-notes/'>SQL Server</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqldbpool.wordpress.com/1570/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqldbpool.wordpress.com/1570/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqldbpool.wordpress.com/1570/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqldbpool.wordpress.com/1570/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqldbpool.wordpress.com/1570/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqldbpool.wordpress.com/1570/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqldbpool.wordpress.com/1570/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqldbpool.wordpress.com/1570/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqldbpool.wordpress.com/1570/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqldbpool.wordpress.com/1570/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqldbpool.wordpress.com/1570/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqldbpool.wordpress.com/1570/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqldbpool.wordpress.com/1570/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqldbpool.wordpress.com/1570/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1570&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqldbpool.com/2011/12/31/happy-new-year-2012/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<georss:point>18.520469 73.856621</georss:point>
		<geo:lat>18.520469</geo:lat>
		<geo:long>73.856621</geo:long>
		<media:content url="http://0.gravatar.com/avatar/246a03e5bd256f9361fdf78e944f9c3d?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JShah</media:title>
		</media:content>

		<media:content url="http://sqldbpool.files.wordpress.com/2011/12/happy-5.gif" medium="image">
			<media:title type="html">happy 5</media:title>
		</media:content>
	</item>
		<item>
		<title>Basics of Replication Troubleshooting</title>
		<link>http://sqldbpool.com/2011/12/30/basics-of-replication-troubleshooting/</link>
		<comments>http://sqldbpool.com/2011/12/30/basics-of-replication-troubleshooting/#comments</comments>
		<pubDate>Fri, 30 Dec 2011 11:32:26 +0000</pubDate>
		<dc:creator>Jugal Shah</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>
		<category><![CDATA[msrepl_commands]]></category>
		<category><![CDATA[Replication Troubleshooting]]></category>
		<category><![CDATA[SP_BROWSEREPLCMDS]]></category>

		<guid isPermaLink="false">http://sqldbpool.com/?p=1563</guid>
		<description><![CDATA[There are many scenarios where you have been alerted for the replication failure and you have to troubleshoot the issue. In this article I will guide you what should be your approach to get the detailed error message and transaction details in replication. First check the replication monitor and click on the failed publisher. Next [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1563&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There are many scenarios where you have been alerted for the replication failure and you have to troubleshoot the issue. In this article I will guide you what should be your approach to get the detailed error message and transaction details in replication.</p>
<p>First check the replication monitor and click on the <strong>failed publisher</strong>. Next step is double click on the failed subscriber from <strong>All Subscriptions</strong> list.</p>
<p><a href="http://sqldbpool.files.wordpress.com/2011/12/repl.jpg"><img src="http://sqldbpool.files.wordpress.com/2011/12/repl.jpg?w=630&#038;h=216" alt="" title="Repl" width="630" height="216" class="alignnone size-full wp-image-1564" /></a></p>
<p>Now next step is click on the error and check its description.<br />
<strong>Error :</strong><br />
<strong>Command attempted:</strong><br />
if @@trancount &gt; 0 rollback tran<br />
(Transaction sequence number: 0x0000044100002D93000100000000, Command ID: 1)</p>
<p>From the above error message we have to identify which command is failed to execute on the subscriber.</p>
<p>To get the exact command, find out the distributer server and distribution database for the failed publisher.</p>
<p>Once you get the distribution database server, execute the below query against the distribution DB.</p>
<p><pre class="brush: sql;">
use distribution
go
SELECT * FROM msrepl_commands
WHERE xact_seqno = 0x0000044100002D93000100000000
AND command_id = 1
</pre><br />
Once you execute the above query against the distribution database, you will get the more information about the error, for example Publisher database ID, Article ID and much more&#8230;</p>
<p><a href="http://sqldbpool.files.wordpress.com/2011/12/repl1.jpg"><img src="http://sqldbpool.files.wordpress.com/2011/12/repl1.jpg?w=630&#038;h=125" alt="" title="Repl" width="630" height="125" class="alignnone size-full wp-image-1565" /></a></p>
<p>We have to use the above details, to get the exact command using either <strong>SP_BROWSEREPLCMDS </strong>(If CLR is enabled) or you can cast the <strong>command column</strong> in <strong>msrepl_commands</strong> table.</p>
<p>We will check both the alternatives.</p>
<p><em>Using <strong>SP_BROWSEREPLCMDS </strong></em><br />
Please note CLR must be enabled for to use this procedure.</p>
<p><pre class="brush: sql;">
EXEC SP_BROWSEREPLCMDS
@xact_seqno_start = '0x0000044100002D930001',
@xact_seqno_end = '0x0000044100002D930001',
@publisher_database_id = 1033,
@article_id = 12,
@command_id= 1
</pre></p>
<p><a href="http://sqldbpool.files.wordpress.com/2011/12/repl2.jpg"><img src="http://sqldbpool.files.wordpress.com/2011/12/repl2.jpg?w=630&#038;h=109" alt="" title="Repl" width="630" height="109" class="alignnone size-full wp-image-1566" /></a></p>
<p><em>By casting <strong>command column</strong> in <strong>msrepl_commands</strong> table </em></p>
<p>Please note if you want to see the better output use the <strong>Result to Text</strong> as output in SSMS (CTRL + T)</p>
<p><pre class="brush: sql;">
SELECT CAST(SUBSTRING(command, 7, 8000) AS NVARCHAR(MAX))
FROM msrepl_commands
WHERE xact_seqno = 0x0000044100002D930001
AND command_id = 1
</pre><br />
<a href="http://sqldbpool.files.wordpress.com/2011/12/repl3.jpg"><img src="http://sqldbpool.files.wordpress.com/2011/12/repl3.jpg?w=630&#038;h=186" alt="" title="Repl" width="630" height="186" class="alignnone size-full wp-image-1567" /></a></p>
<p>Now you got the exact SQL Command. As a next step check the objects from both the publisher and the subscriber to see the violation of the keys or do the data comparisons etc. </p>
<br />Filed under: <a href='http://sqldbpool.com/category/notes/sql-server-notes/'>SQL Server</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2008/'>SQL Server 2008</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2008-r2/'>SQL Server 2008 R2</a> Tagged: <a href='http://sqldbpool.com/tag/msrepl_commands/'>msrepl_commands</a>, <a href='http://sqldbpool.com/tag/replication-troubleshooting/'>Replication Troubleshooting</a>, <a href='http://sqldbpool.com/tag/sp_browsereplcmds/'>SP_BROWSEREPLCMDS</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqldbpool.wordpress.com/1563/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqldbpool.wordpress.com/1563/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqldbpool.wordpress.com/1563/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqldbpool.wordpress.com/1563/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqldbpool.wordpress.com/1563/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqldbpool.wordpress.com/1563/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqldbpool.wordpress.com/1563/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqldbpool.wordpress.com/1563/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqldbpool.wordpress.com/1563/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqldbpool.wordpress.com/1563/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqldbpool.wordpress.com/1563/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqldbpool.wordpress.com/1563/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqldbpool.wordpress.com/1563/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqldbpool.wordpress.com/1563/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1563&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqldbpool.com/2011/12/30/basics-of-replication-troubleshooting/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<georss:point>18.520469 73.856621</georss:point>
		<geo:lat>18.520469</geo:lat>
		<geo:long>73.856621</geo:long>
		<media:content url="http://0.gravatar.com/avatar/246a03e5bd256f9361fdf78e944f9c3d?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JShah</media:title>
		</media:content>

		<media:content url="http://sqldbpool.files.wordpress.com/2011/12/repl.jpg" medium="image">
			<media:title type="html">Repl</media:title>
		</media:content>

		<media:content url="http://sqldbpool.files.wordpress.com/2011/12/repl1.jpg" medium="image">
			<media:title type="html">Repl</media:title>
		</media:content>

		<media:content url="http://sqldbpool.files.wordpress.com/2011/12/repl2.jpg" medium="image">
			<media:title type="html">Repl</media:title>
		</media:content>

		<media:content url="http://sqldbpool.files.wordpress.com/2011/12/repl3.jpg" medium="image">
			<media:title type="html">Repl</media:title>
		</media:content>
	</item>
		<item>
		<title>Script to Monitor the Running Job Status</title>
		<link>http://sqldbpool.com/2011/12/27/script-to-monitor-the-running-job-status/</link>
		<comments>http://sqldbpool.com/2011/12/27/script-to-monitor-the-running-job-status/#comments</comments>
		<pubDate>Tue, 27 Dec 2011 11:36:31 +0000</pubDate>
		<dc:creator>Jugal Shah</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://sqldbpool.wordpress.com/?p=1561</guid>
		<description><![CDATA[Think of environment where multiple jobs are running at the same time and you want to monitor the current status of each job. One option is to use the job activity monitor.   And another way is you can use the below system stored procedures by running it against the MSDB database.   exec msdb..sp_get_composite_job_info [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1561&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Think of environment where multiple jobs are running at the same time and you want to monitor the current status of each job.  One option is to use the job activity monitor.
</p>
<p>
 </p>
<p><img src="http://sqldbpool.files.wordpress.com/2011/12/122711_1136_scripttomon1.png?w=630" alt="" />
	</p>
<p>And another way is you can use the below system stored procedures by running it against the MSDB database.
</p>
<p>
 </p>
<p><span style="font-family:Courier New;font-size:10pt;"><span style="color:blue;">exec</span> msdb..<span style="color:maroon;">sp_get_composite_job_info</span><span style="color:blue;"><br />
			</span>@execution_status<span style="color:gray;">=</span>1<br />
</span></p>
<p><span style="font-family:Courier New;font-size:10pt;"><span style="color:blue;">exec</span> msdb<span style="color:gray;">.</span>dbo<span style="color:gray;">.</span><span style="color:maroon;">sp_help_job</span><span style="color:blue;"><br />
			</span>@execution_status <span style="color:gray;">=</span> 1<br />
</span></p>
<p>
 </p>
<p>You can check the job execution status parameter values as below.
</p>
<p>0 = Not idle or suspended
</p>
<p>1 = Executing
</p>
<p>2 = Waiting For Thread
</p>
<p>3 = Between Retries
</p>
<p>4 = Idle
</p>
<p>5 = Suspended
</p>
<p>6 = Waiting For Step To Finish
</p>
<p>7 = Performing Completion Actions
</p>
<p>
 </p>
<br />Filed under: <a href='http://sqldbpool.com/category/notes/sql-server-notes/'>SQL Server</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqldbpool.wordpress.com/1561/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqldbpool.wordpress.com/1561/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqldbpool.wordpress.com/1561/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqldbpool.wordpress.com/1561/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqldbpool.wordpress.com/1561/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqldbpool.wordpress.com/1561/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqldbpool.wordpress.com/1561/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqldbpool.wordpress.com/1561/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqldbpool.wordpress.com/1561/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqldbpool.wordpress.com/1561/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqldbpool.wordpress.com/1561/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqldbpool.wordpress.com/1561/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqldbpool.wordpress.com/1561/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqldbpool.wordpress.com/1561/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1561&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqldbpool.com/2011/12/27/script-to-monitor-the-running-job-status/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/246a03e5bd256f9361fdf78e944f9c3d?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JShah</media:title>
		</media:content>

		<media:content url="http://sqldbpool.files.wordpress.com/2011/12/122711_1136_scripttomon1.png" medium="image" />
	</item>
		<item>
		<title>Different ways to monitor Log Shipping for SQL Server databases</title>
		<link>http://sqldbpool.com/2011/12/21/different-ways-to-monitor-log-shipping-for-sql-server-databases/</link>
		<comments>http://sqldbpool.com/2011/12/21/different-ways-to-monitor-log-shipping-for-sql-server-databases/#comments</comments>
		<pubDate>Wed, 21 Dec 2011 13:22:54 +0000</pubDate>
		<dc:creator>Jugal Shah</dc:creator>
				<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>
		<category><![CDATA[Monitor LogShipping]]></category>
		<category><![CDATA[Troubleshooting LogShipping]]></category>

		<guid isPermaLink="false">http://sqldbpool.com/?p=1554</guid>
		<description><![CDATA[Problem Log shipping has been an option for creating a fail over server for SQL Server for quite some time. In this tip, we look at different ways that you can monitor the status of your log shipped databases. Solution http://www.mssqltips.com/sqlservertip/2553/different-ways-to-monitor-log-shipping-for-sql-server-databases/ Filed under: SQL Server 2008, SQL Server 2008 R2 Tagged: Monitor LogShipping, Troubleshooting LogShipping<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1554&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong><br />
Log shipping has been an option for creating a fail over server for SQL Server for quite some time.  In this tip, we look at different ways that you can monitor the status of your log shipped databases.</p>
<p><strong>Solution</strong><a href="http://www.mssqltips.com/sqlservertip/2553/different-ways-to-monitor-log-shipping-for-sql-server-databases/" target="_blank"></p>
<p>http://www.mssqltips.com/sqlservertip/2553/different-ways-to-monitor-log-shipping-for-sql-server-databases/</a></p>
<br />Filed under: <a href='http://sqldbpool.com/category/notes/sql-server-2008/'>SQL Server 2008</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2008-r2/'>SQL Server 2008 R2</a> Tagged: <a href='http://sqldbpool.com/tag/monitor-logshipping/'>Monitor LogShipping</a>, <a href='http://sqldbpool.com/tag/troubleshooting-logshipping/'>Troubleshooting LogShipping</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqldbpool.wordpress.com/1554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqldbpool.wordpress.com/1554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqldbpool.wordpress.com/1554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqldbpool.wordpress.com/1554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqldbpool.wordpress.com/1554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqldbpool.wordpress.com/1554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqldbpool.wordpress.com/1554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqldbpool.wordpress.com/1554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqldbpool.wordpress.com/1554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqldbpool.wordpress.com/1554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqldbpool.wordpress.com/1554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqldbpool.wordpress.com/1554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqldbpool.wordpress.com/1554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqldbpool.wordpress.com/1554/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1554&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqldbpool.com/2011/12/21/different-ways-to-monitor-log-shipping-for-sql-server-databases/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<georss:point>18.520469 73.856621</georss:point>
		<geo:lat>18.520469</geo:lat>
		<geo:long>73.856621</geo:long>
		<media:content url="http://0.gravatar.com/avatar/246a03e5bd256f9361fdf78e944f9c3d?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JShah</media:title>
		</media:content>
	</item>
		<item>
		<title>Steps to Attach a SQL Server database without transaction log file</title>
		<link>http://sqldbpool.com/2011/12/20/steps-to-attach-a-sql-server-database-without-transaction-log-file/</link>
		<comments>http://sqldbpool.com/2011/12/20/steps-to-attach-a-sql-server-database-without-transaction-log-file/#comments</comments>
		<pubDate>Tue, 20 Dec 2011 08:04:06 +0000</pubDate>
		<dc:creator>Jugal Shah</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>
		<category><![CDATA[SQL Server 2011 (Denali)]]></category>
		<category><![CDATA[Attach Database]]></category>
		<category><![CDATA[Create database]]></category>
		<category><![CDATA[Delete file using SSMS]]></category>
		<category><![CDATA[Detach Database]]></category>

		<guid isPermaLink="false">http://sqldbpool.com/?p=1552</guid>
		<description><![CDATA[Problem: There could be situation where you missed the database transaction log file(.LDF) and you have only data file (.MDF). You can attach the database using below solution. Solution: In the below script I have created the database,dropped its log file and created the database with the .mdf file. When you will execute the CREATE [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1552&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Problem:</strong> There could be situation where you missed the database transaction log file(.LDF) and you have only data file (.MDF). You can attach the database using below solution.</p>
<p><strong>Solution:</strong> In the below script I have created the database,dropped its log file and created the database with the .mdf file.</p>
<p><pre class="brush: sql;">
--created database with .mdf and .ldf file
CREATE DATABASE [singleFileDemo] ON  PRIMARY 
( NAME = N'singleFileDemo', FILENAME = N'L:\singleFileDemo.mdf' , SIZE = 2048KB , FILEGROWTH = 10240KB )
 LOG ON 
( NAME = N'singleFileDemo_log', FILENAME = N'F:\singleFileDemo_log.ldf' , SIZE = 1024KB , FILEGROWTH = 5120KB )
GO

--inserting data into database
use singleFileDemo
create table tb1 (name varchar(10))

--inserting records
insert into tb1 values('Jugal')
go 10;

--deleting the log file
--detaching the database file
USE [master]
GO
EXEC master.dbo.sp_detach_db @dbname = N'singleFileDemo'
GO

-- now next step is delete the file manually or you can do it from command prompt
EXEC xp_cmdshell 'del F:\singleFileDemo_log.ldf'

-- script to attach the database 
USE [master]
GO
CREATE DATABASE [singleFileDemo] ON 
( FILENAME = N'L:\singleFileDemo.mdf' )
FOR ATTACH
GO 
</pre></p>
<p>When you will execute the CREATE DATABASE FOR Attach script you will get the below warning message.</p>
<p><code>File activation failure. The physical file name "F:\singleFileDemo_log.ldf" may be incorrect.<br />
New log file 'F:\singleFileDemo_log.LDF' was created.</code></p>
<p>Once the database is ready execute the DBCC CHECKDB for any error.</p>
<br />Filed under: <a href='http://sqldbpool.com/category/notes/database/'>Database</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2008/'>SQL Server 2008</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2008-r2/'>SQL Server 2008 R2</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2011-denali/'>SQL Server 2011 (Denali)</a> Tagged: <a href='http://sqldbpool.com/tag/attach-database/'>Attach Database</a>, <a href='http://sqldbpool.com/tag/create-database/'>Create database</a>, <a href='http://sqldbpool.com/tag/delete-file-using-ssms/'>Delete file using SSMS</a>, <a href='http://sqldbpool.com/tag/detach-database/'>Detach Database</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqldbpool.wordpress.com/1552/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqldbpool.wordpress.com/1552/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqldbpool.wordpress.com/1552/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqldbpool.wordpress.com/1552/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqldbpool.wordpress.com/1552/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqldbpool.wordpress.com/1552/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqldbpool.wordpress.com/1552/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqldbpool.wordpress.com/1552/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqldbpool.wordpress.com/1552/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqldbpool.wordpress.com/1552/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqldbpool.wordpress.com/1552/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqldbpool.wordpress.com/1552/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqldbpool.wordpress.com/1552/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqldbpool.wordpress.com/1552/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1552&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqldbpool.com/2011/12/20/steps-to-attach-a-sql-server-database-without-transaction-log-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<georss:point>18.520469 73.856621</georss:point>
		<geo:lat>18.520469</geo:lat>
		<geo:long>73.856621</geo:long>
		<media:content url="http://0.gravatar.com/avatar/246a03e5bd256f9361fdf78e944f9c3d?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JShah</media:title>
		</media:content>
	</item>
		<item>
		<title>PathPing Command</title>
		<link>http://sqldbpool.com/2011/12/13/pathping-command/</link>
		<comments>http://sqldbpool.com/2011/12/13/pathping-command/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 15:47:46 +0000</pubDate>
		<dc:creator>Jugal Shah</dc:creator>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[pathping]]></category>

		<guid isPermaLink="false">http://sqldbpool.com/?p=1546</guid>
		<description><![CDATA[Pathping is a Windows based command-line tool used to provide information about the path data takes to its destination, network latency and network loss at intermediate hops between a source and destination. Example Filed under: Networking Tagged: pathping<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1546&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Pathping is a Windows based command-line tool used to provide information about the path data takes to its destination, network latency and network loss at intermediate hops between a source and destination.</p>
<p><a href="http://sqldbpool.files.wordpress.com/2011/12/pathping.jpg"><img src="http://sqldbpool.files.wordpress.com/2011/12/pathping.jpg?w=630&#038;h=263" alt="" title="pathping" width="630" height="263" class="alignnone size-full wp-image-1547" /></a></p>
<p><strong>Example</strong><br />
<a href="http://sqldbpool.files.wordpress.com/2011/12/pathping1.jpg"><img src="http://sqldbpool.files.wordpress.com/2011/12/pathping1.jpg?w=630&#038;h=313" alt="" title="pathping" width="630" height="313" class="alignnone size-full wp-image-1548" /></a></p>
<br />Filed under: <a href='http://sqldbpool.com/category/notes/networking/'>Networking</a> Tagged: <a href='http://sqldbpool.com/tag/pathping/'>pathping</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqldbpool.wordpress.com/1546/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqldbpool.wordpress.com/1546/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqldbpool.wordpress.com/1546/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqldbpool.wordpress.com/1546/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqldbpool.wordpress.com/1546/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqldbpool.wordpress.com/1546/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqldbpool.wordpress.com/1546/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqldbpool.wordpress.com/1546/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqldbpool.wordpress.com/1546/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqldbpool.wordpress.com/1546/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqldbpool.wordpress.com/1546/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqldbpool.wordpress.com/1546/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqldbpool.wordpress.com/1546/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqldbpool.wordpress.com/1546/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1546&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqldbpool.com/2011/12/13/pathping-command/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<georss:point>18.520469 73.856621</georss:point>
		<geo:lat>18.520469</geo:lat>
		<geo:long>73.856621</geo:long>
		<media:content url="http://0.gravatar.com/avatar/246a03e5bd256f9361fdf78e944f9c3d?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JShah</media:title>
		</media:content>

		<media:content url="http://sqldbpool.files.wordpress.com/2011/12/pathping.jpg" medium="image">
			<media:title type="html">pathping</media:title>
		</media:content>

		<media:content url="http://sqldbpool.files.wordpress.com/2011/12/pathping1.jpg" medium="image">
			<media:title type="html">pathping</media:title>
		</media:content>
	</item>
		<item>
		<title>Extended Stored Procedure xp_msver</title>
		<link>http://sqldbpool.com/2011/12/08/extended-stored-procedure-xp_msver/</link>
		<comments>http://sqldbpool.com/2011/12/08/extended-stored-procedure-xp_msver/#comments</comments>
		<pubDate>Thu, 08 Dec 2011 12:26:57 +0000</pubDate>
		<dc:creator>Jugal Shah</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>
		<category><![CDATA[SQL Server 2011 (Denali)]]></category>
		<category><![CDATA[how to get the server build information]]></category>
		<category><![CDATA[sql server version]]></category>
		<category><![CDATA[xp_msver]]></category>

		<guid isPermaLink="false">http://sqldbpool.com/?p=1540</guid>
		<description><![CDATA[xp_msver returns information about the SQL Server version, actual build number of the server and information about the server environment. You can also pass the parameter to get the specific information. Filed under: SQL Server, SQL Server 2008, SQL Server 2008 R2, SQL Server 2011 (Denali) Tagged: how to get the server build information, sql [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1540&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>xp_msver</strong> returns information about the SQL Server version, actual build number of the server and information about the server environment.</p>
<p><a href="http://sqldbpool.files.wordpress.com/2011/12/xp.jpg"><img src="http://sqldbpool.files.wordpress.com/2011/12/xp.jpg?w=630&#038;h=380" alt="" title="XP" width="630" height="380" class="alignnone size-full wp-image-1541" /></a></p>
<p>You can also pass the parameter to get the specific information.<br />
<a href="http://sqldbpool.files.wordpress.com/2011/12/xp1.jpg"><img src="http://sqldbpool.files.wordpress.com/2011/12/xp1.jpg?w=630" alt="" title="XP"   class="alignnone size-full wp-image-1542" /></a></p>
<br />Filed under: <a href='http://sqldbpool.com/category/notes/sql-server-notes/'>SQL Server</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2008/'>SQL Server 2008</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2008-r2/'>SQL Server 2008 R2</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2011-denali/'>SQL Server 2011 (Denali)</a> Tagged: <a href='http://sqldbpool.com/tag/how-to-get-the-server-build-information/'>how to get the server build information</a>, <a href='http://sqldbpool.com/tag/sql-server-version/'>sql server version</a>, <a href='http://sqldbpool.com/tag/xp_msver/'>xp_msver</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqldbpool.wordpress.com/1540/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqldbpool.wordpress.com/1540/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqldbpool.wordpress.com/1540/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqldbpool.wordpress.com/1540/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqldbpool.wordpress.com/1540/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqldbpool.wordpress.com/1540/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqldbpool.wordpress.com/1540/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqldbpool.wordpress.com/1540/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqldbpool.wordpress.com/1540/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqldbpool.wordpress.com/1540/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqldbpool.wordpress.com/1540/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqldbpool.wordpress.com/1540/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqldbpool.wordpress.com/1540/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqldbpool.wordpress.com/1540/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1540&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqldbpool.com/2011/12/08/extended-stored-procedure-xp_msver/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<georss:point>18.520469 73.856621</georss:point>
		<geo:lat>18.520469</geo:lat>
		<geo:long>73.856621</geo:long>
		<media:content url="http://0.gravatar.com/avatar/246a03e5bd256f9361fdf78e944f9c3d?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JShah</media:title>
		</media:content>

		<media:content url="http://sqldbpool.files.wordpress.com/2011/12/xp.jpg" medium="image">
			<media:title type="html">XP</media:title>
		</media:content>

		<media:content url="http://sqldbpool.files.wordpress.com/2011/12/xp1.jpg" medium="image">
			<media:title type="html">XP</media:title>
		</media:content>
	</item>
		<item>
		<title>Script to Enable/Disable Database for Replication</title>
		<link>http://sqldbpool.com/2011/12/02/script-to-enabledisable-database-for-replication/</link>
		<comments>http://sqldbpool.com/2011/12/02/script-to-enabledisable-database-for-replication/#comments</comments>
		<pubDate>Fri, 02 Dec 2011 07:33:08 +0000</pubDate>
		<dc:creator>Jugal Shah</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>
		<category><![CDATA[SQL Server 2011 (Denali)]]></category>
		<category><![CDATA[Enable/Disable Database for Replication]]></category>
		<category><![CDATA[replication]]></category>

		<guid isPermaLink="false">http://sqldbpool.com/?p=1536</guid>
		<description><![CDATA[You can enable the database for replication using below script. If you have restore the database on test environment and you are getting the error that &#8220;Database is part of Replication&#8221;, you can clear/disable it by executing below query. Filed under: Database, SQL Server, SQL Server 2008, SQL Server 2008 R2, SQL Server 2011 (Denali) [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1536&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>You can enable the database for replication using below script.<br />
<pre class="brush: sql;">
use master
exec sp_replicationdboption @dbname = 'sqldbpool',
@optname = 'publish',
@value = 'true'
go
</pre></p>
<p>If you have restore the database on test environment and you are getting the error that &#8220;Database is part of Replication&#8221;, you can clear/disable it by executing below query.<br />
<pre class="brush: sql;">
use master
exec sp_replicationdboption @dbname = 'sqldbpool',
@optname = 'publish',
@value = 'false'
go
</pre></p>
<br />Filed under: <a href='http://sqldbpool.com/category/notes/database/'>Database</a>, <a href='http://sqldbpool.com/category/notes/sql-server-notes/'>SQL Server</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2008/'>SQL Server 2008</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2008-r2/'>SQL Server 2008 R2</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2011-denali/'>SQL Server 2011 (Denali)</a> Tagged: <a href='http://sqldbpool.com/tag/enabledisable-database-for-replication/'>Enable/Disable Database for Replication</a>, <a href='http://sqldbpool.com/tag/replication/'>replication</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqldbpool.wordpress.com/1536/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqldbpool.wordpress.com/1536/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqldbpool.wordpress.com/1536/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqldbpool.wordpress.com/1536/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqldbpool.wordpress.com/1536/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqldbpool.wordpress.com/1536/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqldbpool.wordpress.com/1536/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqldbpool.wordpress.com/1536/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqldbpool.wordpress.com/1536/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqldbpool.wordpress.com/1536/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqldbpool.wordpress.com/1536/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqldbpool.wordpress.com/1536/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqldbpool.wordpress.com/1536/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqldbpool.wordpress.com/1536/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1536&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqldbpool.com/2011/12/02/script-to-enabledisable-database-for-replication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<georss:point>18.520469 73.856621</georss:point>
		<geo:lat>18.520469</geo:lat>
		<geo:long>73.856621</geo:long>
		<media:content url="http://0.gravatar.com/avatar/246a03e5bd256f9361fdf78e944f9c3d?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JShah</media:title>
		</media:content>
	</item>
		<item>
		<title>Steps to change the server name for a SQL Server machine</title>
		<link>http://sqldbpool.com/2011/11/25/steps-to-change-the-server-name-for-a-sql-server-machine/</link>
		<comments>http://sqldbpool.com/2011/11/25/steps-to-change-the-server-name-for-a-sql-server-machine/#comments</comments>
		<pubDate>Fri, 25 Nov 2011 06:37:57 +0000</pubDate>
		<dc:creator>Jugal Shah</dc:creator>
				<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>
		<category><![CDATA[SQL Server 2011 (Denali)]]></category>
		<category><![CDATA[Change Instance Name]]></category>
		<category><![CDATA[Rename Instance]]></category>

		<guid isPermaLink="false">http://sqldbpool.com/?p=1532</guid>
		<description><![CDATA[ProblemIn this tip we look at the steps within SQL Server you need to follow if you change the physical server name for a standalone SQL Server. Solution http://www.mssqltips.com/sqlservertip/2525/steps-to-change-the-server-name-for-a-sql-server-machine/ Filed under: SQL Server 2008, SQL Server 2008 R2, SQL Server 2011 (Denali) Tagged: Change Instance Name, Rename Instance<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1532&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong>In this tip we look at the steps within SQL Server you need to follow if you change the physical server name for a standalone SQL Server.</p>
<p><strong>Solution</strong><br />
<a href="http://www.mssqltips.com/sqlservertip/2525/steps-to-change-the-server-name-for-a-sql-server-machine/" target="_blank">http://www.mssqltips.com/sqlservertip/2525/steps-to-change-the-server-name-for-a-sql-server-machine/</a></p>
<br />Filed under: <a href='http://sqldbpool.com/category/notes/sql-server-2008/'>SQL Server 2008</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2008-r2/'>SQL Server 2008 R2</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2011-denali/'>SQL Server 2011 (Denali)</a> Tagged: <a href='http://sqldbpool.com/tag/change-instance-name/'>Change Instance Name</a>, <a href='http://sqldbpool.com/tag/rename-instance/'>Rename Instance</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqldbpool.wordpress.com/1532/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqldbpool.wordpress.com/1532/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqldbpool.wordpress.com/1532/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqldbpool.wordpress.com/1532/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqldbpool.wordpress.com/1532/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqldbpool.wordpress.com/1532/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqldbpool.wordpress.com/1532/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqldbpool.wordpress.com/1532/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqldbpool.wordpress.com/1532/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqldbpool.wordpress.com/1532/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqldbpool.wordpress.com/1532/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqldbpool.wordpress.com/1532/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqldbpool.wordpress.com/1532/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqldbpool.wordpress.com/1532/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1532&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqldbpool.com/2011/11/25/steps-to-change-the-server-name-for-a-sql-server-machine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<georss:point>18.520469 73.856621</georss:point>
		<geo:lat>18.520469</geo:lat>
		<geo:long>73.856621</geo:long>
		<media:content url="http://0.gravatar.com/avatar/246a03e5bd256f9361fdf78e944f9c3d?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JShah</media:title>
		</media:content>
	</item>
		<item>
		<title>Transparent Data Encryption</title>
		<link>http://sqldbpool.com/2011/11/23/transparent-data-encryption/</link>
		<comments>http://sqldbpool.com/2011/11/23/transparent-data-encryption/#comments</comments>
		<pubDate>Wed, 23 Nov 2011 12:35:08 +0000</pubDate>
		<dc:creator>Jugal Shah</dc:creator>
				<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>
		<category><![CDATA[Transparent Data Encryption]]></category>

		<guid isPermaLink="false">http://sqldbpool.com/?p=1528</guid>
		<description><![CDATA[Question: Recently I got a question regarding Transparent Data Encryption (TDE) and how it works. Answer:Microsoft has introduced a new feature TDE (Transparent Data Encryption) from SQL Server 2008. TDE provides real time encryption of data and log files. Data is encrypted before it is written to disk; data is decrypted when it is read [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1528&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Question:</strong> Recently I got a question regarding Transparent Data Encryption (TDE) and how it works.<br />
<strong>Answer:</strong>Microsoft has introduced a new feature TDE (Transparent Data Encryption) from SQL Server 2008. TDE provides real time encryption of data and log files.  Data is encrypted before it is written to disk; data is decrypted when it is read from disk.</p>
<p>Main benefit of TDE is that it does not require any changes into existing application. TDE encrypt data using AES and 3DES encryption algorithms without having to change the applications that will be connecting to the database.</p>
<p>With TDE backup files and database files are encrypted and no one can access it without key.</p>
<p>Follow below 4 steps to implement the TDE on the particular database.<br />
• Create a master key<br />
• Create or obtain a certificate protected by the master key<br />
• Create a database encryption key and protect it by the certificate<br />
• Set the database to use encryption</p>
<p><strong>Create a Master Key</strong> A master key is a symmetric key that is used to create certificates and asymmetric keys.  You can create the Master Key using below script</p>
<p><pre class="brush: sql;">
--create a master key
USE master 
GO 
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'P@ssw0rd' 
</pre></p>
<p>Now next step is you have to create the <strong>server-based certificate </strong>which will be used to encrypt the database. You can create the certificate using below query.</p>
<p><pre class="brush: sql;">
--create a ceritificate
USE master;
CREATE CERTIFICATE sql_tdeDBcert 
WITH SUBJECT = 'TDE Certificate for SQL_tde database'
GO 
</pre></p>
<p>Here, I am creating sample database using below script, if you have already any test database you can use it.</p>
<p><pre class="brush: sql;">
--script to create a database
create database sql_tde

use sql_tde
go

--script to create sample table
create table fnInfo
(
	Id int primary key identity(1,1),
	CCNo varchar(16) constraint UK1 Unique,
	Name varchar(20)
)

--enter the sample data
insert into fnInfo values ('456333125','Jugal')
insert into fnInfo values ('1234568484','Sunil')
insert into fnInfo values ('1234789254','Chintan')

select * from fnInfo
</pre></p>
<p><strong>Create a Database Encryption Key</strong> A database encryption key is required for TDE. Here we will set the encryption for the database by creating a database encryption key and password using the certificate we created in the above step.<br />
<pre class="brush: sql;">
use sql_tde
GO 
create database encryption key
with algorithm = AES_128
encryption by server certificate sql_tdeDBcert
</pre></p>
<p>Now we will check for the backup scenario, whether we are able to restore it without key or not. I have executed below backup script to take the database backup.</p>
<p><pre class="brush: sql;">
----backup database
backup database sql_tde to disk = 'c:\sql_tde.bak'
</pre></p>
<p>Now I am restoring the database backup on the different machine without key and certificate. </p>
<p><pre class="brush: sql;">
----backup database
restore database sql_tde from disk = 'c:\sql_tde.bak'
</pre></p>
<p>Restore command is failed with the below error on the differnet machine.<br />
<pre class="brush: sql;">
Starting up database 'sql_tde'.
Error: 3283, Severity: 16, State: 1.
The file &quot;sql_tde_log&quot; failed to initialize correctly. Examine the error logs for more details.  
</pre></p>
<p>To restore the encrypted database backup on different SQL Server instance we have to export the certificate created on the SQL instance on which the encrypted database backup was created.<br />
You can export or transfer the certificate to a file. Use the below query for it.<br />
<pre class="brush: sql;">
USE master 
GO 
BACKUP CERTIFICATE sql_tdeDBcert  
TO FILE = 'C:\sql_tdeDBcert_cert.cer' 
WITH PRIVATE KEY (FILE = 'C:\sql_tdeDBcert_key.pvk' , 
ENCRYPTION BY PASSWORD = 'P@ssw0rd' ) 
GO 
</pre></p>
<p>Now move the files to destination server and import the certificate using below command. Please note that the password specified here in the <strong>DECRYPTION BY PASSWORD </strong>parameter is the same as that which used to export the certificate to a file.</p>
<p><pre class="brush: sql;">
CREATE CERTIFICATE sql_tdeDBcert 
FROM FILE = 'C:\sql_tdeDBcert_cert.cer' 
WITH PRIVATE KEY (FILE = 'C:\sql_tdeDBcert_key.pvk',  
DECRYPTION BY PASSWORD = 'P@ssw0rd'); 
GO  
</pre></p>
<p>You can restore the database now using below query.<br />
<pre class="brush: sql;">
----backup database
restore database sql_tde from disk = 'c:\sql_tde.bak'
</pre></p>
<br />Filed under: <a href='http://sqldbpool.com/category/notes/sql-server-2008/'>SQL Server 2008</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2008-r2/'>SQL Server 2008 R2</a> Tagged: <a href='http://sqldbpool.com/tag/transparent-data-encryption/'>Transparent Data Encryption</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqldbpool.wordpress.com/1528/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqldbpool.wordpress.com/1528/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqldbpool.wordpress.com/1528/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqldbpool.wordpress.com/1528/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqldbpool.wordpress.com/1528/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqldbpool.wordpress.com/1528/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqldbpool.wordpress.com/1528/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqldbpool.wordpress.com/1528/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqldbpool.wordpress.com/1528/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqldbpool.wordpress.com/1528/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqldbpool.wordpress.com/1528/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqldbpool.wordpress.com/1528/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqldbpool.wordpress.com/1528/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqldbpool.wordpress.com/1528/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1528&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqldbpool.com/2011/11/23/transparent-data-encryption/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<georss:point>18.520469 73.856621</georss:point>
		<geo:lat>18.520469</geo:lat>
		<geo:long>73.856621</geo:long>
		<media:content url="http://0.gravatar.com/avatar/246a03e5bd256f9361fdf78e944f9c3d?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JShah</media:title>
		</media:content>
	</item>
		<item>
		<title>Estimating the size of the Database backup file</title>
		<link>http://sqldbpool.com/2011/11/21/estimating-the-size-of-the-database-backup-file/</link>
		<comments>http://sqldbpool.com/2011/11/21/estimating-the-size-of-the-database-backup-file/#comments</comments>
		<pubDate>Mon, 21 Nov 2011 12:35:54 +0000</pubDate>
		<dc:creator>Jugal Shah</dc:creator>
				<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>

		<guid isPermaLink="false">http://sqldbpool.com/?p=1523</guid>
		<description><![CDATA[Problem: Often we would like to check how much size backup file will take on the disk? You can follow below simple steps to estimate the backup file size? Solution: Execute the SP_SPACEUSED procedure to get the database size statistics. USE [sqldbpool] GO EXEC sp_spaceused @updateusage = &#8216;true&#8217; Now you have to subtract the ununsed [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1523&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Problem: Often we would like to check how much size backup file will take on the disk? You can follow below simple steps to estimate the backup file size?</p>
<p>Solution:<br />
Execute the <strong>SP_SPACEUSED </strong>procedure to get the database size statistics.<br />
USE [sqldbpool]<br />
GO<br />
EXEC sp_spaceused @updateusage = &#8216;true&#8217;</p>
<p><a href="http://sqldbpool.files.wordpress.com/2011/11/ssms1.jpg"><img class="alignnone size-full wp-image-1524" title="SSMS" src="http://sqldbpool.files.wordpress.com/2011/11/ssms1.jpg?w=630" alt=""   /></a></p>
<p>Now you have to subtract the ununsed pages from reserved pages and divided by 1024 to get the output in MB.</p>
<p>In our scenario we have 2592 (KB) &#8211; 96 (KB) = 2496/1024 = 2.4374(MB) will be the backup size.</p>
<br />Filed under: <a href='http://sqldbpool.com/category/notes/database/'>Database</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2008/'>SQL Server 2008</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2008-r2/'>SQL Server 2008 R2</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqldbpool.wordpress.com/1523/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqldbpool.wordpress.com/1523/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqldbpool.wordpress.com/1523/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqldbpool.wordpress.com/1523/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqldbpool.wordpress.com/1523/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqldbpool.wordpress.com/1523/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqldbpool.wordpress.com/1523/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqldbpool.wordpress.com/1523/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqldbpool.wordpress.com/1523/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqldbpool.wordpress.com/1523/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqldbpool.wordpress.com/1523/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqldbpool.wordpress.com/1523/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqldbpool.wordpress.com/1523/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqldbpool.wordpress.com/1523/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1523&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqldbpool.com/2011/11/21/estimating-the-size-of-the-database-backup-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<georss:point>18.520469 73.856621</georss:point>
		<geo:lat>18.520469</geo:lat>
		<geo:long>73.856621</geo:long>
		<media:content url="http://0.gravatar.com/avatar/246a03e5bd256f9361fdf78e944f9c3d?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JShah</media:title>
		</media:content>

		<media:content url="http://sqldbpool.files.wordpress.com/2011/11/ssms1.jpg" medium="image">
			<media:title type="html">SSMS</media:title>
		</media:content>
	</item>
		<item>
		<title>Dedicated Administrator Connection</title>
		<link>http://sqldbpool.com/2011/11/18/dedicated-administrator-connection/</link>
		<comments>http://sqldbpool.com/2011/11/18/dedicated-administrator-connection/#comments</comments>
		<pubDate>Fri, 18 Nov 2011 11:28:15 +0000</pubDate>
		<dc:creator>Jugal Shah</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server Management Studio]]></category>
		<category><![CDATA[Dedicated Administrator Connection]]></category>
		<category><![CDATA[Microsoft SQL Server]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[SQL Server Express]]></category>
		<category><![CDATA[Select (SQL)]]></category>
		<category><![CDATA[FAQs Help and Tutorials]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://sqldbpool.com/?p=1516</guid>
		<description><![CDATA[DAC: Dedicated Administrator Connection feature is available from the SQL Server 2005. It is available in all the higher editions by default except express edition. DAC will be useful when SQL Server is not responding any connections; in such kind of situation DBA will connect through the DAC and troubleshoot/fix the issue. You can execute [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1516&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>DAC: </strong>Dedicated <a class="zem_slink" title="Database administrator" href="http://en.wikipedia.org/wiki/Database_administrator" rel="wikipedia">Administrator</a> Connection feature is available from the <a class="zem_slink" title="Microsoft SQL Server" href="http://www.microsoft.com/sqlserver" rel="homepage">SQL Server 2005</a>. It is available in all the higher editions by default except express edition. DAC will be useful when <a class="zem_slink" title="SQL" href="http://www.iso.org/iso/catalogue_detail.htm?csnumber=45498" rel="homepage">SQL</a> Server is not responding any connections; in such kind of situation DBA will connect through the DAC and troubleshoot/fix the issue.</p>
<p>You can execute below kind of command for the initial troubleshooting.</p>
<p><pre class="brush: sql;">
-- Locking Info
SELECT * FROM sys.dm_tran_locks
GO
-- Running Sessions
SELECT * FROM sys.dm_exec_sessions
GO
-- Requests Status
SELECT * FROM sys.dm_exec_requests
GO
--Open Sessions
SP_WHO2
--To get the SQL Text
DBCC OPENTRAN (SPID)
--To terminate the curlprit process
KILL SPID
</pre></p>
<p>DAC is disabled by default, it is a good practice to enable the DAC. You can enable the DAC using by executing below query.</p>
<p><pre class="brush: sql;">
Use master
GO
--0 = Allow Local Connection,
--1 = Allow Remote Connections*/
sp_configure 'remote admin connections', 1
GO
RECONFIGURE
GO
</pre></p>
<p>You can connect using DAC on of the following method.<br />
<a class="zem_slink" title="Command Prompt" href="http://en.wikipedia.org/wiki/Command_Prompt" rel="wikipedia">Command Prompt</a><br />
<a class="zem_slink" title="SQL Server Management Studio" href="http://en.wikipedia.org/wiki/SQL_Server_Management_Studio" rel="wikipedia">SQL Server Management Studio</a></p>
<p><strong>Using Command Prompt:</strong> Use SQLCMD utility to connect to SQL Server as below.<br />
-A <a class="zem_slink" title="Argument" href="http://en.wikipedia.org/wiki/Argument" rel="wikipedia">argument</a> is to specify the DAC connection.<br />
-S argument is to specify the server name.<br />
-d argument is to specify the database name.<br />
-E argument is for windows connection with integrated security true</p>
<p><a href="http://sqldbpool.files.wordpress.com/2011/11/sqlcmd.jpg"><img class="alignnone size-full wp-image-1517" title="sqlcmd" src="http://sqldbpool.files.wordpress.com/2011/11/sqlcmd.jpg?w=630" alt=""   /></a></p>
<p><strong>Using Management Studio:</strong> Write <strong>ADMIN: </strong>before the server name in management studio connection window. It will give you the DAC connection.<br />
<a href="http://sqldbpool.files.wordpress.com/2011/11/ssms.jpg"><img class="alignnone size-full wp-image-1518" title="SSMS" src="http://sqldbpool.files.wordpress.com/2011/11/ssms.jpg?w=630" alt=""   /></a></p>
<p>To enable the DAC connection in <strong><a class="zem_slink" title="SQL Server Express" href="http://en.wikipedia.org/wiki/SQL_Server_Express" rel="wikipedia">SQL Server express edition</a></strong> add <strong>;-T7806 </strong>trace flag as startup parameter.</p>
<p>Go into configuration manager &#8212; right click on SQL Server Service and select properties &#8212; go into advanced tab and add the trace flag <strong>;-T7806</strong>. Once done restart the SQL Server Services.</p>
<p><a href="http://sqldbpool.files.wordpress.com/2011/11/cm.jpg"><img class="alignnone size-full wp-image-1519" title="CM" src="http://sqldbpool.files.wordpress.com/2011/11/cm.jpg?w=630" alt=""   /></a></p>
<br />Filed under: <a href='http://sqldbpool.com/category/notes/sql-scripts/'>SQL Scripts</a>, <a href='http://sqldbpool.com/category/notes/sql-server-notes/'>SQL Server</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2008/'>SQL Server 2008</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2008-r2/'>SQL Server 2008 R2</a> Tagged: <a href='http://sqldbpool.com/tag/database/'>Database</a>, <a href='http://sqldbpool.com/tag/dedicated-administrator-connection/'>Dedicated Administrator Connection</a>, <a href='http://sqldbpool.com/tag/faqs-help-and-tutorials/'>FAQs Help and Tutorials</a>, <a href='http://sqldbpool.com/tag/microsoft/'>Microsoft</a>, <a href='http://sqldbpool.com/tag/microsoft-sql-server/'>Microsoft SQL Server</a>, <a href='http://sqldbpool.com/tag/select-sql/'>Select (SQL)</a>, <a href='http://sqldbpool.com/tag/sql/'>SQL</a>, <a href='http://sqldbpool.com/tag/sql-server-express/'>SQL Server Express</a>, <a href='http://sqldbpool.com/tag/sql-server-management-studio/'>SQL Server Management Studio</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqldbpool.wordpress.com/1516/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqldbpool.wordpress.com/1516/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqldbpool.wordpress.com/1516/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqldbpool.wordpress.com/1516/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqldbpool.wordpress.com/1516/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqldbpool.wordpress.com/1516/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqldbpool.wordpress.com/1516/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqldbpool.wordpress.com/1516/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqldbpool.wordpress.com/1516/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqldbpool.wordpress.com/1516/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqldbpool.wordpress.com/1516/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqldbpool.wordpress.com/1516/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqldbpool.wordpress.com/1516/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqldbpool.wordpress.com/1516/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1516&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqldbpool.com/2011/11/18/dedicated-administrator-connection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<georss:point>18.520469 73.856621</georss:point>
		<geo:lat>18.520469</geo:lat>
		<geo:long>73.856621</geo:long>
		<media:content url="http://0.gravatar.com/avatar/246a03e5bd256f9361fdf78e944f9c3d?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JShah</media:title>
		</media:content>

		<media:content url="http://sqldbpool.files.wordpress.com/2011/11/sqlcmd.jpg" medium="image">
			<media:title type="html">sqlcmd</media:title>
		</media:content>

		<media:content url="http://sqldbpool.files.wordpress.com/2011/11/ssms.jpg" medium="image">
			<media:title type="html">SSMS</media:title>
		</media:content>

		<media:content url="http://sqldbpool.files.wordpress.com/2011/11/cm.jpg" medium="image">
			<media:title type="html">CM</media:title>
		</media:content>
	</item>
		<item>
		<title>Common cause of the performance issues</title>
		<link>http://sqldbpool.com/2011/11/17/common-cause-of-the-performance-issues/</link>
		<comments>http://sqldbpool.com/2011/11/17/common-cause-of-the-performance-issues/#comments</comments>
		<pubDate>Thu, 17 Nov 2011 12:29:44 +0000</pubDate>
		<dc:creator>Jugal Shah</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>
		<category><![CDATA[SQL Server 2011 (Denali)]]></category>
		<category><![CDATA[Performance Issues]]></category>

		<guid isPermaLink="false">http://sqldbpool.com/?p=1512</guid>
		<description><![CDATA[Below are the most common reasons for the performance issues. SQL Server Configuration Issues Database/table/schema Design and Configuration Issues CPU/IO/Memory Bottleneck Blocking Network Bottleneck Poor Indexing Strategy (Missing Index, Fragmented Index, Un-Used Index) Out-of-date/missing statistics T-SQL Code Application Code Filed under: SQL Server, SQL Server 2008, SQL Server 2008 R2, SQL Server 2011 (Denali) Tagged: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1512&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Below are the most common reasons for the performance issues.<br />
<UL><br />
<LI>SQL Server Configuration Issues</LI><br />
<LI>Database/table/schema Design and Configuration Issues</LI><br />
<LI>CPU/IO/Memory Bottleneck</LI><br />
<LI>Blocking </LI><br />
<LI>Network Bottleneck</LI><br />
<LI>Poor Indexing Strategy (Missing Index, Fragmented Index, Un-Used Index)</LI><br />
<LI>Out-of-date/missing statistics</LI><br />
<LI>T-SQL Code</LI><br />
<LI>Application Code</LI><br />
</UL></p>
<br />Filed under: <a href='http://sqldbpool.com/category/notes/sql-server-notes/'>SQL Server</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2008/'>SQL Server 2008</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2008-r2/'>SQL Server 2008 R2</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2011-denali/'>SQL Server 2011 (Denali)</a> Tagged: <a href='http://sqldbpool.com/tag/performance-issues/'>Performance Issues</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqldbpool.wordpress.com/1512/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqldbpool.wordpress.com/1512/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqldbpool.wordpress.com/1512/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqldbpool.wordpress.com/1512/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqldbpool.wordpress.com/1512/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqldbpool.wordpress.com/1512/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqldbpool.wordpress.com/1512/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqldbpool.wordpress.com/1512/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqldbpool.wordpress.com/1512/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqldbpool.wordpress.com/1512/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqldbpool.wordpress.com/1512/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqldbpool.wordpress.com/1512/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqldbpool.wordpress.com/1512/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqldbpool.wordpress.com/1512/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1512&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqldbpool.com/2011/11/17/common-cause-of-the-performance-issues/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<georss:point>18.520469 73.856621</georss:point>
		<geo:lat>18.520469</geo:lat>
		<geo:long>73.856621</geo:long>
		<media:content url="http://0.gravatar.com/avatar/246a03e5bd256f9361fdf78e944f9c3d?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JShah</media:title>
		</media:content>
	</item>
		<item>
		<title>Script to find out Heap Table/Table without clustered Index</title>
		<link>http://sqldbpool.com/2011/11/17/script-to-find-out-heap-tabletable-without-clustered-index/</link>
		<comments>http://sqldbpool.com/2011/11/17/script-to-find-out-heap-tabletable-without-clustered-index/#comments</comments>
		<pubDate>Thu, 17 Nov 2011 05:57:00 +0000</pubDate>
		<dc:creator>Jugal Shah</dc:creator>
				<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>
		<category><![CDATA[SQL Server 2011 (Denali)]]></category>
		<category><![CDATA[Heap Table]]></category>

		<guid isPermaLink="false">http://sqldbpool.com/?p=1510</guid>
		<description><![CDATA[Heap Table: Table without a clustered index is called Heap Table. You can find out the Heap Table by querying the sys.indexes or sys.partitions against the index_id column. Filed under: SQL Scripts, SQL Server, SQL Server 2008, SQL Server 2008 R2, SQL Server 2011 (Denali) Tagged: Heap Table<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1510&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Heap Table:</strong> Table without a clustered index is called Heap Table. You can find out the Heap Table by querying the sys.indexes or sys.partitions against the index_id column.</p>
<p><pre class="brush: sql;">
select OBJECT_NAME(object_id),* 
from sys.indexes where index_id = 0

Select OBJECT_NAME(object_id),*  
from sys.partitions where index_id = 0
</pre></p>
<br />Filed under: <a href='http://sqldbpool.com/category/notes/sql-scripts/'>SQL Scripts</a>, <a href='http://sqldbpool.com/category/notes/sql-server-notes/'>SQL Server</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2008/'>SQL Server 2008</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2008-r2/'>SQL Server 2008 R2</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2011-denali/'>SQL Server 2011 (Denali)</a> Tagged: <a href='http://sqldbpool.com/tag/heap-table/'>Heap Table</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqldbpool.wordpress.com/1510/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqldbpool.wordpress.com/1510/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqldbpool.wordpress.com/1510/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqldbpool.wordpress.com/1510/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqldbpool.wordpress.com/1510/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqldbpool.wordpress.com/1510/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqldbpool.wordpress.com/1510/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqldbpool.wordpress.com/1510/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqldbpool.wordpress.com/1510/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqldbpool.wordpress.com/1510/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqldbpool.wordpress.com/1510/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqldbpool.wordpress.com/1510/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqldbpool.wordpress.com/1510/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqldbpool.wordpress.com/1510/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1510&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqldbpool.com/2011/11/17/script-to-find-out-heap-tabletable-without-clustered-index/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<georss:point>18.520469 73.856621</georss:point>
		<geo:lat>18.520469</geo:lat>
		<geo:long>73.856621</geo:long>
		<media:content url="http://0.gravatar.com/avatar/246a03e5bd256f9361fdf78e944f9c3d?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JShah</media:title>
		</media:content>
	</item>
		<item>
		<title>Steps to restore Database using Database Snapshot</title>
		<link>http://sqldbpool.com/2011/11/16/steps-to-restore-database-using-database-snapshot/</link>
		<comments>http://sqldbpool.com/2011/11/16/steps-to-restore-database-using-database-snapshot/#comments</comments>
		<pubDate>Wed, 16 Nov 2011 11:30:01 +0000</pubDate>
		<dc:creator>Jugal Shah</dc:creator>
				<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>
		<category><![CDATA[SQL Server 2011 (Denali)]]></category>
		<category><![CDATA[Database Snapshot]]></category>
		<category><![CDATA[restore Database using Database Snapshot]]></category>

		<guid isPermaLink="false">http://sqldbpool.com/?p=1507</guid>
		<description><![CDATA[Problem: Take a scenario where vendor wants you to up-grade the vendor databae using the SQL scripts. In case if something goes wrong you can either recover database by restoring all backup or by creating database snapshot. Solution: Database snapshots feature is available from the SQL Server 2005. Snapshot will be used to create a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1507&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Problem:</strong> Take a scenario where vendor wants you to up-grade the vendor databae using the SQL scripts. In case if something goes wrong you can either recover database by restoring all backup or by creating database snapshot.</p>
<p><strong>Solution:</strong><br />
Database snapshots feature is available from the SQL Server 2005. Snapshot will be used to create a <strong>read-only</strong> copy of a database at a given point in time. Any transactions which are uncommitted at the time you create a snapshot will not be included in the database snapshot. You can create multiple snapshots of a source database, but those snapshots must reside on the <strong>same instance </strong>as the source database.</p>
<p>You must have SQL Server <strong>enterprise edition</strong> to create the snapshot. A database snapshot only contains the data pages that have changed in the source database since the snapshot was created. It contains the original copies of those pages in order to give the effect of a read-only view. The file that is created to hold the changed data pages when the snapshot is created is known as a <strong>sparse file</strong>. </p>
<p>A source database that contains a snapshot cannot be dropped, detached, or restored until all of the snapshots have been dropped.</p>
<p><em>Check below queries to restore the database using snapshot</em><br />
Before you start restoring using database snapshot<br />
&#8211; Make sure the source database does not contain read-only or compressed filegroups.<br />
&#8211;Make sure all the files are online that were online when the snapshot was created.<br />
&#8211;Delete all snapshots of the source database, except the one you are reverting to.</p>
<p><pre class="brush: sql;">
create database db_pool
use db_pool

create table tb1
(
	id int,
	name varchar(10)
)

insert into tb1 values(10,'Jugal')
go 50;

--select the database and execute the below query to get logical name
SELECT name FROM sys.database_files WHERE type &lt;&gt; 1

--execute below command to create the database snapshot
CREATE DATABASE db_pool_Snapshot
 ON
(Name = db_pool,
 FileName = 'C:\db_pool_Data.ss')
 AS SNAPSHOT OF db_pool
 
--select the original database and drop the rows
use db_pool
delete from tb1

--use the snapshot and query tb1, we can see the data evenif it is deleted 
 use db_pool_Snapshot
 select * from tb1
 
 --now restore database using below script from snapshot
USE master
GO
RESTORE DATABASE db_pool FROM DATABASE_SNAPSHOT = 'db_pool_Snapshot'
 
 --query the database to check changes
 use db_pool
 select * from tb1
</pre></p>
<br />Filed under: <a href='http://sqldbpool.com/category/notes/sql-server-2008/'>SQL Server 2008</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2008-r2/'>SQL Server 2008 R2</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2011-denali/'>SQL Server 2011 (Denali)</a> Tagged: <a href='http://sqldbpool.com/tag/database-snapshot/'>Database Snapshot</a>, <a href='http://sqldbpool.com/tag/restore-database-using-database-snapshot/'>restore Database using Database Snapshot</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqldbpool.wordpress.com/1507/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqldbpool.wordpress.com/1507/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqldbpool.wordpress.com/1507/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqldbpool.wordpress.com/1507/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqldbpool.wordpress.com/1507/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqldbpool.wordpress.com/1507/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqldbpool.wordpress.com/1507/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqldbpool.wordpress.com/1507/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqldbpool.wordpress.com/1507/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqldbpool.wordpress.com/1507/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqldbpool.wordpress.com/1507/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqldbpool.wordpress.com/1507/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqldbpool.wordpress.com/1507/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqldbpool.wordpress.com/1507/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1507&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqldbpool.com/2011/11/16/steps-to-restore-database-using-database-snapshot/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<georss:point>18.520469 73.856621</georss:point>
		<geo:lat>18.520469</geo:lat>
		<geo:long>73.856621</geo:long>
		<media:content url="http://0.gravatar.com/avatar/246a03e5bd256f9361fdf78e944f9c3d?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JShah</media:title>
		</media:content>
	</item>
		<item>
		<title>Steps to restore the resource database</title>
		<link>http://sqldbpool.com/2011/11/16/steps-to-restore-the-resource-database/</link>
		<comments>http://sqldbpool.com/2011/11/16/steps-to-restore-the-resource-database/#comments</comments>
		<pubDate>Wed, 16 Nov 2011 10:33:14 +0000</pubDate>
		<dc:creator>Jugal Shah</dc:creator>
				<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>
		<category><![CDATA[SQL Server 2011 (Denali)]]></category>

		<guid isPermaLink="false">http://sqldbpool.com/?p=1503</guid>
		<description><![CDATA[Few days back, I had discussion with my team member regarding the resource database and we all are curious to see the resource database. As you all know resource database is hidden database and we can’t see it SQL Server. We follow below steps to restore the resource database and it worked. We can see [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1503&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Few days back, I had discussion with my team member regarding the resource database and we all are curious to see the <strong>resource </strong> database.</p>
<p>As you all know <strong>resource</strong> database is hidden database and we can’t see it SQL Server. We follow below steps to restore the resource database and it worked. We can see the resource database.</p>
<p><strong>Resource database file location</strong><br />
By default, these files are located in :\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\. Each instance of SQL Server has one and only one associated mssqlsystemresource.mdf file, and instances do not share this file. In a cluster, the Resource database exists in the \Data folder on a shared disk.</p>
<p>Follow below steps if you want to see the resource database.<br />
<strong>Step 1:</strong> Copy the resource database MDF/LDF file to different location and rename it. We have name both data and log file to resourcetest.</p>
<p><strong>Step 2:</strong> Execute the below command to attach the resource database file and you can see the resource database.<br />
<pre class="brush: sql;">
USE [master]
GO
CREATE DATABASE [resourcetest] ON 
( FILENAME = N'J:\resourcetest.mdf' ),
( FILENAME = N'J:\resourcetest.ldf' )
 FOR ATTACH
GO
</pre></p>
<p><strong>Resource Database Image</strong><br />
<a href="http://sqldbpool.files.wordpress.com/2011/11/resource.jpg"><img src="http://sqldbpool.files.wordpress.com/2011/11/resource.jpg?w=630" alt="" title="resource"   class="alignnone size-full wp-image-1504" /></a></p>
<br />Filed under: <a href='http://sqldbpool.com/category/notes/sql-server-2008/'>SQL Server 2008</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2008-r2/'>SQL Server 2008 R2</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2011-denali/'>SQL Server 2011 (Denali)</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqldbpool.wordpress.com/1503/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqldbpool.wordpress.com/1503/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqldbpool.wordpress.com/1503/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqldbpool.wordpress.com/1503/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqldbpool.wordpress.com/1503/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqldbpool.wordpress.com/1503/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqldbpool.wordpress.com/1503/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqldbpool.wordpress.com/1503/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqldbpool.wordpress.com/1503/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqldbpool.wordpress.com/1503/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqldbpool.wordpress.com/1503/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqldbpool.wordpress.com/1503/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqldbpool.wordpress.com/1503/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqldbpool.wordpress.com/1503/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1503&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqldbpool.com/2011/11/16/steps-to-restore-the-resource-database/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<georss:point>18.520469 73.856621</georss:point>
		<geo:lat>18.520469</geo:lat>
		<geo:long>73.856621</geo:long>
		<media:content url="http://0.gravatar.com/avatar/246a03e5bd256f9361fdf78e944f9c3d?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JShah</media:title>
		</media:content>

		<media:content url="http://sqldbpool.files.wordpress.com/2011/11/resource.jpg" medium="image">
			<media:title type="html">resource</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Dependency Reporting</title>
		<link>http://sqldbpool.com/2011/11/16/sql-dependency-reporting/</link>
		<comments>http://sqldbpool.com/2011/11/16/sql-dependency-reporting/#comments</comments>
		<pubDate>Wed, 16 Nov 2011 09:54:44 +0000</pubDate>
		<dc:creator>Jugal Shah</dc:creator>
				<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQL Server 2008 R2]]></category>
		<category><![CDATA[SQL Server 2011 (Denali)]]></category>

		<guid isPermaLink="false">http://sqldbpool.com/?p=1501</guid>
		<description><![CDATA[In SQL Server 2008 new Dynamic Management Functions and a System View introduced to keep track of Object Dependencies. DMFs in SQL Server 2008 to keep track of object dependencies sys.dm_sql_referenced_entities sys.dm_sql_referencing_entities System View in SQL Server 2008 to keep track of object dependencies sys.sql_expression_dependencies sys.sql_expression_dependencies: You can use the sys.sql_expression_dependencies catalog view to report [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1501&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In SQL Server 2008 new Dynamic Management Functions and a System View introduced to keep track of Object Dependencies. </p>
<p>DMFs in SQL Server 2008 to keep track of object dependencies<br />
<strong>sys.dm_sql_referenced_entities<br />
sys.dm_sql_referencing_entities</strong><br />
System View in SQL Server 2008 to keep track of object dependencies<br />
<strong>sys.sql_expression_dependencies</strong></p>
<p><strong>sys.sql_expression_dependencies:</strong> You can use the sys.sql_expression_dependencies catalog view to report dependency information for a given database. Cross-database entities are returned only when a valid four-part or three-part name is specified. </p>
<p><strong>sys.dm_sql_referenced_entities:</strong> Return one row for each user-defined entity referenced by name in the definition of the specified referencing entity. The result set is limited to the entities that are referenced by the specified referencing entity.</p>
<p><strong>sys.dm_sql_referencing_entities:</strong> You can use the sys.dm_sql_referencing_entities dynamic management function to return one row for each user-defined entity in the current database that references another user-defined entity by name.</p>
<p>Execute the below queries and check the output.<br />
<pre class="brush: sql;">
--create a sample database
create database db_pool
use db_pool
--create a sample table
create table tb1
(
	id int,
	name varchar(10)
)

insert into tb1 values(10,'Jugal')
go 50;

--create a procedure referencing tb1 table
CREATE procedure sp1
as 
	begin
		select * from DB_POOL.DBO.tb1
	end
	
exec sp1

SELECT @@SERVERNAME LocalServer,
               referenced_server_name,
               referenced_database_name,
               referenced_schema_name,
               referenced_entity_name
FROM sys.dm_sql_referenced_entities ('dbo.sp1','OBJECT')


SELECT *
FROM sys.dm_sql_referencing_entities ('dbo.TB1','OBJECT')


SELECT @@SERVERNAME LocalServer,
               referenced_server_name,
               referenced_database_name,
               referenced_schema_name,
               referenced_entity_name
FROM sys.dm_sql_referencing_entities ('dbo.sp1','OBJECT')

SELECT OBJECT_NAME(referencing_id) AS referencing_entity_name,
                referenced_database_name AS database_name,
                referenced_schema_name,
                referenced_entity_name
FROM sys.sql_expression_dependencies
WHERE referenced_entity_name = 'tb1'

select * 
FROM sys.sql_expression_dependencies

SELECT @@SERVERNAME LocalServer,
               OBJECT_NAME (referencing_id) referencing_object_name,
               referenced_server_name,
               referenced_database_name,
               referenced_schema_name,
               referenced_entity_name
FROM sys.sql_expression_dependencies 
where referenced_entity_name = 'tb1'


create procedure sp2
as
begin
   exec sp1
end

SELECT @@SERVERNAME LocalServer,
               OBJECT_NAME (referencing_id) referencing_object_name,
               referenced_server_name,
               referenced_database_name,
               referenced_schema_name,
               referenced_entity_name
FROM sys.sql_expression_dependencies 
where referenced_entity_name = 'sp1'
</pre></p>
<br />Filed under: <a href='http://sqldbpool.com/category/notes/sql-server-2008/'>SQL Server 2008</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2008-r2/'>SQL Server 2008 R2</a>, <a href='http://sqldbpool.com/category/notes/sql-server-2011-denali/'>SQL Server 2011 (Denali)</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqldbpool.wordpress.com/1501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqldbpool.wordpress.com/1501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqldbpool.wordpress.com/1501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqldbpool.wordpress.com/1501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqldbpool.wordpress.com/1501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqldbpool.wordpress.com/1501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqldbpool.wordpress.com/1501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqldbpool.wordpress.com/1501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqldbpool.wordpress.com/1501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqldbpool.wordpress.com/1501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqldbpool.wordpress.com/1501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqldbpool.wordpress.com/1501/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqldbpool.wordpress.com/1501/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqldbpool.wordpress.com/1501/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sqldbpool.com&amp;blog=3139535&amp;post=1501&amp;subd=sqldbpool&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sqldbpool.com/2011/11/16/sql-dependency-reporting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<georss:point>18.520469 73.856621</georss:point>
		<geo:lat>18.520469</geo:lat>
		<geo:long>73.856621</geo:long>
		<media:content url="http://0.gravatar.com/avatar/246a03e5bd256f9361fdf78e944f9c3d?s=96&#38;d=&#38;r=G" medium="image">
			<media:title type="html">JShah</media:title>
		</media:content>
	</item>
	</channel>
</rss>
