Sql 2012 database restore insufficient space

bjennings
bjennings used Ask the Experts™
on
I have a very big database that I need to restore in our dev environment, but I do not have enough space to overwrite the existing database.  I wanted to know if I could detach the current dev database, delete it, and then create a new db with the same name.  This way there would be enough space to overwrite the new db.  Do you think this will work?  As anyone run into this issue before?

Thanks,

Bill
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Senior Database Administrator
Commented:
Are you not overwriting to the same location ?

I know I've done a restore before (although not in 2012) where I didn't have enough space for the restore of a whole new copy, but I just overwrote the existing datafiles of DEV.

Failing that, why not just drop DEV and restore - why detach ?

(Doing it this way could break links between login id's in master and the users in the DB though, I suppose).
Vitor MontalvãoIT Engineer
Distinguished Expert 2017
Commented:
I wanted to know if I could detach the current dev database, delete it, and then create a new db with the same name.
This is only mathematic. How much is all current database file plus free space?
IF (SUM(db_files_size) + Drive_Free_Space) > Space_need_for_restore THEN
    Restore = OK
ELSE
    Restore = Error
ENDIF

Author

Commented:
Thank you guys!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial