<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title type="text">博客园_魔君六道</title><subtitle type="text">AAAAAA</subtitle><id>http://feed.cnblogs.com/blog/u/35082/rss</id><updated>2012-01-18T17:20:55Z</updated><author><name>魔君六道</name><uri>http://www.cnblogs.com/WCFGROUP/</uri></author><generator>CNBlogs BlogServer</generator><link rel="alternate" type="text/html" href="http://www.cnblogs.com/WCFGROUP/"/><link rel="self" type="application/atom+xml" href="http://feed.cnblogs.com/blog/u/35082/rss"/><entry><id>http://www.cnblogs.com/WCFGROUP/archive/2012/01/19/2326087.html</id><title type="text">What does sp_reset_connection do?</title><summary type="text">FROM :http://www.cnblogs.com/stswordman/archive/2010/08/03/1791322.htmlWhat does sp_reset_connection do?http://sqldev.net/articles/sp_reset_connection/default.htmlhttp://blogs.msdn.com/b/jimmymay/archive/2009/02/02/sp-reset-connection-does-not-reset-transaction-isolation-level-unexpected-behavior-by</summary><published>2012-01-18T17:21:00Z</published><updated>2012-01-18T17:21:00Z</updated><author><name>魔君六道</name><uri>http://www.cnblogs.com/WCFGROUP/</uri></author><link rel="alternate" href="http://www.cnblogs.com/WCFGROUP/archive/2012/01/19/2326087.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/WCFGROUP/archive/2012/01/19/2326087.html"/><content type="html">&lt;h1 &gt;&lt;span style="font-size: 10pt"&gt;FROM :&lt;/span&gt;&lt;a href="http://www.cnblogs.com/stswordman/archive/2010/08/03/1791322.html"&gt;&lt;span style="font-size: 10pt"&gt;http://www.cnblogs.com/stswordman/archive/2010/08/03/1791322.html&lt;/span&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;h1 &gt;&lt;a id="ctl02_TitleUrl"  href="http://www.cnblogs.com/stswordman/archive/2010/08/03/1791322.html"&gt;&lt;font color="#1a8bc8"&gt;&lt;span style="font-size: 10pt"&gt;What does sp_reset_connection do?&lt;/span&gt;&lt;/font&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;div id="cnblogs_post_body"&gt;&#xD;
&lt;p&gt;&lt;a href="http://sqldev.net/articles/sp_reset_connection/default.html"&gt;&lt;font color="#1a8bc8"&gt;&lt;span style="font-size: 10pt"&gt;http://sqldev.net/articles/sp_reset_connection/default.html&lt;/span&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/b/jimmymay/archive/2009/02/02/sp-reset-connection-does-not-reset-transaction-isolation-level-unexpected-behavior-by-design.aspx"&gt;&lt;font color="#1a8bc8"&gt;&lt;span style="font-size: 10pt"&gt;http://blogs.msdn.com/b/jimmymay/archive/2009/02/02/sp-reset-connection-does-not-reset-transaction-isolation-level-unexpected-behavior-by-design.aspx&lt;/span&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/8xx3tyca(VS.80).aspx"&gt;&lt;font color="#1a8bc8"&gt;&lt;span style="font-size: 10pt"&gt;http://msdn.microsoft.com/en-us/library/8xx3tyca(VS.80).aspx&lt;/span&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;font color="#1a8bc8"&gt;&lt;/font&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;strong&gt;What does sp_reset_connection do?&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;p&gt;Data access API's layers like ODBC, OLE-DB and System.Data.SqlClient all call the (internal) stored procedure sp_reset_connection when re-using a connection from a connection pool. It does this to reset the state of the connection before it gets re-used, however nowhere is documented what things get reset. This article tries to document the parts of the connection that get reset. &lt;/p&gt;&#xD;
&lt;p&gt;sp_reset_connection resets the following aspects of a connection:&lt;/p&gt;&#xD;
&lt;ul&gt;&lt;li&gt;It resets all error states and numbers (like @@error)&lt;/li&gt;&lt;li&gt;It stops all EC's (execution contexts) that are child threads of a parent EC executing a parallel query&lt;/li&gt;&lt;li&gt;It will wait for any outstanding I/O operations that is outstanding&lt;/li&gt;&lt;li&gt;It will free any held buffers on the server by the connection&lt;/li&gt;&lt;li&gt;It will unlock any buffer resources that are used by the connection&lt;/li&gt;&lt;li&gt;It will release all memory allocated owned by the connection&lt;/li&gt;&lt;li&gt;It will clear any work or temporary tables that are created by the connection&lt;/li&gt;&lt;li&gt;It will kill all global cursors owned by the connection&lt;/li&gt;&lt;li&gt;It will close any open SQL-XML handles that are open&lt;/li&gt;&lt;li&gt;It will delete any open SQL-XML related work tables&lt;/li&gt;&lt;li&gt;It will close all system tables&lt;/li&gt;&lt;li&gt;It will close all user tables&lt;/li&gt;&lt;li&gt;It will drop all temporary objects&lt;/li&gt;&lt;li&gt;It will abort open transactions&lt;/li&gt;&lt;li&gt;It will defect from a distributed transaction when enlisted&lt;/li&gt;&lt;li&gt;It will decrement the reference count for users in current database; which release shared database lock&lt;/li&gt;&lt;li&gt;It will free acquired locks&lt;/li&gt;&lt;li&gt;It will releases any handles that may have been acquired&lt;/li&gt;&lt;li&gt;It will reset all SET options to the default values&lt;/li&gt;&lt;li&gt;It will reset the @@rowcount value&lt;/li&gt;&lt;li&gt;It will reset the @@identity value&lt;/li&gt;&lt;li&gt;It will reset any session level trace options using dbcc traceon()&lt;/li&gt;&lt;/ul&gt;&#xD;
&lt;p&gt;sp_reset_connection will NOT reset:&lt;/p&gt;&#xD;
&lt;ul&gt;&lt;li&gt;Security context, which is why connection pooling matches connections based on the exact connection string&lt;/li&gt;&lt;li&gt;If you entered an application role using sp_setapprole, since application roles can not be reverted&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/WCFGROUP/aggbug/2326087.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/WCFGROUP/archive/2012/01/19/2326087.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/WCFGROUP/archive/2012/01/19/2326083.html</id><title type="text">一个filegroup backup+log backup的bug</title><summary type="text">from:http://www.cnblogs.com/stswordman/archive/2011/10/06/2199752.html一个filegroup backup+log backup的bugUSE master;GOdrop database SalesgoCREATE DATABASE SalesON PRIMARY( NAME = SPri1_dat,FILENAME = &amp;#39;D:\SalesData\SPri1dat.mdf&amp;#39;,SIZE = 10,MAXSIZE = 50,FILEGROWTH = 15% ),FILEGROUP SalesGroup1( N</summary><published>2012-01-18T17:05:00Z</published><updated>2012-01-18T17:05:00Z</updated><author><name>魔君六道</name><uri>http://www.cnblogs.com/WCFGROUP/</uri></author><link rel="alternate" href="http://www.cnblogs.com/WCFGROUP/archive/2012/01/19/2326083.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/WCFGROUP/archive/2012/01/19/2326083.html"/><content type="html">&lt;h1 &gt;&lt;span style="font-size: 10pt"&gt;from:&lt;/span&gt;&lt;a href="http://www.cnblogs.com/stswordman/archive/2011/10/06/2199752.html"&gt;&lt;span style="font-size: 10pt"&gt;http://www.cnblogs.com/stswordman/archive/2011/10/06/2199752.html&lt;/span&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;h1 &gt;&lt;a id="ctl02_TitleUrl"  href="http://www.cnblogs.com/stswordman/archive/2011/10/06/2199752.html"&gt;&lt;font color="#1a8bc8"&gt;&lt;span style="font-size: 10pt"&gt;一个filegroup backup+log backup的bug&lt;/span&gt;&lt;/font&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xD;
&lt;div id="cnblogs_post_body"&gt;&#xD;
&lt;div style="background-color: #F5F5F5;border: 1px solid #CCCCCC;padding-left:5px;padding-right:5px;"&gt;&#xD;
&lt;div&gt;&lt;span style="color: #0000ff"&gt;USE&lt;/span&gt; master;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;GO&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;drop&lt;/span&gt; &lt;span style="color: #0000ff"&gt;database&lt;/span&gt; Sales&lt;br /&gt;&lt;span style="color: #0000ff"&gt;go&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;CREATE&lt;/span&gt; &lt;span style="color: #0000ff"&gt;DATABASE&lt;/span&gt; Sales&lt;br /&gt;&lt;span style="color: #0000ff"&gt;ON&lt;/span&gt; &lt;span style="color: #0000ff"&gt;PRIMARY&lt;/span&gt;&lt;br /&gt;( NAME &lt;span style="color: #808080"&gt;=&lt;/span&gt; SPri1_dat,&lt;br /&gt;FILENAME &lt;span style="color: #808080"&gt;=&lt;/span&gt; &lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #ff0000"&gt;D:\SalesData\SPri1dat.mdf&lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;,&lt;br /&gt;SIZE &lt;span style="color: #808080"&gt;=&lt;/span&gt; &lt;span style="color: #800000; font-weight: bold"&gt;10&lt;/span&gt;,&lt;br /&gt;MAXSIZE &lt;span style="color: #808080"&gt;=&lt;/span&gt; &lt;span style="color: #800000; font-weight: bold"&gt;50&lt;/span&gt;,&lt;br /&gt;FILEGROWTH &lt;span style="color: #808080"&gt;=&lt;/span&gt; &lt;span style="color: #800000; font-weight: bold"&gt;15&lt;/span&gt;&lt;span style="color: #808080"&gt;%&lt;/span&gt; ),&lt;br /&gt;FILEGROUP SalesGroup1&lt;br /&gt;( NAME &lt;span style="color: #808080"&gt;=&lt;/span&gt; SGrp1Fi1_dat,&lt;br /&gt;FILENAME &lt;span style="color: #808080"&gt;=&lt;/span&gt; &lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #ff0000"&gt;D:\SalesData\SG1Fi1dt.ndf&lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;,&lt;br /&gt;SIZE &lt;span style="color: #808080"&gt;=&lt;/span&gt; &lt;span style="color: #800000; font-weight: bold"&gt;10&lt;/span&gt;,&lt;br /&gt;MAXSIZE &lt;span style="color: #808080"&gt;=&lt;/span&gt; &lt;span style="color: #800000; font-weight: bold"&gt;50&lt;/span&gt;,&lt;br /&gt;FILEGROWTH &lt;span style="color: #808080"&gt;=&lt;/span&gt; &lt;span style="color: #800000; font-weight: bold"&gt;5&lt;/span&gt; )&lt;br /&gt;&lt;span style="color: #ff00ff"&gt;LOG&lt;/span&gt; &lt;span style="color: #0000ff"&gt;ON&lt;/span&gt;&lt;br /&gt;( NAME &lt;span style="color: #808080"&gt;=&lt;/span&gt; Sales_log,&lt;br /&gt;FILENAME &lt;span style="color: #808080"&gt;=&lt;/span&gt; &lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #ff0000"&gt;D:\SalesLog\salelog.ldf&lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;,&lt;br /&gt;SIZE &lt;span style="color: #808080"&gt;=&lt;/span&gt; 5MB,&lt;br /&gt;MAXSIZE &lt;span style="color: #808080"&gt;=&lt;/span&gt; 25MB,&lt;br /&gt;FILEGROWTH &lt;span style="color: #808080"&gt;=&lt;/span&gt; 5MB ) ;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;GO&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;USE&lt;/span&gt; Sales&lt;br /&gt;&lt;span style="color: #0000ff"&gt;GO&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;CREATE&lt;/span&gt; &lt;span style="color: #0000ff"&gt;TABLE&lt;/span&gt; TA(A &lt;span style="color: #0000ff"&gt;INT&lt;/span&gt; ,B &lt;span style="color: #0000ff"&gt;INT&lt;/span&gt; ,C &lt;span style="color: #0000ff"&gt;INT&lt;/span&gt;) &lt;span style="color: #0000ff"&gt;ON&lt;/span&gt; SalesGroup1&lt;br /&gt;&lt;span style="color: #0000ff"&gt;go&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;use&lt;/span&gt; master&lt;br /&gt;&lt;span style="color: #0000ff"&gt;go&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;backup&lt;/span&gt; &lt;span style="color: #0000ff"&gt;database&lt;/span&gt; sales &lt;br /&gt;&lt;span style="color: #0000ff"&gt;to&lt;/span&gt; &lt;span style="color: #0000ff"&gt;disk&lt;/span&gt;&lt;span style="color: #808080"&gt;=&lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #ff0000"&gt;sales.bck&lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt; &lt;span style="color: #0000ff"&gt;with&lt;/span&gt; init&lt;br /&gt;&lt;span style="color: #0000ff"&gt;go&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;BACKUP&lt;/span&gt; &lt;span style="color: #0000ff"&gt;DATABASE&lt;/span&gt; Sales&lt;br /&gt;FILEGROUP &lt;span style="color: #808080"&gt;=&lt;/span&gt; &lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #ff0000"&gt;SalesGroup1&lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;TO&lt;/span&gt; &lt;span style="color: #0000ff"&gt;DISK&lt;/span&gt; &lt;span style="color: #808080"&gt;=&lt;/span&gt; &lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #ff0000"&gt;SalesGroup1.bck&lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt; &lt;span style="color: #0000ff"&gt;with&lt;/span&gt; init&lt;br /&gt;&lt;span style="color: #0000ff"&gt;go&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;go&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #008080"&gt;&lt;font color="#0000ff"&gt;&lt;font color="#0000ff"&gt;&#xD;
&lt;p&gt;&lt;font size="2"&gt;insert&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; sales&lt;font color="#808080"&gt;&lt;font color="#808080"&gt;..t&lt;/font&gt;&lt;/font&gt;a &lt;font color="#0000ff"&gt;&lt;font color="#0000ff"&gt;default&lt;/font&gt;&lt;/font&gt; &lt;font color="#0000ff"&gt;&lt;font color="#0000ff"&gt;values&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;span style="color: #0000ff"&gt;go&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;BACKUP&lt;/span&gt;&lt;font color="#4b4b4b"&gt; &lt;/font&gt;&lt;span style="color: #ff00ff"&gt;log&lt;/span&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#4b4b4b"&gt; Sales&lt;br /&gt;&lt;/font&gt;&lt;span style="color: #0000ff"&gt;TO&lt;/span&gt;&lt;font color="#4b4b4b"&gt; &lt;/font&gt;&lt;span style="color: #0000ff"&gt;DISK&lt;/span&gt;&lt;font color="#4b4b4b"&gt; &lt;/font&gt;&lt;span style="color: #808080"&gt;=&lt;/span&gt;&lt;font color="#4b4b4b"&gt; &lt;/font&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #ff0000"&gt;Sales_log.bck&lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;font color="#4b4b4b"&gt; &lt;/font&gt;&lt;span style="color: #0000ff"&gt;with&lt;/span&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#4b4b4b"&gt; init&lt;br /&gt;&lt;/font&gt;&lt;span style="color: #0000ff"&gt;go&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;restore&lt;/span&gt;&lt;font color="#4b4b4b"&gt; &lt;/font&gt;&lt;span style="color: #0000ff"&gt;database&lt;/span&gt;&lt;font color="#4b4b4b"&gt; sales &lt;/font&gt;&lt;span style="color: #0000ff"&gt;from&lt;/span&gt;&lt;font color="#4b4b4b"&gt; &lt;/font&gt;&lt;span style="color: #0000ff"&gt;disk&lt;/span&gt;&lt;span style="color: #808080"&gt;=&lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #ff0000"&gt;SalesGroup1.bck&lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;font color="#4b4b4b"&gt; &lt;/font&gt;&lt;span style="color: #0000ff"&gt;with&lt;/span&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#4b4b4b"&gt; recovery&lt;br /&gt;&lt;/font&gt;&lt;span style="color: #0000ff"&gt;go&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;restore&lt;/span&gt;&lt;font color="#4b4b4b"&gt; &lt;/font&gt;&lt;span style="color: #ff00ff"&gt;log&lt;/span&gt;&lt;font color="#4b4b4b"&gt; sales &lt;/font&gt;&lt;span style="color: #0000ff"&gt;from&lt;/span&gt;&lt;font color="#4b4b4b"&gt; &lt;/font&gt;&lt;span style="color: #0000ff"&gt;disk&lt;/span&gt;&lt;span style="color: #808080"&gt;=&lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #ff0000"&gt;Sales_log.bck&lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;font color="#4b4b4b"&gt; &lt;/font&gt;&lt;span style="color: #0000ff"&gt;with&lt;/span&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#4b4b4b"&gt; recovery&lt;br /&gt;&lt;/font&gt;&lt;span style="color: #0000ff"&gt;go&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;select&lt;/span&gt;&lt;font color="#4b4b4b"&gt; &lt;/font&gt;&lt;span style="color: #808080"&gt;*&lt;/span&gt;&lt;span style="color: #0000ff"&gt;From&lt;/span&gt;&lt;font color="#4b4b4b"&gt; sales..TA&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;&#xD;
&lt;div &gt;&lt;span &gt;&lt;a onclick="copyCnblogsCode(this)" href="http://www.cnblogs.com/WCFGROUP/admin/javascript:void(0);"&gt;&lt;font color="#1a8bc8"&gt;复制代码&lt;/font&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&#xD;
&lt;p&gt;&lt;font color="#1a8bc8"&gt;&lt;/font&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;font color="#1a8bc8"&gt;&lt;/font&gt;&lt;/p&gt;&#xD;
&lt;p&gt;以上这段代码可以正常执行&lt;/p&gt;&#xD;
&lt;p&gt;如果将&lt;span style="color: #008080"&gt;insert sales..ta default values&lt;/span&gt;这句话的注释掉，会返回这个错误&lt;/p&gt;&#xD;
&lt;p&gt;&lt;font size="1"&gt;&lt;span style="color: red"&gt;Msg 8653, Level 16, State 1, Line 1&lt;/span&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;span style="color: red"&gt;The query processor is unable to produce a plan for the table or view 'TA' because the table resides in a filegroup which is not online.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&#xD;
&lt;p&gt;如果我们单独执行restore database和restore log语句。会发现两条警告信息&lt;/p&gt;&#xD;
&lt;p&gt;&lt;/p&gt;&#xD;
&lt;p&gt;The roll forward start point is now at log sequence number (LSN) &lt;span style="color: red"&gt;25000000019700001&lt;/span&gt;. Additional roll forward past LSN &lt;span style="color: red"&gt;25000000020400001 &lt;/span&gt;is required to complete the restore sequence.&lt;/p&gt;&#xD;
&lt;p&gt;RESTORE DATABASE ... FILE=&amp;lt;name&amp;gt; successfully processed 8 pages in 0.036 seconds (1.736 MB/sec).&lt;/p&gt;&#xD;
&lt;p&gt;Processed 0 pages for database 'sales', file 'SGrp1Fi1_dat' on file 1.&lt;/p&gt;&#xD;
&lt;p&gt;The roll forward start point is now at log sequence number (LSN) &lt;span style="color: red"&gt;25000000019900001&lt;/span&gt;. Additional roll forward past LSN &lt;span style="color: red"&gt;25000000020400001 &lt;/span&gt;is required to complete the restore sequence.&lt;/p&gt;&#xD;
&lt;p&gt;RESTORE LOG successfully processed 0 pages in 0.003 seconds (0.000 MB/sec).&lt;/p&gt;&#xD;
&lt;p&gt;&lt;/p&gt;&#xD;
&lt;p&gt;restore database时显示仍然需要roll forward到&lt;span style="color: red"&gt;25000000020400001 &lt;/span&gt;，但是log备份中的日志并没有达到/超过预期的lsn，而是在&lt;span style="color: red"&gt;25000000019900001&lt;/span&gt;就结束了。&lt;/p&gt;&#xD;
&lt;p&gt;我们通过restore head对比&lt;/p&gt;&#xD;
&lt;p&gt;&lt;/p&gt;&#xD;
&lt;div style="background-color: #F5F5F5;border: 1px solid #CCCCCC;padding-left:5px;padding-right:5px;"&gt;&#xD;
&lt;div&gt;&lt;span style="color: #0000ff"&gt;restore&lt;/span&gt; headeronly &lt;span style="color: #0000ff"&gt;from&lt;/span&gt; &lt;span style="color: #0000ff"&gt;disk&lt;/span&gt;&lt;span style="color: #808080"&gt;=&lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #ff0000"&gt;SalesGroup1.bck&lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;go&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;restore&lt;/span&gt; headeronly &lt;span style="color: #0000ff"&gt;from&lt;/span&gt; &lt;span style="color: #0000ff"&gt;disk&lt;/span&gt;&lt;span style="color: #808080"&gt;=&lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt;&lt;span style="color: #ff0000"&gt;Sales_log.bck&lt;/span&gt;&lt;span style="color: #ff0000"&gt;'&lt;/span&gt; &lt;/div&gt;&#xD;
&lt;div &gt;&lt;span &gt;&lt;a onclick="copyCnblogsCode(this)" href="http://www.cnblogs.com/WCFGROUP/admin/javascript:void(0);"&gt;&lt;font color="#1a8bc8"&gt;复制代码&lt;/font&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&#xD;
&lt;p&gt;&lt;font color="#1a8bc8"&gt;&lt;/font&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;font color="#1a8bc8"&gt;&lt;img border="0" alt="" src="http://images.cnblogs.com/cnblogs_com/stswordman/logbackup.png" width="531" height="162" /&gt;&lt;/font&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;font color="#1a8bc8"&gt;&lt;/font&gt;&lt;font size="1"&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;font color="#1a8bc8"&gt;&lt;/font&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;/font&gt;&lt;font size="2"&gt;Log包含的最大的lsn没有办法满足之前restore database所需要的lsn...&lt;/font&gt;&lt;/p&gt;&#xD;
&lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;&#xD;
&lt;p&gt;此问题可以在SQL SERVER 2008 R2 RTM中重现&lt;/p&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/WCFGROUP/aggbug/2326083.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/WCFGROUP/archive/2012/01/19/2326083.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/WCFGROUP/archive/2012/01/16/2323440.html</id><title type="text">Powershell获取服务器剩余磁盘空间问题</title><summary type="text">先将2003 AD所有服务器清单放入d:\server.txt文档,然后运行以下命令:$cred = get-credential domain\administrator --------弹出提示输入域管理员密码$servers = get-content &amp;quot;d:\server.txt&amp;quot;$query = &amp;quot;select * from win32_logicaldisk where drivetype = &amp;#39;3&amp;#39;&amp;quot;foreach ($server in $servers){&amp;quot;Servername - &amp;quot; + $serv</summary><published>2012-01-16T03:43:00Z</published><updated>2012-01-16T03:43:00Z</updated><author><name>魔君六道</name><uri>http://www.cnblogs.com/WCFGROUP/</uri></author><link rel="alternate" href="http://www.cnblogs.com/WCFGROUP/archive/2012/01/16/2323440.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/WCFGROUP/archive/2012/01/16/2323440.html"/><content type="html">&lt;div &gt;&#xD;
&lt;div &gt;&#xD;
&lt;p&gt;先将2003 AD所有服务器清单放入d:\server.txt文档,然后运行以下命令:&lt;br /&gt;$cred = get-credential domain\administrator&amp;nbsp;&amp;nbsp; --------弹出提示输入域管理员密码&lt;br /&gt;&lt;br /&gt;$servers = get-content "d:\server.txt"&lt;br /&gt;$query = "select * from win32_logicaldisk where drivetype = '3'"&lt;br /&gt;foreach ($server in $servers){&lt;br /&gt;"Servername - " + $server&lt;br /&gt;$disks = gwmi -query $query -credential $cred -computer $server&lt;br /&gt;foreach ($disk in $disks){&lt;br /&gt;"deviveID - " + $disk.deviceid&lt;br /&gt;"Freesieze(GB) - " + ($disk.freespace/1gb)&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;所有的服务器结果显示正常,但是有一台服务器显示错误,拒绝访问,使用域管理员帐户(为该服务器管理员组)登陆该服务器运行该脚本,则可以获取到磁盘信息:&lt;br /&gt;Servername - TESTSERVER1&lt;br /&gt;deviveID - C:&lt;br /&gt;Freesieze(GB) - 38.7134017944336&lt;br /&gt;deviveID - D:&lt;br /&gt;Freesieze(GB) - 91.2716903686523&lt;br /&gt;Servername - TESTSERVER2&lt;br /&gt;Get-WmiObject : 拒绝访问。 (异常来自 HRESULT:0x80070005 (E_ACCESSDENIED))&lt;br /&gt;At line:3 char:14&lt;br /&gt;+ $disks = gwmi &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;nbsp; -query $query -credential $cred -computer $server&lt;br /&gt;deviveID - C:&lt;br /&gt;Freesieze(GB) - 38.7134017944336&lt;br /&gt;deviveID - D:&lt;br /&gt;Freesieze(GB) - 91.2716903686523&lt;br /&gt;Servername - TESTSERVER3&lt;br /&gt;deviveID - C:&lt;br /&gt;Freesieze(GB) - 31.4570388793945&lt;br /&gt;deviveID - D:&lt;br /&gt;Freesieze(GB) - 444.77477645874&lt;br /&gt;deviveID - E:&lt;br /&gt;Freesieze(GB) - 519.298351287842&lt;br /&gt;&lt;br /&gt;网上提示DCOM中WMI安全权限增加ASPNET,但是检查发现该服务器中WMI全线与其它服务器都是默认配置.&lt;/p&gt;&#xD;
&lt;p&gt;答案：运行Dcomcnfg,组建服务-&amp;gt;计算机属性中选择"启用分布式COM"即可.&lt;/p&gt;&#xD;
&lt;p&gt;&lt;/p&gt;&#xD;
&lt;p&gt;其他的资源&lt;a href="http://rickyfang.blog.51cto.com/1213/637956"&gt;http://rickyfang.blog.51cto.com/1213/637956&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;img src="http://www.cnblogs.com/WCFGROUP/aggbug/2323440.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/WCFGROUP/archive/2012/01/16/2323440.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/WCFGROUP/archive/2012/01/16/2323425.html</id><title type="text">Using xp_fixeddrives to Monitor Free Space</title><summary type="text">FROM ;http://www.databasejournal.com/features/mssql/article.php/3080501/Using-xpfixeddrives-to-Monitor-Free-Space.htmAs a DBA one of your responsibilities is to monitor disk space. You always need to make sure you have enough for your databases, database backups and any other types of files you plan</summary><published>2012-01-16T03:28:00Z</published><updated>2012-01-16T03:28:00Z</updated><author><name>魔君六道</name><uri>http://www.cnblogs.com/WCFGROUP/</uri></author><link rel="alternate" href="http://www.cnblogs.com/WCFGROUP/archive/2012/01/16/2323425.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/WCFGROUP/archive/2012/01/16/2323425.html"/><content type="html">&lt;p itxtnodeid="437" itxtharvested="0"&gt;FROM ;&lt;a href="http://www.databasejournal.com/features/mssql/article.php/3080501/Using-xpfixeddrives-to-Monitor-Free-Space.htm"&gt;http://www.databasejournal.com/features/mssql/article.php/3080501/Using-xpfixeddrives-to-Monitor-Free-Space.htm&lt;/a&gt;&lt;/p&gt;&#xD;
&lt;p itxtnodeid="437" itxtharvested="0"&gt;&lt;/p&gt;&#xD;
&lt;p itxtnodeid="437" itxtharvested="0"&gt;As a DBA one of your responsibilities is to monitor disk space. You always need to make sure you have enough for your databases, database backups and any other types of files you plan to store on your server. If you don't monitor your disk space and make sure you have enough space, eventually one of your critical database processes or components is going to fail because it can't allocate the disk space it needs. &lt;/p&gt;&#xD;
&lt;p itxtnodeid="436" itxtharvested="0"&gt;There are a number of different methods to monitor disk space usage. I'm not going to discuss the different methods you could use, I'm only going to write about one. The method I am going to discuss is a simple space monitoring method that uses an undocumented SQL Server extended stored procedure named xp_fixeddrives. The xp_fixeddrives extended stored procedure returns a record set that contains the number of megabytes of free space for each physical drive associated with the SQL Server machine. &lt;/p&gt;&#xD;
&lt;p itxtnodeid="435" itxtharvested="0"&gt;Now it is simple enough just to run the xp_fixeddrives command every so often from Query Analyzer to review the amount of free space, although this method is too time consuming for busy Database Administrators. A better method would be to automate running this command periodically to review the amount of free space. With the automated approach you can perform what ever you feel is appropriate with the free space information. I can think of a couple of different DBA tasks where free space information might be valuable. The first thing would be alerting the DBA when free space drops below a specific threshold on any SQL Server drive, and the second would be to historically track free space for disk space capacity management. &lt;/p&gt;&#xD;
&lt;p itxtnodeid="434" itxtharvested="0"&gt;First, let's look at how to build a process to alert the DBA when any one of the SQL Server disk drives falls below a predetermined threshold. In order to use the xp_fixeddrives information in this automated alerting process I need to get the information outputted by the extended store procedures into a SQL Server table or application variables, so I can programmatically make decisions on whether a drive has passed the free space threshold. To get the xp_fixeddrives information into a temporary table I use the following T-SQL.&lt;/p&gt;&lt;pre itxtnodeid="433" itxtharvested="0"&gt;create table #FreeSpace(&#xD;
 Drive char(1), &#xD;
 MB_Free int)&#xD;
&#xD;
insert into #FreeSpace exec xp_fixeddrives&#xD;
&lt;/pre&gt;&#xD;
&lt;p itxtnodeid="432" itxtharvested="0"&gt;As you can see, I created a temporary table named #FreeSpace to insert the records that xp_fixeddrives outputs. This temporary table is then populated when the "insert into" statement is executed. Now this code by itself does not alert the DBA, although it does get the free space information for each drive on your SQL Server box into a temporary table where some T-SQL code can process it to alert the DBA.&lt;/p&gt;&#xD;
&lt;p itxtnodeid="431" itxtharvested="0"&gt;The method I'm using to control the threshold alert process is a SQL Agent job that runs hourly. Each hour the SQL Server agent job collects the free space information for each SQL Server drive into a temporary table, such as the one above. Then for each drive I retrieve the free space information from this temporary table and compare it to a threshold I have set for each drive. If the amount of free space drops below the particular threshold setting for the drive, then I email the DBA using xp_sendmail. Here is a sample of some code that does just that.&lt;/p&gt;&lt;pre itxtnodeid="430" itxtharvested="0"&gt;declare @MB_Free int&#xD;
&#xD;
create table #FreeSpace(&#xD;
 Drive char(1), &#xD;
 MB_Free int)&#xD;
&#xD;
insert into #FreeSpace exec xp_fixeddrives&#xD;
&#xD;
select @MB_Free = MB_Free from #FreeSpace where Drive = 'C'&#xD;
&#xD;
-- Free Space on C drive Less than Threshold&#xD;
if @MB_Free &amp;lt; 1024&#xD;
  exec master.dbo.xp_sendmail &#xD;
     @recipients ='greg.larsen@netzero.net',&#xD;
     @subject ='SERVER X - Fresh Space Issue on C Drive',&#xD;
     @message = 'Free space on C Drive &#xD;
                 has dropped below 1 gig'&#xD;
&#xD;
select @MB_Free = MB_Free from #FreeSpace where Drive = 'F'&#xD;
&#xD;
-- Free Space on F drive Less than Threshold&#xD;
if @MB_Free &amp;lt; 2048 &#xD;
   exec master.dbo.xp_sendmail &#xD;
     @recipients ='greg.larsen@netzero.net',&#xD;
     @subject ='SERVER X - Fresh Space Issue on C Drive',&#xD;
     @message = 'Free space on F Drive &#xD;
                 has dropped below 2 gig'&#xD;
&lt;/pre&gt;&#xD;
&lt;p itxtnodeid="429" itxtharvested="0"&gt;This sample only checks the free space on two drives, but could easily be modified to handle additional drives. This sample code can either be placed directly into a SQL Agent job step, or can be built into a stored procedure that is executed by a job step. By building a SQL Server agent job to execute the above code, the DBA will be notified soon after a drive reaches its designated free space threshold. This alerting of low free space hopefully will allow the DBA time to resolve the free space problem before it becomes critical, and causes processes to fail. Note that the above code has a different free space threshold for each drive.&lt;/p&gt;&#xD;
&lt;p itxtnodeid="428" itxtharvested="0"&gt;Another use of xp_fixeddrives might be to track disk space usage over time. Say you where to gather the free space information at regular intervals, for example weekly, and store it in a database table. This could be done using the approach above to populate the #FreeSpace temporary table. By gathering free space information over time and storing it in a permanent SQL Server table you will be able to produce a trend chart showing your disk space consumption overtime. By comparing the amount of free space between two points on the chart you will be able to determine the disk space consumed between those intervals. Having the rate of disk space consumption is valuable in tracking how fast your applications are consuming your available free disk space. This growth rate information is valuable when determining how much disk space is needed to support your applications for the next year.&lt;/p&gt;&#xD;
&lt;p itxtnodeid="427" itxtharvested="0"&gt;Monitoring available disk space and growth rates are a couple of things a DBA should be performing. Without monitoring you run the risk of running out of space and causing critical problems for your application. If you have not been monitoring disk space availability and usage, then you might consider how you can use xp_fixeddrives to support your monitor needs. &lt;/p&gt;&lt;img src="http://www.cnblogs.com/WCFGROUP/aggbug/2323425.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/WCFGROUP/archive/2012/01/16/2323425.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/WCFGROUP/archive/2011/12/31/2308606.html</id><title type="text">auto-parameterized</title><summary type="text">I read a article from &amp;quot;Plan Caching in SQL Server 2008&amp;quot;http://msdn.microsoft.com/en-us/library/ee343986(v=sql.100).aspx The following two sentence in the above article makes me Confused.1 &amp;quot;general, SQL Server auto-parameterizes those queries whose query plans do no depend on particula</summary><published>2011-12-31T04:14:00Z</published><updated>2011-12-31T04:14:00Z</updated><author><name>魔君六道</name><uri>http://www.cnblogs.com/WCFGROUP/</uri></author><link rel="alternate" href="http://www.cnblogs.com/WCFGROUP/archive/2011/12/31/2308606.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/WCFGROUP/archive/2011/12/31/2308606.html"/><content type="html">该文被密码保护。</content></entry><entry><id>http://www.cnblogs.com/WCFGROUP/archive/2011/12/19/2293670.html</id><title type="text">sp_select ,sp_selectpages</title><summary type="text">if OBJECT_ID(&amp;#39;sp_select&amp;#39;) is not null begin print &amp;#39;Dropping procedure sp_select...&amp;#39; drop procedure sp_select endGOCREATE PROCEDURE dbo.sp_select(@table_name sysname, @spid int = NULL, @max_pages int = 1000)AS SET NOCOUNT ON DECLARE @object_id int , @table sysname , @db_name sysname ,</summary><published>2011-12-19T09:34:00Z</published><updated>2011-12-19T09:34:00Z</updated><author><name>魔君六道</name><uri>http://www.cnblogs.com/WCFGROUP/</uri></author><link rel="alternate" href="http://www.cnblogs.com/WCFGROUP/archive/2011/12/19/2293670.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/WCFGROUP/archive/2011/12/19/2293670.html"/><content type="html">该文被密码保护。</content></entry><entry><id>http://www.cnblogs.com/WCFGROUP/archive/2011/12/05/2277303.html</id><title type="text">cursors  set</title><summary type="text">http://blogs.msdn.com/b/sqlprogrammability/archive/2008/03/18/increase-your-sql-server-performance-by-replacing-cursors-with-set-operations.aspxhttp://www.helpwithsql.com/2011/05/where-to-put-the-logic-sql-code/http://www.helpwithsql.com/2011/06/replacing-cursors-with-set-based-sql-queries-part-1/ht</summary><published>2011-12-05T14:18:00Z</published><updated>2011-12-05T14:18:00Z</updated><author><name>魔君六道</name><uri>http://www.cnblogs.com/WCFGROUP/</uri></author><link rel="alternate" href="http://www.cnblogs.com/WCFGROUP/archive/2011/12/05/2277303.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/WCFGROUP/archive/2011/12/05/2277303.html"/><content type="html">该文被密码保护。</content></entry><entry><id>http://www.cnblogs.com/WCFGROUP/archive/2011/12/01/2270488.html</id><title type="text">OTHER AT</title><summary type="text">http://www.sqlusa.com/articles2005/updatesyntax/update openquery remote table with join http://social.msdn.microsoft.com/forums/en-us/transactsql/thread/5DA9F6A3-093D-43CA-8358-F2E30E464D7Ehttp://social.msdn.microsoft.com/Forums/en-US/transactsql/thread/87d20bd8-fb22-4f1e-82fb-a46fb5966e47Performanc</summary><published>2011-12-01T06:03:00Z</published><updated>2011-12-01T06:03:00Z</updated><author><name>魔君六道</name><uri>http://www.cnblogs.com/WCFGROUP/</uri></author><link rel="alternate" href="http://www.cnblogs.com/WCFGROUP/archive/2011/12/01/2270488.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/WCFGROUP/archive/2011/12/01/2270488.html"/><content type="html">该文被密码保护。</content></entry><entry><id>http://www.cnblogs.com/WCFGROUP/archive/2011/11/28/2266865.html</id><title type="text">DOT NET A</title><summary type="text">Using GC Efficiently http://blogs.msdn.com/b/maoni/archive/2004/12/19/327149.aspx</summary><published>2011-11-28T15:03:00Z</published><updated>2011-11-28T15:03:00Z</updated><author><name>魔君六道</name><uri>http://www.cnblogs.com/WCFGROUP/</uri></author><link rel="alternate" href="http://www.cnblogs.com/WCFGROUP/archive/2011/11/28/2266865.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/WCFGROUP/archive/2011/11/28/2266865.html"/><content type="html">&lt;p&gt;Using GC Efficiently &lt;/p&gt;&#xD;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/b/maoni/archive/2004/12/19/327149.aspx"&gt;http://blogs.msdn.com/b/maoni/archive/2004/12/19/327149.aspx&lt;/a&gt;&lt;/p&gt;&lt;img src="http://www.cnblogs.com/WCFGROUP/aggbug/2266865.html?type=1" width="1" height="1" alt=""/&gt;&lt;p&gt;&lt;a href="http://www.cnblogs.com/WCFGROUP/archive/2011/11/28/2266865.html" target="_blank"&gt;本文链接&lt;/a&gt;&lt;/p&gt;</content></entry><entry><id>http://www.cnblogs.com/WCFGROUP/archive/2011/11/27/2264947.html</id><title type="text">sql server QA</title><summary type="text">1, 在灾难恢复过程中（crash recovery），SQL SEVER 回滚（roll back）的内部机制是什么？（全完恢复模式，事务日志备份的情况下我们知道，在灾难恢复过程中（crash recovery），SQL SEVER 前滚（roll forward）的内部机制是首先执行还原上次备份的操作（如全备份），然后根据全备份之后的事务日志中的记录（如SQL 操作记录，update,delete,insert.....）,做REDO操作，那roll back的机制是什么呢？总不能进行相反方向的SQL 操作吧？举个例子，一个transaction对一个table1进行了update 操作，</summary><published>2011-11-27T04:31:00Z</published><updated>2011-11-27T04:31:00Z</updated><author><name>魔君六道</name><uri>http://www.cnblogs.com/WCFGROUP/</uri></author><link rel="alternate" href="http://www.cnblogs.com/WCFGROUP/archive/2011/11/27/2264947.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/WCFGROUP/archive/2011/11/27/2264947.html"/><content type="html">该文被密码保护。</content></entry></feed>
