SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Restore DB with actual data size


Restore DB with actual data size

Author
Message
ArjunaReddy
ArjunaReddy
SSC Veteran
SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)SSC Veteran (271 reputation)

Group: General Forum Members
Points: 271 Visits: 554
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... Smile
anthony.green
anthony.green
One Orange Chip
One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)

Group: General Forum Members
Points: 25152 Visits: 6519
No, SQL must restore the database as it was at the time it was backed up, meaning it must create it with a size of 150GB.

The only thing would be to shrink it after restore if you cant shrink the source.



Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
When a question, really isn't a question - Jeff Smith
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger


Joie Andrew
Joie Andrew
SSCertifiable
SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)SSCertifiable (6.6K reputation)

Group: General Forum Members
Points: 6641 Visits: 2032
Do you have enough space on the source server to hold the database twice? If so you could try the following:

- Backup the database you want to put on the destination server
- Restored the database on the source server with a new database name
- Shrink the restored database
- Backup the restored database
- Delete the restored database from the source server
- Copy the backup over
- Restore the backup on the destination server

Joie Andrew
"Since 1982"
baabhu
baabhu
SSCrazy
SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)

Group: General Forum Members
Points: 2507 Visits: 1218
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... Smile



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.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search