Copy database shrinks mdf file

  • Has anyone ever herd of such a problem. College of mine tried to resolve the problem and failed. She copied the database and the mdf file was a lot smaller. Is this realy possible and why?

  • i believe what you are seeing is the difference in the reserved space of the database....

    you can create a new database right now, which is just a copy of the model database with a new name right?

    you can then change it's properties, so it reserves, say one gig of space. now if you backup and restore that database, you need at least a gig of space to restore, even thought he database is virtually empty. this is very typical on a production database.

    you'd also see a lot of reserved space if you imported a bunch of data, and then deleted it....the database would autogrow to accomodate the new data, and extra space grabbed for the data is still there, even though it's empty.

    copying a database however, just copies the structure and data....

    it does not copy the reserved space...so your new db would be smaller than the original.

    right click on your original database and go to properties, and see how big it is, vs free space in the database.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • What was the problem that didn't work?

  • I never heard this. Simply copying the file does not shrink the data file for sure. If you can share the script used for copying the file then we can see.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply