{"id":53588,"date":"2023-07-25T12:43:19","date_gmt":"2023-07-25T04:43:19","guid":{"rendered":"http:\/\/stmu.1000uc.com\/mu\/?p=53588"},"modified":"2023-07-25T12:43:19","modified_gmt":"2023-07-25T04:43:19","slug":"%e5%a5%87%e8%bf%b9mu%e6%95%b0%e6%8d%ae%e5%ba%93%ef%bc%9fsql-2008%e6%95%b0%e6%8d%ae%e5%ba%93%e6%97%a5%e5%bf%97%e6%94%b6%e7%bc%a9","status":"publish","type":"post","link":"http:\/\/stmu.1000uc.com\/mu\/53588.html","title":{"rendered":"mu\u6570\u636e\u5e93\uff1fSQL 2008\u6570\u636e\u5e93\u65e5\u5fd7\u6536\u7f29"},"content":{"rendered":"<p>\u8001\u94c1\u4eec\uff0c\u5927\u5bb6\u597d\uff0c\u76f8\u4fe1\u8fd8\u6709\u5f88\u591a\u670b\u53cb\u5bf9\u4e8e\u5947\u8ff9mu\u6570\u636e\u5e93\u548cSQL 2008\u6570\u636e\u5e93\u65e5\u5fd7\u6536\u7f29\u7684\u76f8\u5173\u95ee\u9898\u4e0d\u592a\u61c2\uff0c\u6ca1\u5173\u7cfb\uff0c\u4eca\u5929\u5c31\u7531\u6211\u6765\u4e3a\u5927\u5bb6\u5206\u4eab\u5206\u4eab\u5947\u8ff9mu\u6570\u636e\u5e93\u4ee5\u53caSQL 2008\u6570\u636e\u5e93\u65e5\u5fd7\u6536\u7f29\u7684\u95ee\u9898\uff0c\u6587\u7ae0\u7bc7\u5e45\u53ef\u80fd\u504f\u957f\uff0c\u5e0c\u671b\u53ef\u4ee5\u5e2e\u52a9\u5230\u5927\u5bb6\uff0c\u4e0b\u9762\u4e00\u8d77\u6765\u770b\u770b\u5427\uff01<\/p>\n<h3>SQL 2008\u6570\u636e\u5e93\u65e5\u5fd7\u6536\u7f29<\/h3>\n<p>\u5177\u4f53\u65b9\u6cd5\u67093\u79cd\u3002<\/p>\n<p>\u65b9\u6cd5\u4e00:<\/p>\n<p>\u7b2c\u4e00\u6b65\uff1a<\/p>\n<p>backuplogdatabase_namewithno_log<\/p>\n<p>\u6216\u8005backuplogdatabase_namewithtruncate_only<\/p>\n<p>&#8211;no_log\u548ctruncate_only\u662f\u5728\u8fd9\u91cc\u662f\u540c\u4e49\u7684\uff0c\u968f\u4fbf\u6267\u884c\u54ea\u4e00\u53e5\u90fd\u53ef\u4ee5\u3002<\/p>\n<p>\u7b2c\u4e8c\u6b65\uff1a<\/p>\n<p>1.\u6536\u7f29\u7279\u5b9a\u6570\u636e\u5e93\u7684\u6240\u6709\u6570\u636e\u548c\u65e5\u5fd7\u6587\u4ef6\uff0c\u6267\u884c\uff1a<\/p>\n<p>dbccshrinkdatabase(database_name,[,target_percent])<\/p>\n<p>&#8211;database_name\u662f\u8981\u6536\u7f29\u7684\u6570\u636e\u5e93\u540d\u79f0\uff1btarget_percent\u662f\u6570\u636e\u5e93\u6536\u7f29\u540e\u7684\u6570\u636e\u5e93\u6587\u4ef6\u4e2d\u6240\u8981\u7684\u5269\u4f59\u53ef\u7528\u7a7a\u95f4\u767e\u5206\u6bd4\u3002<\/p>\n<p>2.\u6536\u7f29\u4e00\u6b21\u4e00\u4e2a\u7279\u5b9a\u6570\u636e\u5e93\u4e2d\u7684\u6570\u636e\u6216\u65e5\u5fd7\u6587\u4ef6\uff0c\u6267\u884c<\/p>\n<p>dbccshrinkfile(file_id,[,target_size])<\/p>\n<p>&#8211;file_id\u662f\u8981\u6536\u7f29\u7684\u6587\u4ef6\u7684\u6807\u8bc6(id)\u53f7,\u82e5\u8981\u83b7\u5f97\u6587\u4ef6id\uff0c\u8bf7\u4f7f\u7528file_id\u51fd\u6570\u6216\u5728\u5f53\u524d\u6570\u636e\u5e93\u4e2d\u641c\u7d22syiles\uff1btarget_size\u662f\u7528\u5146\u5b57\u8282\u8868\u793a\u7684\u6240\u8981\u7684\u6587\u4ef6\u5927\u5c0f\uff08\u7528\u6574\u6570\u8868\u793a\uff09\u3002\u5982\u679c\u6ca1\u6709\u6307\u5b9a\uff0cdbccshrinkfile\u5c06\u6587\u4ef6\u5927\u5c0f\u51cf\u5c11\u5230\u9ed8\u8ba4\u6587\u4ef6\u5927\u5c0f\u3002\u4e24\u4e2adbcc\u90fd\u53ef\u4ee5\u5e26\u4e0a\u53c2\u6570notruncate\u6216truncateonly\uff0c\u5177\u4f53\u610f\u601d\u67e5\u770b\u8054\u673a\u5e2e\u52a9.<\/p>\n<p>\u65b9\u6cd5\u4e8c\uff1a<\/p>\n<p>\u7b2c\u4e00\u6b65\uff1a<\/p>\n<p>\u5148\u5907\u4efd\u6574\u4e2a\u6570\u636e\u5e93\u4ee5\u5907\u4e0d\u6d4b\u3002<\/p>\n<p>\u7b2c\u4e8c\u6b65\uff1a<\/p>\n<p>\u5907\u4efd\u7ed3\u675f\u540e\uff0c\u5728queryanalyzer\u4e2d\u6267\u884c\u5982\u4e0b\u7684\u8bed\u53e5\uff1a<\/p>\n<p>execsp_detach_dbyourdbname,true<\/p>\n<p>&#8211;\u5378\u9664\u8fd9\u4e2adb\u5728mssql\u4e2d\u7684\u6ce8\u518c\u4fe1\u606f<\/p>\n<p>\u7b2c\u4e09\u6b65\uff1a<\/p>\n<p>\u5230\u65e5\u5fd7\u7684\u7269\u7406\u6587\u4ef6\u6240\u5728\u7684\u76ee\u5f55\u4e2d\u53bb\u5220\u9664\u8be5\u65e5\u5fd7\u6587\u4ef6\u6216\u8005\u5c06\u8be5\u65e5\u5fd7\u6587\u4ef6\u79fb\u51fa\u8be5\u76ee\u5f55<\/p>\n<p>\u7b2c\u56db\u6b65\uff1a<\/p>\n<p>\u5728queryanalyzer\u4e2d\u6267\u884c\u5982\u4e0b\u7684\u8bed\u53e5\uff1a<\/p>\n<p>execsp_attach_single_file_dbyourdbname,&#8217;<\/p>\n<p>d:\\mssql\\data\\yourdbname_data.mdf&#8217;<\/p>\n<p>&#8211;\u4ee5\u5355\u6587\u4ef6\u7684\u65b9\u5f0f\u6ce8\u518c\u8be5db\uff0c\u5982\u679c\u6210\u529f\u5219mssql\u5c06\u81ea\u52a8\u4e3a\u8fd9\u4e2adb\u751f\u6210\u4e00\u4e2a500k\u7684\u65e5\u5fd7\u6587\u4ef6\u3002<\/p>\n<p>\u65b9\u6cd5\u4e09:<\/p>\n<p>1.\u8fdb\u5165\u4f01\u4e1a\u7ba1\u7406\u5668\uff0c\u9009\u4e2d\u6570\u636e\u5e93\uff0c\u6bd4\u5982demo<\/p>\n<p>2.\u6240\u6709\u4efb\u52a1-&gt;\u5206\u79bb\u6570\u636e\u5e93<\/p>\n<p>3.\u5230\u6570\u636e\u5e93\u6587\u4ef6\u7684\u5b58\u653e\u76ee\u5f55\uff0c\u5c06muonline_log.ldf\u6587\u4ef6\u5220\u9664\uff0c\u4ee5\u9632\u4e07\u4e00\uff0c\u4f60\u53ef\u4ee5\u62f7\u51fa\u53bb<\/p>\n<p>4.\u4f01\u4e1a\u7ba1\u7406\u5668-&gt;\u9644\u52a0\u6570\u636e\u5e93\uff0c\u9009muonline\uff0c\u8fd9\u4e2a\u65f6\u5019\u4f60\u4f1a\u770b\u89c1\u65e5\u5fd7\u6587\u4ef6\u8fd9\u9879\u662f\u4e00\u4e2a\u53c9\uff0c\u4e0d\u8981\u7d27\uff0c\u7ee7\u7eed\uff0c\u6b64\u65f6\u6570\u636e\u5e93\u5c31\u4f1a\u63d0\u793a\u4f60\u8be5\u6570\u636e\u5e93\u65e0\u65e5\u5fd7\u662f\u5426\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\uff0c\u786e\u5b9a\u5c31\u662f\u4e86\u3002<\/p>\n<p>5.\u8bb0\u5f97\u6570\u636e\u5e93\u91cd\u65b0\u9644\u52a0\u540e\u7528\u6237\u8981\u91cd\u65b0\u8bbe\u7f6e\u4e00\u4e0b\u3002<\/p>\n<p>\u5982\u679c\u4ee5\u540e,\u4e0d\u60f3\u8981\u5b83\u53d8\u5927:<\/p>\n<p>sql2000\u4e0b\u4f7f\u7528\uff1a<\/p>\n<p>\u5728\u6570\u636e\u5e93\u4e0a\u70b9\u53f3\u952e-&gt;\u5c5e\u6027-&gt;\u9009\u9879-&gt;\u6545\u969c\u6062\u590d-\u6a21\u578b-\u9009\u62e9-\u7b80\u5355\u6a21\u578b\u3002<\/p>\n<p>\u6216\u7528sql\u8bed\u53e5\uff1a<\/p>\n<p>alterdatabase\u6570\u636e\u5e93\u540dsetrecoverysimple<\/p>\n<h3>XP\u7cfb\u7edf\u80fd\u67b6\u8bbe\u5947\u8ff9SF\u5417<\/h3>\n<p>\u53ef\u4ee5\u7684\uff0c\u4e0d\u8fc7\u4f60\u53ea\u80fd\u88c5SQLPerson\u7248\u672c\u7684\u6570\u636e\u5e93\uff0c\u5efa\u8bae\u4f7f\u7528windows2003server\u5b89\u88c5mu,\u975e\u5e38\u597d\u7684\u3002<\/p>\n<p>\u6587\u7ae0\u5230\u6b64\u7ed3\u675f\uff0c\u5982\u679c\u672c\u6b21\u5206\u4eab\u7684\u5947\u8ff9mu\u6570\u636e\u5e93\u548cSQL 2008\u6570\u636e\u5e93\u65e5\u5fd7\u6536\u7f29\u7684\u95ee\u9898\u89e3\u51b3\u4e86\u60a8\u7684\u95ee\u9898\uff0c\u90a3\u4e48\u6211\u4eec\u7531\u8877\u7684\u611f\u5230\u9ad8\u5174\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8001\u94c1\u4eec\uff0c\u5927\u5bb6\u597d\uff0c\u76f8\u4fe1\u8fd8\u6709\u5f88\u591a\u670b\u53cb\u5bf9\u4e8e\u5947\u8ff9mu\u6570\u636e\u5e93\u548cSQL 2008\u6570\u636e\u5e93\u65e5\u5fd7\u6536\u7f29\u7684\u76f8\u5173\u95ee\u9898\u4e0d\u592a\u61c2\uff0c\u6ca1\u5173\u7cfb\uff0c\u4eca\u5929\u5c31\u7531\u6211\u6765\u4e3a\u5927\u5bb6\u5206\u4eab\u5206\u4eab\u5947\u8ff9mu\u6570\u636e\u5e93\u4ee5\u53caSQL 2008\u6570\u636e\u5e93\u65e5\u5fd7\u6536\u7f29\u7684\u95ee\u9898\uff0c\u6587\u7ae0\u7bc7\u5e45\u53ef\u80fd\u504f\u957f\uff0c\u5e0c\u671b\u53ef\u4ee5\u5e2e\u52a9\u5230\u5927\u5bb6\uff0c\u4e0b\u9762\u4e00\u8d77\u6765\u770b&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"topic":[],"_links":{"self":[{"href":"http:\/\/stmu.1000uc.com\/mu\/wp-json\/wp\/v2\/posts\/53588"}],"collection":[{"href":"http:\/\/stmu.1000uc.com\/mu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/stmu.1000uc.com\/mu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/stmu.1000uc.com\/mu\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/stmu.1000uc.com\/mu\/wp-json\/wp\/v2\/comments?post=53588"}],"version-history":[{"count":1,"href":"http:\/\/stmu.1000uc.com\/mu\/wp-json\/wp\/v2\/posts\/53588\/revisions"}],"predecessor-version":[{"id":53589,"href":"http:\/\/stmu.1000uc.com\/mu\/wp-json\/wp\/v2\/posts\/53588\/revisions\/53589"}],"wp:attachment":[{"href":"http:\/\/stmu.1000uc.com\/mu\/wp-json\/wp\/v2\/media?parent=53588"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/stmu.1000uc.com\/mu\/wp-json\/wp\/v2\/categories?post=53588"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/stmu.1000uc.com\/mu\/wp-json\/wp\/v2\/tags?post=53588"},{"taxonomy":"topic","embeddable":true,"href":"http:\/\/stmu.1000uc.com\/mu\/wp-json\/wp\/v2\/topic?post=53588"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}