无法收缩数据文件 [英] Not able to shrink a data file

查看:91
本文介绍了无法收缩数据文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我在我的官方笔记本电脑上使用SQL Server Express版本,我从我的团队获得了35 GB的数据库。当我尝试在我的笔记本电脑中恢复时,它不允许恢复超过10 GB因为它是快递版。



所以,我安装了SQL服务器标准版试用版我的另一台笔记本电脑的版本,然后我恢复了。



我想要做的是,我必须缩小数据库大小不到10 GB,然后我必须在我的官方笔记本电脑中恢复



我尝试了什么:



我试图收缩我的数据库,文件大小是下面

 .mdf:19 GB< br /> 
.ldf:15 GB





我删除了一些不必要的表,然后我收缩了,缩小数据库需要大约3个小时。

收缩后,

 .mdf 10.6 GB,< br /> 
.ldf 19 GB< br />





再次我试图删除几个表,截断一些大表数据和所有。



但是收缩不会发生在 .mdf 尺寸仍为10.6 GB。但无论是删除日志文件,我都想缩小数据文件。



我该怎么做?

解决方案

可能你不能。如果它们的原始文件是35GB,那么它可能是一个非常充满数据的数据库 - 如果数据占用大量空间,则无法在不删除部分数据的情况下显着缩小文件!



关于在不丢弃数据的情况下能够做到这一点的唯一方法是创建两个(或更多)新数据库并将一半数据放在一个中,另一半放在另一个中两个较小的文件。它使您的应用程序使用它们变得复杂,但它应该让您获得足够小的文件以适应SQL Express。

或者购买完整版的SQL Server! :笑:

Hi,

I'm using SQL server express edition in my official laptop ,I got a database of 35 GB from my team. when i try to restore in my laptop,It is not allow to restore more than 10 GB because it a express edition.

So, I installed SQL server standard edition trial version in my another laptop,then i restored there.

what i want to do is,i have to shrink the database size less than 10 GB ,then i have to restore in my official laptop

What I have tried:

I have tried to shrink my database ,the file sizes are below

.mdf : 19 GB<br />
.ldf : 15 GB



I removed some unnecessary tables,then i shrink-ed , It took around 3 hours to shrink the database.
After shrinking ,

.mdf 10.6 GB,<br />
.ldf 19 GB <br />



Again i tried to remove few tables ,truncated some large table data's and all.

but shrinking is not happening the .mdf size still in 10.6 GB. but no matter of removing log files,i want to shrink the data file mainly.

How can i do this?

解决方案

Probably, you can't. If they original file is 35GB, then it's probably a database that's pretty full of data - and if the data occupies a lot of space, you can't shrink the file significantly without removing some of the data!

About the only way you are going to be able to do that without discarding data is to create two (or more) new databases and put half the data in one, and half in the other to get two smaller files. It complicates your application to use them, but it should let you get the files small enough to fit in SQL Express.
Or buy the full version of SQL Server! :laugh:


这篇关于无法收缩数据文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆