MSSQL - Shrinking database to minimum available size doesn't work

Copper Contributor

Hello Community,

Im having a really hard time getting the mssql database file shrinked to minimum available size that SSMS shows in GUI. I really need help and explanation because it's not relevant on any tech forum I found about it.
My issue is that I want to shrink db data file and in GUI, the minimum size of the file is 2314MB.

pmrzyglod_1-1713795619891.png

I apply the shrink - it does nothing. The db file still remains the same and I can repeat the process forever and nothing will happen to file.
Im looking for a good explanation of this behaviour as tried lot of different methods found on the internet and I can't make this shrink to happen.

Best regards, Paweł

7 Replies
Hi,
Try to shrink the database as Simple Recovery Model.you could check the Recovery model of Database by

Database->Options->Recovery Model
make it to Simple and try to shrink The DataBase

Regards
Arshad

@Arshad440 Hi, thanks for the reply.

I forgot to mention that my db stays in simple mode recovery from the beginning.

Best regards

@pmrzyglod , first, why do you want to shrink the database at all? It is very small and shrink will cause index fragmentation and so performance issues.

 

What does the statement below return?

exec sp_spaceused;

 

@olafhelper Hi, thanks for the reply.
This are the results of sp_spaceused;

pmrzyglod_0-1713852411473.png

Answering your question about the shrink. Issue here is that this DB works in express for demo purposes and at the beginning it wasn't a problem as the db was staying at around 4GB. After some time it kept to grow even tho data that was comming through wasn't bigger. So for now It keeps going up to 10GB and Im forced to keep less and less data. My opinion is that it is keeping reserved space for tables that once could grow bigger than usual and it broke the whole inflow.

Best regards

There is a mismatch between the information; the database has only 771 MB "unallocated space" = free space, you can't shrink below.

@olafhelper Hi, what do you mean by saying there is mismatch in the information?

pmrzyglod_0-1713866937174.png

Where does it come from then?
Why in the same time, GUI says that it have 4GB available and procedure says it's not?

@pmrzyglod , really the same database?

Run command below to update stats about usage

dbcc updateusage(0);