pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

  • <legend id='f1FQp'><style id='f1FQp'><dir id='f1FQp'><q id='f1FQp'></q></dir></style></legend>

    1. <i id='f1FQp'><tr id='f1FQp'><dt id='f1FQp'><q id='f1FQp'><span id='f1FQp'><b id='f1FQp'><form id='f1FQp'><ins id='f1FQp'></ins><ul id='f1FQp'></ul><sub id='f1FQp'></sub></form><legend id='f1FQp'></legend><bdo id='f1FQp'><pre id='f1FQp'><center id='f1FQp'></center></pre></bdo></b><th id='f1FQp'></th></span></q></dt></tr></i><div class="txvvlx5" id='f1FQp'><tfoot id='f1FQp'></tfoot><dl id='f1FQp'><fieldset id='f1FQp'></fieldset></dl></div>

        <small id='f1FQp'></small><noframes id='f1FQp'>

        • <bdo id='f1FQp'></bdo><ul id='f1FQp'></ul>
        <tfoot id='f1FQp'></tfoot>

        SQL/Windows 操作系統釋放未使用的空間

        SQL / Windows OS releasing unused space(SQL/Windows 操作系統釋放未使用的空間)

        <small id='CTcb2'></small><noframes id='CTcb2'>

        • <legend id='CTcb2'><style id='CTcb2'><dir id='CTcb2'><q id='CTcb2'></q></dir></style></legend>
          <i id='CTcb2'><tr id='CTcb2'><dt id='CTcb2'><q id='CTcb2'><span id='CTcb2'><b id='CTcb2'><form id='CTcb2'><ins id='CTcb2'></ins><ul id='CTcb2'></ul><sub id='CTcb2'></sub></form><legend id='CTcb2'></legend><bdo id='CTcb2'><pre id='CTcb2'><center id='CTcb2'></center></pre></bdo></b><th id='CTcb2'></th></span></q></dt></tr></i><div class="55tvtpz" id='CTcb2'><tfoot id='CTcb2'></tfoot><dl id='CTcb2'><fieldset id='CTcb2'></fieldset></dl></div>
          <tfoot id='CTcb2'></tfoot>
            <bdo id='CTcb2'></bdo><ul id='CTcb2'></ul>
                  <tbody id='CTcb2'></tbody>

                  本文介紹了SQL/Windows 操作系統釋放未使用的空間的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我最近對我的數據進行了一些存檔,并執行了以下操作:

                  I have recently done some archiving of my data, and performed the following:

                  我有一個包含超過 3300 萬條記錄的數據庫表,其中許多是重復的.

                  I had a database table that had over 33 million records, many of which were duplicates.

                  我備份了表并將唯一數據插入到新表中,然后重命名/交換表名,這實現了我所需要的.

                  I backed up the table and inserted the unique data into a new table, then renamed/swapped the table names, this achieved what I needed.

                  然而現在我只剩下兩張桌子......

                  Now however I am left with two tables...

                  • 表 1(良好/活動表)- 1000 萬條記錄
                  • Table1_Backup(備份表)- 3300 萬條記錄

                  執行此操作后,我的 SQL mdf/數據文件已上升至 319.7 GB,而我的日志文件已上升至 182 GB.

                  After doing this my SQL mdf/data file has rose to 319.7 GB, and my Log file has rose to 182 GB.

                  這占用了我大部分可用的操作系統空間,而我的 D 盤空間不足.

                  This has taken most of my free OS space and my D drive is now low on space.

                  我的問題是,一旦我對存檔數據感到滿意,我將刪除 _backup 表,只留下我好的活動表.

                  My question is, once I am happy with the archive data I am going to delete the _backup table just leaving my good live table.

                  但據我所知,SQL 不會將任何可用空間歸還給操作系統,從 log/mdf 文件中回收該空間的最佳方法是什么,我已經閱讀了很多關于縮小 db/log 的文章,但是很多人說這是不好的做法,任何建議都會很棒...

                  But as I understand it SQL will not give me back any free space to the OS, what is the best way to reclaim that space from the log/mdf files, I have read much about shrinking the db/log but many people saying this is bad practice, any advice would be great...

                  推薦答案

                  TL;DR; 不要縮小數據庫.曾經.

                  TL;DR; Do not shrink your database. Ever.

                  但如果你真的需要縮小它呢?

                  根據 SQL Server 專家 Brant Ozar 鏈接的文章 - 在某些情況下,縮小數據庫是一個合理的選擇:

                  According to the article linked about by SQL Server Expert Brant Ozar - there are circumstances where shrinking your database is a legitimate option:

                  • 您的數據庫為 1TB 或更大
                  • 您刪除了 50% 的數據
                  • 您有 500GB 以上的空閑空間
                  • 您永遠不需要那個空間,因為您現在正在定期進行刪除和存檔

                  完整答案:

                  您寫道,您一直在閱讀有關此內容的內容 - 所以我希望您遇到過諸如 Brent Ozar 的 收縮數據庫有什么不好DBCC SHRINKDATABASE?:

                  你有很高的碎片,所以你重建你的索引.

                  You have high fragmentation, so you rebuild your indexes.

                  這會留下很多空白空間,因此您會縮小數據庫.

                  Which leaves a lot of empty space around, so you shrink your database.

                  這會導致高度碎片化,因此您重建索引,這會使數據庫立即增長并再次留下空白空間,并且循環不斷自我延續.

                  Which causes high fragmentation, so you rebuild your indexes, which grows the databases right back out and leaves empty space again, and the cycle keeps perpetuating itself.

                  Mike Walsh的不要觸摸 SQL Server 中的收縮數據庫按鈕! - 他解釋相同的地方:

                  Mike Walsh's Don’t Touch that Shrink Database Button In SQL Server! - where he explains the same:

                  縮小數據庫會發生什么?

                  當您縮小數據庫時,您是在要求 SQL Server 從數據庫文件中刪除未使用的空間.SQL 使用的過程可能很丑陋并導致索引碎片.從長遠來看,這種碎片會影響性能.你已經釋放了那個空間,并讓 O/S 用它做它需要做的事情,所以你至少得到了你所要求的.如果您有一個不斷增長的數據庫,這意味著該數據庫將再次增長.根據您的自動增長設置,這種增長可能會超出必要,最終會再次縮小.充其量這只是額外的工作(收縮增長/收縮增長)并且由此產生的文件碎片處理得很好.更糟糕的是,這會導致索引碎片、文件碎片,并可能在收縮期間導致性能問題.

                  When you shrink a database, you are asking SQL Server to remove the unused space from your database’s files.The process SQL uses can be ugly and result in Index fragmentation. This fragmentation affects performance in the long run. You’ve freed that space and are letting the O/S do what it needs to with it, so you got what you asked for at least. If you have a growing database, this means that database will grow again. Depending on your autogrowth settings, this growth will probably be more than necessary and you will end up shrinking again. At best this is just extra work (shrink grow/shrink grow) and the resulting file fragmentation is handled alright. At worse this is causing index fragmentation, file fragmentation, and potentially causing performance problems during the shrink.

                  和 Aaron Bertrand 對 dba.StackExchange.com 上的 SHRINKFILE 最佳實踐和經驗 - 他基本上是在說你可以隨意忽略聰明、有經驗的人的好建議,并假設您的情況有所不同 - 但風險自負.這是他的結案陳詞:

                  and Aaron Bertrand's answer to SHRINKFILE best practices and experience on dba.StackExchange.com - where he is basically saying that you are free to ignore the good advice from smart, experienced people and assume that your case is different - but at your own risk. This is his closing argument:

                  將文件縮小到 4GB,然后強制其增大以容納新數據的操作成本要高得多.這就像洗一條已經干凈的毛巾,你將用它來擦掉一團糟..

                  It will be a much more expensive operation to shrink the file to 4GB, then force it to grow to accommodate the new data. This is like washing an already clean towel that you're about to use to wipe up a mess..

                  結論 - 你真的,真的應該注意專家在寫什么.需要說明的是:我并不認為自己是該主題的專家.
                  我從開發人員方面牢牢掌握了 T-SQL,但我在 DBA 方面的經驗很少——我可以一方面計算我必須編寫維護計劃、數據庫遷移或處理任何問題的次數.DBA 會做的系統管理工作.
                  然而,我提到的所有這些人都是領先的 DBA:Brent Ozar 是 MCM(微軟認證大師),Mike Walsh 是 9 次 MVP(自 2011 年以來),Aaron Bertrand 是 22 次 MVP(自 1997 年以來)——這些伙計們真的知道他們在寫什么.
                  我會在一周中的任何一天和周日兩次從他們中的任何一個那里獲得免費建議.

                  In conclusion - you really, really should pay attention to what experts are writing. Just to be clear: I'm not considering myself an expert on the subject.
                  I have a firm grasp of T-SQL from the developer side but I have very little experience from the DBA side - I can count on one hand the number of times I had to write stuff like maintenance plans, database migrations or handle any of the system administration stuff a DBA would.
                  However, all these guys I've mentioned are leading DBAs: Brent Ozar is a MCM (Microsoft Certified Master), Mike Walsh is a 9 times MVP (since 2011), and Aaron Bertrand is a 22 times MVP (since 1997) - These guys really know what they are writing about.
                  I would take a free advice from either of them any day of the week and twice on Sunday.

                  更新 - 關于日志文件:

                  縮小日志文件有點不同 - 定期執行是不好的做法.
                  日志文件大小基本上取決于您的備份策略和選擇的恢復模式.

                  Shrinking log files is somewhat of a different story - doing it on a regular basis is bad practice.
                  A log file size is basically derived from your backup strategy and selected recovery model.

                  推薦閱讀:Mike Walsh 的 在 dba.stackexchange 上自我回答的帖子 - 如果您愿意,我建議您閱讀他的完整答案以及 Aaron Bertrand 對同一帖子的完整答案.

                  Recommended read: Mike Walsh's self answered post over on dba.stackexchange - If you're up to it, I would advise reading both his full answer as well as Aaron Bertrand's full answer to the same post.

                  這篇關于SQL/Windows 操作系統釋放未使用的空間的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Break down a table to pivot in columns (SQL,PYSPARK)(分解表以按列進行透視(SQL、PYSPARK))
                  Spark giving Null Pointer Exception while performing jdbc save(Spark在執行jdbc保存時給出空指針異常)
                  execute query on sqlserver using spark sql(使用 spark sql 在 sqlserver 上執行查詢)
                  executeSql failing after putSql processor(putSql處理器后executeSql失敗)
                  How can I compare the one line in one CSV with all lines in another CSV file?(如何將一個 CSV 中的一行與另一個 CSV 文件中的所有行進行比較?)
                  How to map the column wise data in flowfile in NiFi?(如何在 NiFi 中映射流文件中的列數據?)
                    <tbody id='Yn8Qq'></tbody>

                  <small id='Yn8Qq'></small><noframes id='Yn8Qq'>

                1. <i id='Yn8Qq'><tr id='Yn8Qq'><dt id='Yn8Qq'><q id='Yn8Qq'><span id='Yn8Qq'><b id='Yn8Qq'><form id='Yn8Qq'><ins id='Yn8Qq'></ins><ul id='Yn8Qq'></ul><sub id='Yn8Qq'></sub></form><legend id='Yn8Qq'></legend><bdo id='Yn8Qq'><pre id='Yn8Qq'><center id='Yn8Qq'></center></pre></bdo></b><th id='Yn8Qq'></th></span></q></dt></tr></i><div class="l7ddfbp" id='Yn8Qq'><tfoot id='Yn8Qq'></tfoot><dl id='Yn8Qq'><fieldset id='Yn8Qq'></fieldset></dl></div>
                  <legend id='Yn8Qq'><style id='Yn8Qq'><dir id='Yn8Qq'><q id='Yn8Qq'></q></dir></style></legend>

                        • <tfoot id='Yn8Qq'></tfoot>
                          • <bdo id='Yn8Qq'></bdo><ul id='Yn8Qq'></ul>
                            主站蜘蛛池模板: 「阿尔法设计官网」工业设计_产品设计_产品外观设计 深圳工业设计公司 | 河南砖机首页-全自动液压免烧砖机,小型砌块水泥砖机厂家[十年老厂] | 杭州代理记账费用-公司注销需要多久-公司变更监事_杭州福道财务管理咨询有限公司 | 电抗器-能曼电气-电抗器专业制造商| 橡胶粉碎机_橡胶磨粉机_轮胎粉碎机_轮胎磨粉机-河南鼎聚重工机械制造有限公司 | 不锈钢轴流风机,不锈钢电机-许昌光维防爆电机有限公司(原许昌光维特种电机技术有限公司) | 可程式恒温恒湿试验箱|恒温恒湿箱|恒温恒湿试验箱|恒温恒湿老化试验箱|高低温试验箱价格报价-广东德瑞检测设备有限公司 | 耐破强度测试仪-纸箱破裂强度试验机-济南三泉中石单品站 | 棉服定制/厂家/公司_棉袄订做/价格/费用-北京圣达信棉服 | 进口试验机价格-进口生物材料试验机-西安卡夫曼测控技术有限公司 | 微妙网,专业的动画师、特效师、CG模型设计师网站! - wmiao.com 超声波电磁流量计-液位计-孔板流量计-料位计-江苏信仪自动化仪表有限公司 | 北京百度网站优化|北京网站建设公司-百谷网络科技 | nalgene洗瓶,nalgene量筒,nalgene窄口瓶,nalgene放水口大瓶,浙江省nalgene代理-杭州雷琪实验器材有限公司 | 酒店品牌设计-酒店vi设计-酒店标识设计【国际级】VI策划公司 | 掺铥光纤放大器-C/L波段光纤放大器-小信号光纤放大器-合肥脉锐光电技术有限公司 | 气力输送_输送机械_自动化配料系统_负压吸送_制造主力军江苏高达智能装备有限公司! | ERP企业管理系统永久免费版_在线ERP系统_OA办公_云版软件官网 | 冷却塔改造厂家_不锈钢冷却塔_玻璃钢冷却塔改造维修-广东特菱节能空调设备有限公司 | 颗粒机,颗粒机组,木屑颗粒机-济南劲能机械有限公司 | 心肺复苏模拟人|医学模型|急救护理模型|医学教学模型上海康人医学仪器设备有限公司 | 深圳货架厂家_金丽声精品货架_广东金丽声展示设备有限公司官网 | 顶空进样器-吹扫捕集仪-热脱附仪-二次热解吸仪-北京华盛谱信仪器 | 无锡门窗-系统门窗-阳光房-封阳台-断桥铝门窗厂[窗致美] | 电磁流量计厂家_涡街流量计厂家_热式气体流量计-青天伟业仪器仪表有限公司 | 螺旋压榨机-刮泥机-潜水搅拌机-电动泥斗-潜水推流器-南京格林兰环保设备有限公司 | 2025世界机器人大会_IC China_半导体展_集成电路博览会_智能制造展览网 | 行吊_电动单梁起重机_双梁起重机_合肥起重机_厂家_合肥市神雕起重机械有限公司 | 南京欧陆电气股份有限公司-风力发电机官网 | 缓蚀除垢剂_循环水阻垢剂_反渗透锅炉阻垢剂_有机硫化物-郑州威大水处理材料有限公司 | 粉末冶金注射成型厂家|MIM厂家|粉末冶金齿轮|MIM零件-深圳市新泰兴精密科技 | 山东氧化铁红,山东铁红-淄博科瑞化工有限公司 | 净化工程_无尘车间_无尘车间装修-广州科凌净化工程有限公司 | 薪动-人力资源公司-灵活用工薪资代发-费用结算-残保金优化-北京秒付科技有限公司 | 无菌实验室规划装修设计-一体化实验室承包-北京洁净净化工程建设施工-北京航天科恩实验室装备工程技术有限公司 | 冷水机,风冷冷水机,水冷冷水机,螺杆冷水机专业制造商-上海祝松机械有限公司 | 哈尔滨治「失眠/抑郁/焦虑症/精神心理」专科医院排行榜-京科脑康免费咨询 一对一诊疗 | 化工ERP软件_化工新材料ERP系统_化工新材料MES软件_MES系统-广东顺景软件科技有限公司 | 办公室家具_板式办公家具定制厂家-FMARTS福玛仕办公家具 | 螺旋压榨机-刮泥机-潜水搅拌机-电动泥斗-潜水推流器-南京格林兰环保设备有限公司 | 热回收盐水机组-反应釜冷水机组-高低温冷水机组-北京蓝海神骏科技有限公司 | 气体热式流量计-定量控制流量计(空气流量计厂家)-湖北南控仪表科技有限公司 |