I migrated a SQL Server database (source开发者_JAVA百科) into a SQL Server Express database (destiny). Used "generate scripts..." in SSMS.
I verified if the tables (tested with the 3 biggest tables) in the source DB had the same number of rows has the Express and all looked OK.
I executed sp_spaceused
and found that the original database size is 16MB, while the Express version is 4MB.
Does the Express DB uses less space or is this a sign that something went wrong with the migration?
Thank you
The reason is simple. When you migrated data, you are doing a very clean, ordered insert. There is no junk data, no removed records, no empty unused pages etc.
Also, if you have ever dropped columns (containing data) from the original database, the data is not removed, just marked as unusable - that again takes up space.
Shrinking the database will recover some space, if you include the move data pages option, it will even pack the data further. But do check for dropped columns and rebuild those tables.
http://www.simple-talk.com/community/blogs/andras/archive/2009/02/19/72068.aspx
The Sql Server engine will expand the size of the file as required for its own means. For example, you may have had more data in the source database at one point than it currently has. I would bet if you ran a shrink database command on the source DB, you would find that the file size is the same / similar. So in short, no, the difference in file size is not an indication something went wrong.
精彩评论