{"id":107,"date":"2009-11-03T15:24:43","date_gmt":"2009-11-03T07:24:43","guid":{"rendered":"http:\/\/blog.infinity.idv.tw\/index.php\/2009\/11\/03\/%e4%ba%a4%e6%98%93%e8%a8%98%e9%8c%84%e6%aa%94%e5%b7%b2%e6%bb%bf%e3%80%81%e7%88%86%e6%8e%89%ef%bc%9b%e6%88%aa%e6%96%b7%e4%ba%a4%e6%98%93%e8%a8%98%e9%8c%84%e6%aa%94%e3%80%82%ef%bc%88the-transaction-log\/"},"modified":"2009-11-03T15:24:43","modified_gmt":"2009-11-03T07:24:43","slug":"%e4%ba%a4%e6%98%93%e8%a8%98%e9%8c%84%e6%aa%94%e5%b7%b2%e6%bb%bf%e3%80%81%e7%88%86%e6%8e%89%ef%bc%9b%e6%88%aa%e6%96%b7%e4%ba%a4%e6%98%93%e8%a8%98%e9%8c%84%e6%aa%94%e3%80%82%ef%bc%88the-transaction-log","status":"publish","type":"post","link":"http:\/\/blog.infinity.idv.tw\/?p=107","title":{"rendered":"\u4ea4\u6613\u8a18\u9304\u6a94\u5df2\u6eff\u3001\u7206\u6389\uff1b\u622a\u65b7\u4ea4\u6613\u8a18\u9304\u6a94\u3002\uff08The transaction log for database &#8216;DB1&#8217; is full. \uff1bTransaction Log Truncation\uff09"},"content":{"rendered":"<p>\u6700\u8fd1\u5728\u770bSQL\u5099\u4efd\u7684\u65b9\u5f0f\uff0c\u627e\u5230\u4e86\u9019\u7bc7\u6587\u7ae0\uff0c\u6015\u6709\u4e9b\u6587\u7ae0\u6703\u6d88\u5931\uff0c\u56fa\u5b8c\u6574\u8f49\u8cbc\u4fdd\u5b58\uff0c\u4e26\u6a19\u660e\u51fa\u8655\uff1a   <br \/><a title=\"http:\/\/sharedderrick.blogspot.com\/2009\/03\/transaction-log-for-database-is-full.html\" href=\"http:\/\/sharedderrick.blogspot.com\/2009\/03\/transaction-log-for-database-is-full.html\">http:\/\/sharedderrick.blogspot.com\/2009\/03\/transaction-log-for-database-is-full.html<\/a><\/p>\n<p>&#160;<\/p>\n<p><a href=\"http:\/\/sharedderrick.blogspot.com\/2009\/03\/transaction-log-for-database-is-full.html\">\u4ea4\u6613\u8a18\u9304\u6a94\u5df2\u6eff\u3001\u7206\u6389\uff1b\u622a\u65b7\u4ea4\u6613\u8a18\u9304\u6a94\u3002\uff08The transaction log for database &#8216;DB1&#8217; is full. \uff1bTransaction Log Truncation\uff09<\/a><\/p>\n<p>\u672c\u6587\u50c5\u8a0e\u8ad6\u7576\u767c\u751f\u4ea4\u6613\u8a18\u9304\u6a94\u5df2\u6eff\u3001\u7206\u6389\u6642\u7684\u707d\u96e3\u8655\u7406\u65b9\u5f0f\uff0c\u4e26\u672a\u8a0e\u8ad6\u5982\u4f55\u907f\u514d\u767c\u751f\u4ea4\u6613\u8a18\u9304\u6a94\u5df2\u6eff\u7684\u4f5c\u6cd5\uff0c\u8acb\u53c3\u8003\u300c\u7ba1\u7406\u4ea4\u6613\u8a18\u9304\u300d\u7b49\u76f8\u95dc\u4e3b\u984c\u3002   <br \/><a href=\"http:\/\/technet.microsoft.com\/zh-tw\/library\/ms345382.aspx\">http:\/\/technet.microsoft.com\/zh-tw\/library\/ms345382.aspx<\/a>    <br \/>\u5982\u4f55\u907f\u514d SQL Server \u8cc7\u6599\u5eab\u7684\u4ea4\u6613\u8a18\u9304\u6a94\u8d85\u51fa\u9810\u671f\u5927\u5c0f    <br \/><a href=\"http:\/\/support.microsoft.com\/kb\/873235\/zh-tw\">http:\/\/support.microsoft.com\/kb\/873235\/zh-tw<\/a><\/p>\n<p>\u82e5\u8cc7\u6599\u5eab\u56e0\u6545\u9020\u6210\u4ea4\u6613\u8a18\u9304\u6a94\u5df2\u6eff\u3001\u7206\u6389\uff0c\u5c07\u5c0e\u81f4\u7121\u6cd5\u57f7\u884c\u65b0\u589e\u3001\u522a\u9664\u7b49\u4f5c\u696d\u3002 <\/p>\n<p>\u9047\u5230\u7684\u932f\u8aa4\u8a0a\u606f\uff1a<\/p>\n<p><a href=\"http:\/\/sharedderrick.blogspot.com\/2009\/03\/transaction-log-for-database-is-full.html#\">view plain<\/a><a href=\"http:\/\/sharedderrick.blogspot.com\/2009\/03\/transaction-log-for-database-is-full.html#\">copy to clipboard<\/a><a href=\"http:\/\/sharedderrick.blogspot.com\/2009\/03\/transaction-log-for-database-is-full.html#\">print<\/a><a href=\"http:\/\/sharedderrick.blogspot.com\/2009\/03\/transaction-log-for-database-is-full.html#\">?<\/a><\/p>\n<ol>\n<li>\u8a0a\u606f 9002\uff0c\u5c64\u7d1a 17\uff0c\u72c0\u614b 2\uff0c\u884c 2&#160; <\/li>\n<li>\u8cc7\u6599\u5eab &#8216;db1&#8217; \u7684\u4ea4\u6613\u8a18\u9304\u5df2\u6eff\u3002\u5982\u679c\u8981\u4e86\u89e3\u70ba\u4f55\u7121\u6cd5\u91cd\u8907\u4f7f\u7528\u8a18\u9304\u4e2d\u7684\u7a7a\u9593\uff0c\u8acb\u53c3\u95b1 sys.databases \u4e2d\u7684 log_reuse_wait_desc \u8cc7\u6599\u884c\u3002&#160; <\/li>\n<li><\/li>\n<li>Msg 9002, Level 17, State 2, Line 2&#160; <\/li>\n<li>The transaction log for database &#8216;DB1&#8217; is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases&#160; <\/li>\n<\/ol>\n<pre><br \/>\u8a0a\u606f 9002\uff0c\u5c64\u7d1a 17\uff0c\u72c0\u614b 2\uff0c\u884c 2<br \/>\u8cc7\u6599\u5eab 'db1' \u7684\u4ea4\u6613\u8a18\u9304\u5df2\u6eff\u3002\u5982\u679c\u8981\u4e86\u89e3\u70ba\u4f55\u7121\u6cd5\u91cd\u8907\u4f7f\u7528\u8a18\u9304\u4e2d\u7684\u7a7a\u9593\uff0c\u8acb\u53c3\u95b1 sys.databases \u4e2d\u7684 log_reuse_wait_desc \u8cc7\u6599\u884c\u3002<br \/><br \/>Msg 9002, Level 17, State 2, Line 2<br \/>The transaction log for database 'DB1' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases<br \/><\/pre>\n<p>\u8acb\u53c3\u8003\u4e0b\u5716\u6240\u793a\uff1a<\/p>\n<p><a href=\"http:\/\/lh4.ggpht.com\/_YF2-PvwqBh4\/ScW2PuO4CTI\/AAAAAAAAB0E\/6Um2J9Hxsks\/s1600-h\/Image.png\"><img loading=\"lazy\" title=\"01_\u5728\u67e5\u8a62\u7de8\u8f2f\u5668\u9047\u5230\u7684\u932f\u8aa4\uff0cError9002\" height=\"171\" alt=\"01_\u5728\u67e5\u8a62\u7de8\u8f2f\u5668\u9047\u5230\u7684\u932f\u8aa4\uff0cError9002\" src=\"http:\/\/lh4.ggpht.com\/_YF2-PvwqBh4\/ScW2RMJSyUI\/AAAAAAAAB0I\/mxPxHLIOpmk\/Image.png?imgmax=800\" width=\"717\" border=\"0\" \/><\/a><\/p>\n<p><a href=\"http:\/\/4.bp.blogspot.com\/_YF2-PvwqBh4\/ScXLfkmimAI\/AAAAAAAAB0k\/1-OSCGNejgI\/s1600-h\/02_%E4%BA%8B%E4%BB%B6%E6%AA%A2%E8%A6%96%E5%99%A8%E7%9A%84%E9%8C%AF%E8%AA%A4%E8%A8%8A%E6%81%AF%EF%BC%8C%E4%BA%A4%E6%98%93%E8%A8%98%E9%8C%84%E5%B7%B2%E6%BB%BF.png\"><img alt=\"\" src=\"http:\/\/4.bp.blogspot.com\/_YF2-PvwqBh4\/ScXLfkmimAI\/AAAAAAAAB0k\/1-OSCGNejgI\/s400\/02_%E4%BA%8B%E4%BB%B6%E6%AA%A2%E8%A6%96%E5%99%A8%E7%9A%84%E9%8C%AF%E8%AA%A4%E8%A8%8A%E6%81%AF%EF%BC%8C%E4%BA%A4%E6%98%93%E8%A8%98%E9%8C%84%E5%B7%B2%E6%BB%BF.png\" border=\"0\" \/><\/a><\/p>\n<p><a href=\"http:\/\/3.bp.blogspot.com\/_YF2-PvwqBh4\/ScXO3SISt1I\/AAAAAAAAB00\/VDz84cfbIQ0\/s1600-h\/03_SQLServer%E9%8C%AF%E8%AA%A4%E8%A8%98%E9%8C%84%E6%AA%94%EF%BC%8C%E4%BA%A4%E6%98%93%E8%A8%98%E9%8C%84%E5%B7%B2%E6%BB%BF.png\"><img alt=\"\" src=\"http:\/\/3.bp.blogspot.com\/_YF2-PvwqBh4\/ScXO3SISt1I\/AAAAAAAAB00\/VDz84cfbIQ0\/s400\/03_SQLServer%E9%8C%AF%E8%AA%A4%E8%A8%98%E9%8C%84%E6%AA%94%EF%BC%8C%E4%BA%A4%E6%98%93%E8%A8%98%E9%8C%84%E5%B7%B2%E6%BB%BF.png\" border=\"0\" \/><\/a><\/p>\n<hr \/>\n<p>\u82e5\u4f7f\u7528\u7684\u7248\u672c\u662f SQL Server <strong>2000\u30012005\u30012008<\/strong>\uff1a<\/p>\n<p>\u53ef\u4ee5\u4f7f\u7528 SSMS \u5716\u578b\u4ecb\u9762\u7ba1\u7406\u5de5\u5177\uff0c\u76f4\u63a5\u622a\u65b7\u3001\u6e05\u7a7a\u4ea4\u6613\u8a18\u9304\u6a94\u7684\u5167\u5bb9\u3002\u6d41\u7a0b\u5982\u4e0b\uff1a<\/p>\n<p>\u5c07\u8cc7\u6599\u5eab\u5207\u63db\u70ba\u300c\u7c21\u55ae\u5fa9\u539f\u6a21\u5f0f\u300d\uff0c\u4fbf\u6703\u81ea\u52d5\u622a\u65b7\u3001\u6e05\u7a7a\u4ea4\u6613\u8a18\u9304\u3002<\/p>\n<p>\u82e5\u6c7a\u5b9a\u8981\u5099\u4efd\u4ea4\u6613\u8a18\u9304\u6a94(*.ldf)\uff0c\u8acb\u518d\u5207\u63db\u56de\u300c\u5b8c\u6574\u5fa9\u539f\u6a21\u5f0f\u300d\u3002<\/p>\n<p>\u6b65\u9a5f\u5982\u4e0b\uff1a<br \/>\n  <br \/>\u6b65\u9a5f01. \u57f7\u884cSSMS\uff0c\u5728\u300c\u7269\u4ef6\u7e3d\u7ba1\u300d\uff0c\u5c55\u958b\u300c\u8cc7\u6599\u5eab\u300d\uff0c\u9078\u64c7\u6307\u5b9a\u7684\u8cc7\u6599\u5eab\uff0c\u6ed1\u9f20\u53f3\u9375\uff0c\u9078\u64c7\uff1a\u300c\u5c6c\u6027\u300d\u3002<\/p>\n<p>\u6b65\u9a5f02. \u5728\u300c\u8cc7\u6599\u5eab\u5c6c\u6027\u300d\u8996\u7a97\uff0c\u5728\u5de6\u908a\u300c\u9078\u53d6\u9801\u9762\u300d\u9801\u7c64\uff0c\u9ede\u9078\uff1a\u300c\u9078\u9805\u300d \u3002<\/p>\n<p>\u6b65\u9a5f03. \u5728\u53f3\u908a\u7684\u300c\u5fa9\u539f\u6a21\u5f0f\u300d\u65b9\u584a\uff0c\u5c07\u539f\u4f86\u8a2d\u5b9a\u7684\u300c\u5b8c\u6574\u300d\uff0c\u6539\u9078\u53d6\u70ba\uff1a\u300c\u7c21\u55ae\u300d\u3002 \u8acb\u53c3\u8003\u4e0b\u5716\u6240\u793a\uff1a<\/p>\n<p><a href=\"http:\/\/lh3.ggpht.com\/_YF2-PvwqBh4\/ScW2lBpx9zI\/AAAAAAAAB0c\/x6t_aJMC9OQ\/s1600-h\/Image.png\"><img loading=\"lazy\" title=\"04_\u5207\u63db\u70ba\u300c\u7c21\u55ae\u5fa9\u539f\u6a21\u5f0f\u300d\" height=\"784\" alt=\"04_\u5207\u63db\u70ba\u300c\u7c21\u55ae\u5fa9\u539f\u6a21\u5f0f\u300d\" src=\"http:\/\/lh3.ggpht.com\/_YF2-PvwqBh4\/ScW2n8DKMUI\/AAAAAAAAB0g\/KA8Qsn89HWA\/Image.png?imgmax=800\" width=\"708\" border=\"0\" \/><\/a><\/p>\n<p>\u6b65\u9a5f04. \u9ede\u9078\u300c\u78ba\u5b9a\u300d\uff0c\u5b8c\u6210\u52d5\u622a\u65b7\u3001\u6e05\u7a7a\u4ea4\u6613\u8a18\u9304\u3002<br \/>\n  <br \/>\u6b65\u9a5f05. \u91cd\u8907\u57f7\u884c\u6b65\u9a5f01~04\uff0c\u4f46\u5c07\u6b64\u8cc7\u6599\u5eab\u8abf\u6574\u70ba\u300c\u5b8c\u6574\u5fa9\u539f\u6a21\u5f0f\u300d\u3002<\/p>\n<p>\u6216\u662f\u5229\u7528\u4ee5\u4e0b\u7684 Transact-SQL \u9673\u8ff0\u5f0f\uff1a<\/p>\n<p><a href=\"http:\/\/sharedderrick.blogspot.com\/2009\/03\/transaction-log-for-database-is-full.html#\">view plain<\/a><a href=\"http:\/\/sharedderrick.blogspot.com\/2009\/03\/transaction-log-for-database-is-full.html#\">copy to clipboard<\/a><a href=\"http:\/\/sharedderrick.blogspot.com\/2009\/03\/transaction-log-for-database-is-full.html#\">print<\/a><a href=\"http:\/\/sharedderrick.blogspot.com\/2009\/03\/transaction-log-for-database-is-full.html#\">?<\/a><\/p>\n<ol>\n<li>\/*&#160; <\/li>\n<li>\u7576\u8cc7\u6599\u5eab\u4f7f\u7528\u7c21\u55ae\u5fa9\u539f\u6a21\u5f0f\u6642\uff0c\u4fbf\u6703\u81ea\u52d5\u622a\u65b7\u4ea4\u6613\u8a18\u9304\u3002&#160; <\/li>\n<li>\u5982\u679c\u60a8\u5fc5\u9808\u5f9e\u8cc7\u6599\u5eab\u4e2d\u79fb\u9664\u8a18\u9304\u5099\u4efd\u93c8\u7d50\uff0c\u8acb\u5207\u63db\u5230\u7c21\u55ae\u5fa9\u539f\u6a21\u5f0f\u3002&#160; <\/li>\n<li>*\/&#160; <\/li>\n<li>&#8211;01 \u5c07\u8cc7\u6599\u5eab Northwind \u5207\u63db\u70ba\u300c\u7c21\u55ae\u5fa9\u539f\u6a21\u5f0f\u300d\uff0c\u4fbf\u6703\u81ea\u52d5\u622a\u65b7\u4ea4\u6613\u8a18\u9304\u3002<\/li>\n<li>ALTER DATABASE Northwind&#160; <\/li>\n<li>SET RECOVERY SIMPLE&#160; <\/li>\n<li>GO&#160; <\/li>\n<li><\/li>\n<li>&#8211;02 \u82e5\u6c7a\u5b9a\u8981\u5099\u4efd\u4ea4\u6613\u8a18\u9304\u6a94(*.ldf)\uff0c\u518d\u5c07\u8cc7\u6599\u5eab Northwind \u5207\u63db\u56de\u300c\u5b8c\u6574\u5fa9\u539f\u6a21\u5f0f\u300d<\/li>\n<li>ALTER DATABASE Northwind&#160; <\/li>\n<li>SET RECOVERY FULL<\/li>\n<li>GO&#160; <\/li>\n<\/ol>\n<pre><br \/>\/*<br \/>\u7576\u8cc7\u6599\u5eab\u4f7f\u7528\u7c21\u55ae\u5fa9\u539f\u6a21\u5f0f\u6642\uff0c\u4fbf\u6703\u81ea\u52d5\u622a\u65b7\u4ea4\u6613\u8a18\u9304\u3002<br \/>\u5982\u679c\u60a8\u5fc5\u9808\u5f9e\u8cc7\u6599\u5eab\u4e2d\u79fb\u9664\u8a18\u9304\u5099\u4efd\u93c8\u7d50\uff0c\u8acb\u5207\u63db\u5230\u7c21\u55ae\u5fa9\u539f\u6a21\u5f0f\u3002<br \/>*\/<br \/>--01 \u5c07\u8cc7\u6599\u5eab Northwind \u5207\u63db\u70ba\u300c\u7c21\u55ae\u5fa9\u539f\u6a21\u5f0f\u300d\uff0c\u4fbf\u6703\u81ea\u52d5\u622a\u65b7\u4ea4\u6613\u8a18\u9304\u3002<br \/>ALTER DATABASE Northwind<br \/>SET RECOVERY SIMPLE<br \/>GO<br \/><br \/>--02 \u82e5\u6c7a\u5b9a\u8981\u5099\u4efd\u4ea4\u6613\u8a18\u9304\u6a94(*.ldf)\uff0c\u518d\u5c07\u8cc7\u6599\u5eab Northwind \u5207\u63db\u56de\u300c\u5b8c\u6574\u5fa9\u539f\u6a21\u5f0f\u300d<br \/>ALTER DATABASE Northwind<br \/>SET RECOVERY FULL<br \/>GO<br \/><\/pre>\n<hr \/>\n<p>\u9020\u6210\u7121\u6cd5\u622a\u65b7\u7684\u539f\u56e0\u53ef\u80fd\u5f88\u591a\uff0c\u4f8b\u5982\uff1a\u4ecd\u6709\u4ea4\u6613\u5728\u57f7\u884c\u4e2d\u7b49\u3002\u6240\u4ee5\u82e5\u60a8\u767c\u89ba\u7121\u6cd5\u622a\u65b7\u4ea4\u6613\u8a18\u9304\u6a94\uff0c\u8acb\u518d\u5ea6\u57f7\u884c\u4e0a\u8ff0\u7684\u52d5\u4f5c\u6216\u662fTransact-SQL \u9673\u8ff0\u5f0f\uff0c\u6216\u8a31\u5c31\u53ef\u4ee5\u622a\u65b7\u4ea4\u6613\u8a18\u9304\u6a94\u3002 <\/p>\n<p>\u82e5\u57f7\u884c\u6578\u6b21\u5f8c\u90fd\u7121\u6cd5\u622a\u65b7\u4ea4\u6613\u8a18\u9304\uff0c\u5efa\u8b70\u60a8\u53ef\u4ee5\u67e5\u8a62\u7cfb\u7d71\u6aa2\u8996 sys.databases \u4e2d\u7684 log_reuse_wait_desc \u8cc7\u6599\u884c\u7684\u63cf\u8ff0\u8aaa\u660e\uff0c\u627e\u51fa\u70ba\u4f55\u7121\u6cd5\u622a\u65b7\u7684\u53ef\u80fd\u56e0\u7d20\u3002<\/p>\n<hr \/>\n<p>\u82e5\u4f7f\u7528\u7684\u7248\u672c\u662f SQL Server <strong>2000\u30012005<\/strong>\uff0c\u53ef\u4ee5\u4efb\u9078\u4ee5\u4e0bTransact-SQL \u9673\u8ff0\u5f0f\uff0c\u4f86\u622a\u65b7\u3001\u6e05\u7a7a\u4ea4\u6613\u8a18\u9304\u6a94\u7684\u5167\u5bb9\uff0c\u4f46\u662f SQL Server 2008 \u5df2\u7d93\u4e0d\u518d\u652f\u63f4\u4ee5\u4e0b\u7684\u5beb\u6cd5\uff1a<\/p>\n<p><a href=\"http:\/\/sharedderrick.blogspot.com\/2009\/03\/transaction-log-for-database-is-full.html#\">view plain<\/a><a href=\"http:\/\/sharedderrick.blogspot.com\/2009\/03\/transaction-log-for-database-is-full.html#\">copy to clipboard<\/a><a href=\"http:\/\/sharedderrick.blogspot.com\/2009\/03\/transaction-log-for-database-is-full.html#\">print<\/a><a href=\"http:\/\/sharedderrick.blogspot.com\/2009\/03\/transaction-log-for-database-is-full.html#\">?<\/a><\/p>\n<ol>\n<li>&#8211;01 \u4f7f\u7528 BACKUP LOG &#8230; WITH NO_LOG<\/li>\n<li>BACKUP LOG Northwind&#160; <\/li>\n<li>WITH NO_LOG&#160; <\/li>\n<li>GO&#160; <\/li>\n<li><\/li>\n<li>&#8211;02 \u6216\u662f\uff0c\u4f7f\u7528 BACKUP LOG &#8230; WITH TRUNCATE_ONLY<\/li>\n<li>BACKUP LOG Northwind&#160; <\/li>\n<li>WITH TRUNCATE_ONLY&#160; <\/li>\n<li>GO&#160; <\/li>\n<\/ol>\n<pre><br \/>--01 \u4f7f\u7528 BACKUP LOG ... WITH NO_LOG<br \/>BACKUP LOG Northwind<br \/>WITH NO_LOG<br \/>GO<br \/><br \/>--02 \u6216\u662f\uff0c\u4f7f\u7528 BACKUP LOG ... WITH TRUNCATE_ONLY<br \/>BACKUP LOG Northwind<br \/>WITH TRUNCATE_ONLY<br \/>GO<br \/><\/pre>\n<p>BACKUP LOG \u9673\u8ff0\u5f0f\u7684 NO_LOG \u548c TRUNCATE_ONLY \u9078\u9805\u6703\u4e2d\u65b7\u8a18\u9304\u93c8\uff0c<br \/>\n  <br \/>\u56e0\u70ba\u5b83\u5011\u6703\u5728\u6c92\u6709\u5efa\u7acb\u5099\u4efd\u526f\u672c\u60c5\u6cc1\u4e0b\uff0c\u79fb\u9664\u8a18\u9304\u7684\u975e\u4f7f\u7528\u4e2d\u90e8\u5206\u3002<\/p>\n<p>\u5728\u4e0b\u6b21\u9032\u884c\u5b8c\u6574\u6216\u5dee\u7570\u8cc7\u6599\u5eab\u5099\u4efd\u4e4b\u524d\uff0c\u7121\u6cd5\u4fdd\u8b77\u8cc7\u6599\u5eab\u514d\u65bc\u5a92\u9ad4\u5931\u6557\u3002 <\/p>\n<p>\u4e0b\u4e00\u7248\u7684 Microsoft SQL Server \u5c07\u4e0d\u518d\u63d0\u4f9b\u6b64\u529f\u80fd\u3002<br \/>\n  <br \/>\u8acb\u52ff\u5728\u65b0\u7684\u958b\u767c\u5de5\u4f5c\u4e2d\u4f7f\u7528\u6b64\u529f\u80fd\uff0c\u4e26\u4e14\u5118\u901f\u4fee\u6539\u4f7f\u7528\u6b64\u529f\u80fd\u7684\u61c9\u7528\u7a0b\u5f0f\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u4f7f\u7528 BACKUP LOG &#8230; WITH NO_LOG \u6216 BACKUP LOG &#8230; WITH TRUNCATE_ONLY \u5728 SQL Server 2008 \u4e0a\u57f7\u884c\u6240\u7522\u751f\u7684\u932f\u8aa4\u8a0a\u606f\uff1a<\/p>\n<p><a href=\"http:\/\/sharedderrick.blogspot.com\/2009\/03\/transaction-log-for-database-is-full.html#\">view plain<\/a><a href=\"http:\/\/sharedderrick.blogspot.com\/2009\/03\/transaction-log-for-database-is-full.html#\">copy to clipboard<\/a><a href=\"http:\/\/sharedderrick.blogspot.com\/2009\/03\/transaction-log-for-database-is-full.html#\">print<\/a><a href=\"http:\/\/sharedderrick.blogspot.com\/2009\/03\/transaction-log-for-database-is-full.html#\">?<\/a><\/p>\n<ol>\n<li>&#8211;01 \u5728SQL Server 2008\u4e0a\uff0c\u4f7f\u7528 BACKUP LOG &#8230; WITH NO_LOG\uff0c\u9047\u5230\u7684\u932f\u8aa4\u8a0a\u606f\uff1a<\/li>\n<li>BACKUP LOG Northwind&#160; <\/li>\n<li>WITH NO_LOG&#160; <\/li>\n<li>\/*&#160; <\/li>\n<li>\u8a0a\u606f 3032\uff0c\u5c64\u7d1a 16\uff0c\u72c0\u614b 2\uff0c\u884c 1&#160; <\/li>\n<li>\u9019\u500b\u9673\u8ff0\u5f0f\u4e0d\u652f\u63f4\u4e00\u6216\u591a\u500b\u9078\u9805 (no_log)\u3002\u8acb\u67e5\u95b1\u6587\u4ef6\u96c6\uff0c\u4e86\u89e3\u652f\u63f4\u7684\u9078\u9805\u3002&#160; <\/li>\n<li>*\/&#160; <\/li>\n<li><\/li>\n<li>&#8211;01 \u5728SQL Server 2008\u4e0a\uff0c\u4f7f\u7528 BACKUP LOG &#8230; WITH TRUNCATE_ONLY\uff0c\u9047\u5230\u7684\u932f\u8aa4\u8a0a\u606f\uff1a<\/li>\n<li>BACKUP LOG Northwind&#160; <\/li>\n<li>WITH TRUNCATE_ONLY&#160; <\/li>\n<li>GO&#160; <\/li>\n<li><\/li>\n<li>\/*&#160; <\/li>\n<li>\u8a0a\u606f 155\uff0c\u5c64\u7d1a 15\uff0c\u72c0\u614b 1\uff0c\u884c 3&#160; <\/li>\n<li>&#8216;TRUNCATE_ONLY&#8217; \u4e0d\u662f\u53ef\u8fa8\u8b58\u7684 BACKUP \u9078\u9805\u3002&#160; <\/li>\n<li>*\/&#160; <\/li>\n<\/ol>\n<pre><br \/>--01 \u5728SQL Server 2008\u4e0a\uff0c\u4f7f\u7528 BACKUP LOG ... WITH NO_LOG\uff0c\u9047\u5230\u7684\u932f\u8aa4\u8a0a\u606f\uff1a<br \/>BACKUP LOG Northwind<br \/>WITH NO_LOG<br \/>\/*<br \/>\u8a0a\u606f 3032\uff0c\u5c64\u7d1a 16\uff0c\u72c0\u614b 2\uff0c\u884c 1<br \/>\u9019\u500b\u9673\u8ff0\u5f0f\u4e0d\u652f\u63f4\u4e00\u6216\u591a\u500b\u9078\u9805 (no_log)\u3002\u8acb\u67e5\u95b1\u6587\u4ef6\u96c6\uff0c\u4e86\u89e3\u652f\u63f4\u7684\u9078\u9805\u3002<br \/>*\/<br \/><br \/>--01 \u5728SQL Server 2008\u4e0a\uff0c\u4f7f\u7528 BACKUP LOG ... WITH TRUNCATE_ONLY\uff0c\u9047\u5230\u7684\u932f\u8aa4\u8a0a\u606f\uff1a<br \/>BACKUP LOG Northwind<br \/>WITH TRUNCATE_ONLY<br \/>GO<br \/><br \/>\/*<br \/>\u8a0a\u606f 155\uff0c\u5c64\u7d1a 15\uff0c\u72c0\u614b 1\uff0c\u884c 3<br \/>'TRUNCATE_ONLY' \u4e0d\u662f\u53ef\u8fa8\u8b58\u7684 BACKUP \u9078\u9805\u3002<br \/>*\/<br \/><\/pre>\n<p>\u53c3\u8003\u8cc7\u6599\uff1a<br \/>\n  <br \/>\u7ba1\u7406\u4ea4\u6613\u8a18\u9304<\/p>\n<p><a href=\"http:\/\/technet.microsoft.com\/zh-tw\/library\/ms345382.aspx\">http:\/\/technet.microsoft.com\/zh-tw\/library\/ms345382.aspx<\/a><\/p>\n<p>SQL Server 2008 \u4e2d\u5df2\u505c\u6b62\u7684 Database Engine \u529f\u80fd<br \/>\n  <br \/><a href=\"http:\/\/msdn.microsoft.com\/zh-tw\/library\/ms144262.aspx\">http:\/\/msdn.microsoft.com\/zh-tw\/library\/ms144262.aspx<\/a><\/p>\n<p>\u7c21\u55ae\u5fa9\u539f\u6a21\u5f0f\u4e0b\u7684\u5099\u4efd<br \/>\n  <br \/><a href=\"http:\/\/technet.microsoft.com\/zh-tw\/library\/ms191164.aspx\">http:\/\/technet.microsoft.com\/zh-tw\/library\/ms191164.aspx<\/a><\/p>\n<p>\u4ea4\u6613\u8a18\u9304\u622a\u65b7<br \/>\n  <br \/><a href=\"http:\/\/technet.microsoft.com\/zh-tw\/library\/ms189085.aspx\">http:\/\/technet.microsoft.com\/zh-tw\/library\/ms189085.aspx<\/a><\/p>\n<p>\u5982\u4f55\u907f\u514d SQL Server \u8cc7\u6599\u5eab\u7684\u4ea4\u6613\u8a18\u9304\u6a94\u8d85\u51fa\u9810\u671f\u5927\u5c0f<br \/>\n  <br \/><a href=\"http:\/\/support.microsoft.com\/kb\/873235\/zh-tw\">http:\/\/support.microsoft.com\/kb\/873235\/zh-tw<\/a><\/p>\n<p>\u5f35\u8cbc\u8005\uff1a Derrick Chen \u4f4d\u65bc <a href=\"http:\/\/sharedderrick.blogspot.com\/2009\/03\/transaction-log-for-database-is-full.html\"><abbr>3\/22\/2009 11:55:00 \u4e0a\u5348<\/abbr><\/a> <a href=\"http:\/\/www.blogger.com\/email-post.g?blogID=1420955872914622499&amp;postID=651058180798086098\"><\/a><a href=\"http:\/\/www.blogger.com\/post-edit.g?blogID=1420955872914622499&amp;postID=651058180798086098\"><img loading=\"lazy\" height=\"18\" alt=\"\" src=\"http:\/\/www.blogger.com\/img\/icon18_edit_allbkg.gif\" width=\"18\" \/> <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u5728\u770bSQL\u5099\u4efd\u7684\u65b9\u5f0f\uff0c\u627e\u5230\u4e86\u9019\u7bc7\u6587\u7ae0\uff0c\u6015\u6709\u4e9b\u6587\u7ae0\u6703\u6d88\u5931\uff0c\u56fa\u5b8c\u6574\u8f49\u8cbc\u4fdd\u5b58\uff0c\u4e26\u6a19\u660e\u51fa\u8655\uff1a   http:\/\/sharedderrick.blogspot.com\/2009\/03\/transaction-log-for-database-is-full.html<\/p>\n<p>&#160;<\/p>\n<p>\u4ea4\u6613\u8a18\u9304\u6a94\u5df2\u6eff\u3001\u7206\u6389\uff1b\u622a\u65b7\u4ea4\u6613\u8a18\u9304\u6a94\u3002\uff08The transaction log for database &#8216;DB1&#8217; is full. \uff1bTransaction Log Truncation\uff09<\/p>\n<p>\u672c\u6587\u50c5\u8a0e\u8ad6\u7576\u767c\u751f\u4ea4\u6613\u8a18\u9304\u6a94\u5df2\u6eff\u3001\u7206\u6389\u6642\u7684\u707d\u96e3\u8655\u7406\u65b9\u5f0f\uff0c\u4e26\u672a\u8a0e\u8ad6\u5982\u4f55\u907f\u514d\u767c\u751f\u4ea4\u6613\u8a18\u9304\u6a94\u5df2\u6eff\u7684\u4f5c\u6cd5\uff0c\u8acb\u53c3\u8003\u300c\u7ba1\u7406\u4ea4\u6613\u8a18\u9304\u300d\u7b49\u76f8\u95dc\u4e3b\u984c\u3002   http:\/\/technet.microsoft.com\/zh-tw\/library\/ms345382.aspx    \u5982\u4f55\u907f\u514d SQL Server \u8cc7\u6599\u5eab\u7684\u4ea4\u6613\u8a18\u9304\u6a94\u8d85\u51fa\u9810\u671f\u5927\u5c0f    http:\/\/support.microsoft.com\/kb\/873235\/zh-tw<\/p>\n<p>\u82e5\u8cc7\u6599\u5eab\u56e0\u6545\u9020\u6210\u4ea4\u6613\u8a18\u9304\u6a94\u5df2\u6eff\u3001\u7206\u6389\uff0c\u5c07\u5c0e\u81f4\u7121\u6cd5\u57f7\u884c\u65b0\u589e\u3001\u522a\u9664\u7b49\u4f5c\u696d\u3002 <\/p>\n<p>\u9047\u5230\u7684\u932f\u8aa4\u8a0a\u606f\uff1a<\/p>\n<p>view plaincopy to clipboardprint?<\/p>\n<p>\u8a0a\u606f 9002\uff0c\u5c64\u7d1a 17\uff0c\u72c0\u614b 2\uff0c\u884c 2&#160;<br \/>\n\u8cc7\u6599\u5eab &#8216;db1&#8217; \u7684\u4ea4\u6613\u8a18\u9304\u5df2\u6eff\u3002\u5982\u679c\u8981\u4e86\u89e3\u70ba\u4f55\u7121\u6cd5\u91cd\u8907\u4f7f\u7528\u8a18\u9304\u4e2d\u7684\u7a7a\u9593\uff0c\u8acb\u53c3\u95b1 sys.databases \u4e2d\u7684 log_reuse_wait_desc \u8cc7\u6599\u884c\u3002&#160; <\/p>\n<p>Msg 9002, Level 17, State 2, Line 2&#160;<br \/>\nThe transaction log for [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[27],"tags":[76,77,78,79,80,81],"_links":{"self":[{"href":"http:\/\/blog.infinity.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/107"}],"collection":[{"href":"http:\/\/blog.infinity.idv.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.infinity.idv.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.infinity.idv.tw\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.infinity.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=107"}],"version-history":[{"count":0,"href":"http:\/\/blog.infinity.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/107\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.infinity.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=107"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.infinity.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=107"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.infinity.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}