• bommaka.nagarjun (12/5/2012)


    Hi,

    I have a SQL Server database whose data files have been created with an initial size of 150 GB, but it only contains 10 GB of data. A database backup will then be only 21 GB in size. I want to restore this backup to a different server (or a different database on the same server), but I don't want it to take the same disk space as the original one (150GB), which is what happens by default. I can't shrink the original database before taking a backup (it's a production database ), I could shrink the restored database after the restore is done, but I would really prefer to have it not take up 150 GB while doing that; besides, in this specific scenario I don't have that much free disk space on my Lap (machine ), so the restore isn't going anywhere.

    Is there any way I can restore the database and have it only take up as much space as the actual data it contains ???

    Please address this issue and need your inputs asap... 🙂

    1. Script out all the objects from the source database.

    2. Create destination database using the scripts you have. (Don't create the index and other constraints if you have huge data). Looking at 21 GB of data it should be fine with index.

    3. BCP out the data from the source server.

    4. BCP in the data to the destination server.

    This way you would have shrink the database in an effective way.