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="vb57d7p" 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 操作系統(tǒng)釋放未使用的空間

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

        <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="z5tlzpv" 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 操作系統(tǒng)釋放未使用的空間的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我最近對(duì)我的數(shù)據(jù)進(jìn)行了一些存檔,并執(zhí)行了以下操作:

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

                  我有一個(gè)包含超過 3300 萬條記錄的數(shù)據(jù)庫表,其中許多是重復(fù)的.

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

                  我備份了表并將唯一數(shù)據(jù)插入到新表中,然后重命名/交換表名,這實(shí)現(xiàn)了我所需要的.

                  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.

                  然而現(xiàn)在我只剩下兩張桌子......

                  Now however I am left with two tables...

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

                  執(zhí)行此操作后,我的 SQL mdf/數(shù)據(jù)文件已上升至 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.

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

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

                  我的問題是,一旦我對(duì)存檔數(shù)據(jù)感到滿意,我將刪除 _backup 表,只留下我好的活動(dòng)表.

                  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.

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

                  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; 不要縮小數(shù)據(jù)庫.曾經(jīng).

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

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

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

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

                  • 您的數(shù)據(jù)庫為 1TB 或更大
                  • 您刪除了 50% 的數(shù)據(jù)
                  • 您有 500GB 以上的空閑空間
                  • 您永遠(yuǎn)不需要那個(gè)空間,因?yàn)槟F(xiàn)在正在定期進(jìn)行刪除和存檔

                  完整答案:

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

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

                  You have high fragmentation, so you rebuild your indexes.

                  這會(huì)留下很多空白空間,因此您會(huì)縮小數(shù)據(jù)庫.

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

                  這會(huì)導(dǎo)致高度碎片化,因此您重建索引,這會(huì)使數(shù)據(jù)庫立即增長(zhǎng)并再次留下空白空間,并且循環(huán)不斷自我延續(xù).

                  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 中的收縮數(shù)據(jù)庫按鈕! - 他解釋相同的地方:

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

                  縮小數(shù)據(jù)庫會(huì)發(fā)生什么?

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

                  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 對(duì) dba.StackExchange.com 上的 SHRINKFILE 最佳實(shí)踐和經(jīng)驗(yàn) - 他基本上是在說你可以隨意忽略聰明、有經(jīng)驗(yàn)的人的好建議,并假設(shè)您的情況有所不同 - 但風(fēng)險(xiǎn)自負(fù).這是他的結(jié)案陳詞:

                  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,然后強(qiáng)制其增大以容納新數(shù)據(jù)的操作成本要高得多.這就像洗一條已經(jīng)干凈的毛巾,你將用它來擦掉一團(tuán)糟..

                  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..

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

                  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.

                  更新 - 關(guān)于日志文件:

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

                  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 對(duì)同一帖子的完整答案.

                  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.

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

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

                  相關(guān)文檔推薦

                  Break down a table to pivot in columns (SQL,PYSPARK)(分解表以按列進(jìn)行透視(SQL、PYSPARK))
                  Spark giving Null Pointer Exception while performing jdbc save(Spark在執(zhí)行jdbc保存時(shí)給出空指針異常)
                  execute query on sqlserver using spark sql(使用 spark sql 在 sqlserver 上執(zhí)行查詢)
                  executeSql failing after putSql processor(putSql處理器后executeSql失敗)
                  How can I compare the one line in one CSV with all lines in another CSV file?(如何將一個(gè) CSV 中的一行與另一個(gè) CSV 文件中的所有行進(jìn)行比較?)
                  How to map the column wise data in flowfile in NiFi?(如何在 NiFi 中映射流文件中的列數(shù)據(jù)?)
                    <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="5fll7nz" 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>
                            主站蜘蛛池模板: 长江船运_国内海运_内贸船运_大件海运|运输_船舶运输价格_钢材船运_内河运输_风电甲板船_游艇运输_航运货代电话_上海交航船运 | 全自动端子机|刺破式端子压接机|全自动双头沾锡机|全自动插胶壳端子机-东莞市傅氏兄弟机械设备有限公司 | 二维运动混料机,加热型混料机,干粉混料机-南京腾阳干燥设备厂 | pH污水传感器电极,溶解氧电极传感器-上海科蓝仪表科技有限公司 | 大巴租车平台承接包车,通勤班车,巴士租赁业务 - 鸿鸣巴士 | 建筑资质代办-建筑资质转让找上海国信启航 | PVC快速门-硬质快速门-洁净室快速门品牌厂家-苏州西朗门业 | sus630/303cu不锈钢棒,440C/430F/17-4ph不锈钢研磨棒-江苏德镍金属科技有限公司 | 爆破器材运输车|烟花爆竹运输车|1-9类危险品厢式运输车|湖北江南专用特种汽车有限公司 | 衬塑管道_衬四氟管道厂家-淄博恒固化工设备有限公司 | Duoguan 夺冠集团| 动库网动库商城-体育用品专卖店:羽毛球,乒乓球拍,网球,户外装备,运动鞋,运动包,运动服饰专卖店-正品运动品网上商城动库商城网 - 动库商城 | 水厂自动化-水厂控制系统-泵站自动化|控制系统-闸门自动化控制-济南华通中控科技有限公司 | 粘度计维修,在线粘度计,二手博勒飞粘度计维修|收购-天津市祥睿科技有限公司 | 定坤静电科技静电消除器厂家-除静电设备 | 钢制拖链生产厂家-全封闭钢制拖链-能源钢铝拖链-工程塑料拖链-河北汉洋机械制造有限公司 | 万博士范文网-您身边的范文参考网站Vanbs.com | 袋式过滤器,自清洗过滤器,保安过滤器,篮式过滤器,气体过滤器,全自动过滤器,反冲洗过滤器,管道过滤器,无锡驰业环保科技有限公司 | 上海办公室装修_上海店铺装修公司_厂房装潢设计_办公室装修 | 新能源汽车教学设备厂家报价[汽车教学设备运营18年]-恒信教具 | 深圳标识制作公司-标识标牌厂家-深圳广告标识制作-玟璟广告-深圳市玟璟广告有限公司 | 口臭的治疗方法,口臭怎么办,怎么除口臭,口臭的原因-口臭治疗网 | 杭州火蝠电商_京东代运营_拼多多全托管代运营【天猫代运营】 | 不锈钢散热器,冷却翅片管散热器厂家-无锡市烨晟化工装备科技有限公司 | 铜镍-康铜-锰铜-电阻合金-NC003 - 杭州兴宇合金有限公司 | 求是网 - 思想建党 理论强党| 郑州大巴车出租|中巴车租赁|旅游大巴租车|包车|郑州旅游大巴车租赁有限公司 | SDG吸附剂,SDG酸气吸附剂,干式酸性气体吸收剂生产厂家,超过20年生产使用经验。 - 富莱尔环保设备公司(原名天津市武清县环保设备厂) | 钢格板|热镀锌钢格板|钢格栅板|钢格栅|格栅板-安平县昊泽丝网制品有限公司 | 环境模拟实验室_液体-气体控温机_气体控温箱_无锡双润冷却科技有限公司 | 瑞典Blueair空气净化器租赁服务中心-专注新装修办公室除醛去异味服务! | 盘扣式脚手架-附着式升降脚手架-移动脚手架,专ye承包服务商 - 苏州安踏脚手架工程有限公司 | 菲希尔X射线测厚仪-菲希尔库伦法测厚仪-无锡骏展仪器有限责任公司 | 百度网站优化,关键词排名,SEO优化-搜索引擎营销推广 | 深圳市人通智能科技有限公司 | 电解抛光加工_不锈钢电解抛光_常州安谱金属制品有限公司 | 济宁工业提升门|济宁电动防火门|济宁快速堆积门-济宁市统一电动门有限公司 | PC构件-PC预制构件-构件设计-建筑预制构件-PC构件厂-锦萧新材料科技(浙江)股份有限公司 | 挨踢网-大家的导航!| 杭州火蝠电商_京东代运营_拼多多全托管代运营【天猫代运营】 | 电渗析,废酸回收,双极膜-山东天维膜技术有限公司|