---
title: "How we can Reduce DB size to restore to SQL Server Express"  
description: "How we can Reduce DB size to restore to SQL Server Express"  
author: "Anonymous User"  
published: 2015-09-23  
updated: 2015-09-23  
canonical: https://www.mindstick.com/forum/33468/how-we-can-reduce-db-size-to-restore-to-sql-server-express  
category: "mssql server"  
tags: ["database", "mssql server"]  
reading_time: 2 minutes  

---

# How we can Reduce DB size to restore to SQL Server Express

I have a [SQL Server](https://www.mindstick.com/articles/12999/what-is-table-valued-function-in-sql-server) 2008 R2 [database](https://www.mindstick.com/articles/12226/use-of-database-in-sencha-extjs-and-insert-record-from-user-form-using-ajax), about 15 GB.\
I want to copy it for a [partner](https://www.mindstick.com/articles/12569/6-things-to-know-before-selecting-a-business-process-outsourcing-partner), who is using SQL Server 2008 R2 Express.\
I [deleted](https://www.mindstick.com/forum/160487/how-to-remove-the-deleted-git-code-marker-in-scrollbar-in-visual-studio-2022) many [tables](https://www.mindstick.com/articles/336597/introduction-of-html-tables-for-web-development) and rows, and now I am sure that the data is smaller than 2 GB.\
I make a [backup](https://www.mindstick.com/interview/1205/what-is-the-command-to-take-backup-and-restore-for-sharepoint-site), send to the partner, he tries to [restore](https://yourviews.mindstick.com/story/1480/ways-to-restore-ecosystems-and-heal-the-planet) it but he receives an [error](https://yourviews.mindstick.com/view/88527/fixing-quickbooks-error-4120-reinstalling-vs-repairing):\

```
CREATE DATABASE or ALTER DATABASE failed because the resulting cumulative database size would exceed your licensed limit of 10240 MB per database
```

What did I do [wrong](https://answers.mindstick.com/qa/48468/who-wrote-the-the-wrong-enemy-america-in-afghanistan-2001-2014-and-when)?

## Replies

### Reply by Anonymous User

The sum of the file size for all data files has to be < 10 GB, not the amount of data in the file. So, deleting data from some tables, or even dropping some tables, does not solve problem. You need to shrink the file, something like this:\
ALTER DATABASE mydb MODIFY FILE (name = N'logical_name', size = 2048MB);This will fail if the database size can't be reduced to 2 GB. You may need to first issue:\
DBCC SHRINKFILE(logical_name, 2048);If you use any form of SHRINKFILE, then you'll need to validate in File Explorer that the data file(s) are actually as small as you think (because shrink operations will shrink as much as they can, and stop silently when they can't reach your target size).\
Then take a backup, then restore on SQL [Server](https://www.mindstick.com/articles/43769/what-is-serverless-architecture-is-it-worth-switching-over) Express (with @@VERSION the same or higher than the source, of course).\
You may come across other issues, for example if you have used any features that aren't supported on Express.


---

Original Source: https://www.mindstick.com/forum/33468/how-we-can-reduce-db-size-to-restore-to-sql-server-express

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
